ModuleNotFoundError: No module named 'neo4j' continued

I am trying to write code in Python (MacOS, Python 3.7.6 64-bit, Spyder 4.0.1) but I can't even get the HelloWorld example to work from the "Using Neo4j from Python" section of the Developer Guide. It fails at the first line. "pip list" shows I have the neo4j Python driver 1.7.6. I am running Neo4j Desktop 1.2.4 with Neo4j Browser 4.0.3 (all freshly installed). I have a single empty graph, visible in Neo4j Browser 4.0.3, which indicates I am running Neo4j 4.0.1.

I have read the previous topic on this error message and none of the answers make sense to me / don't work for me that I can see.

Perhaps I have to wait for "the upcoming 2.0 release of the driver"?

Any clues?

from neo4j import GraphDatabase # <--- fails here

class HelloWorldExample(object):

def __init__(self, uri, user, password):
    self._driver = GraphDatabase.driver(uri, auth=(user, password))

def close(self):
    self._driver.close()

def print_greeting(self, message):
    with self._driver.session() as session:
        greeting = session.write_transaction(self._create_and_return_greeting, message)
        print(greeting)

@staticmethod
def _create_and_return_greeting(tx, message):
    result = tx.run("CREATE (a:Greeting) "
                    "SET a.message = $message "
                    "RETURN a.message + ', from node ' + id(a)", message=message)
    return result.single()[0]

Welcome to the community John. Do you have your error messages? Or logs? That might help us get you pointed in the right direction. Thank you.

Do you have both neo and neobolt packages installed?

Here's my list

neo4j 1.7.3
neobolt 1.7.13

I don't have any issues in connecting to Neo4j server.

Thanks, I have:
neo4j 1.7.6
neo bolt 1.7.15

Error message in the Spyder console:

Traceback (most recent call last):

File "/Users/johnburton/Documents/Python Workspace/pythondriver1.py", line 9, in
from neo4j import GraphDatabase

ModuleNotFoundError: No module named 'neo4j'

Oops, that should be 'neo bolt 1.7.15'
Lines 1-8 are blank or commented.

autocorrect!, 'neobolt'

1 Like

Did you ever figure this out? I'm having the same issue, 4 years later..

@indyrowes

what version of Neo4j?
version of the Neo4j python driver? note the latest is 5.22 https://pypi.org/project/neo4j/5.22.0/.