cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Trouble connecting to neo4j V4 via python

I have an issue that may be related to the question above. I've downloaded neo4j V4 but when I run the following lines of code in Python 3:

from neo4j import GraphDatabase
import request 
uri = "bolt://localhost:7687/"
driver = GraphDatabase.driver(uri,auth=("neo4j","password"))

I keep getting "FileNotFoundError: [Errno 2] No such file or directory" for the fourth line referenced above. I can see in the Neo4j desktop (v 1.2.4) that my graph is running, that my uri is correct and I've set the authentication correctly.

Is this related to the python driver issue raised here: Python Driver for Neo4j V4

Or is it some other connection / other issue?

3 REPLIES 3

Hi Michael,

Neo4j Inc is updating the neo4j-python-driver, so please wait for the release 4.0.

from neo4j import GraphDatabase

uri = "bolt://localhost:7687"
driver = GraphDatabase.driver(uri, auth=("neo4j", "password"))

def print_friends_of(tx, name):
    for record in tx.run("MATCH (p:Person)-[:ACTED_IN]->(m:Movie) "
                         "WHERE p.name = {name} "
                         "RETURN m.title", name=name):
        print(record["m.name"])

with driver.session() as session:
    session.read_transaction(print_friends_of, "Tom Hanks")

It worked on Neo4j 3.5.14 but error on 4.0.0.
I also tried uri = "bolt://localhost:7687/neo4j".

Can you try to turn off encryption when you connect to localhost?

For remote hosts, install SSL certificates into your Neo4j server.

Yes, turn off the encryption helps.

driver = GraphDatabase.driver(uri, auth=("neo4j", "password"), encrypted = False)

The next issue you will run into is: "The old parameter syntax {param} is no longer supported. Please use $param instead..."