(Unable to retrieve routing information

HI , I am new to Neo4j I tried initially to access it via python on google colab and it worked well, when I tryied from puython runing on mt machine I get (Unable to retrieve routing information), my connection string is uri = "neo4j+s://b680a66a.databases.neo4j.io" and it is running for Mac ( tried intel and M1 )

Could you share some code?

from neo4j import GraphDatabase
import logging
from neo4j.exceptions import ServiceUnavailable

class App:

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

def close(self):
    # Don't forget to close the driver connection when you are finished with it

def create_friendship(self, person1_name, person2_name):
    with self.driver.session() as session:
        # Write transactions allow the driver to handle retries and transient errors
        result = session.write_transaction(
            self._create_and_return_friendship, person1_name, person2_name)
        for row in result:
            print("Created friendship between: {p1}, {p2}".format(p1=row['p1'], p2=row['p2']))

def _create_and_return_friendship(tx, person1_name, person2_name):
    # To learn more about the Cypher syntax, see https://neo4j.com/docs/cypher-manual/current/
    # The Reference Card is also a good resource for keywords https://neo4j.com/docs/cypher-refcard/current/
    query = (
        "CREATE (p1:Person { name: $person1_name }) "
        "CREATE (p2:Person { name: $person2_name }) "
        "CREATE (p1)-[:KNOWS]->(p2) "
        "RETURN p1, p2"
    result = tx.run(query, person1_name=person1_name, person2_name=person2_name)
        return [{"p1": row["p1"]["name"], "p2": row["p2"]["name"]}
                for row in result]
    # Capture any errors along with the query and data for traceability
    except ServiceUnavailable as exception:
        logging.error("{query} raised an error: \n {exception}".format(
            query=query, exception=exception))

def find_person(self, person_name):
    with self.driver.session() as session:
        result = session.read_transaction(self._find_and_return_person, person_name)
        for row in result:
            print("Found person: {row}".format(row=row))

def _find_and_return_person(tx, person_name):
    query = (
        "MATCH (p:Person) "
        "WHERE p.name = $person_name "
        "RETURN p.name AS name"
    result = tx.run(query, person_name=person_name)
    return [row["name"] for row in result]

if name == "main":
# Aura queries use an encrypted connection using the "neo4j+s" URI scheme
uri = "neo4j://b680a66a.databases.neo4j.io"
user = "neo4j"
password = "XXXX"
app = App(uri, user, password)
app.create_friendship("Alice", "David")

1 Like

In this topic there was a problem with the python version that was being used. Could you try to verify this?

Thanks fo the suggestion I was using 3.8 I tried with 3.9 but it gave same error . On colab it works fine with 3.7 , locally I tried 3.8, 3.7 and 3.9 and they gave the same error. Wonder if it is link to OS X or with my network

1 Like

Shouldn't this be neo4j+s:// to match the protocol?

thanks with 3.9 and the fix on the uri it is working

1 Like