I am having difficulty creating a Graph object on Neo4j 3.4.6 using py2neo 4.10 with Python 3.7.0.

I created a Docker container running Neo4j, and I disabled authentication using Dockerfile entry ENV NEO4J_AUTH=none. I verified that I can browse to the Neo4j database from the host with http://localhost:7474 and that I was not required to enter a password.

I created a second Docker contain for my web server. I accessed the Bash shell using Docker exec -it 033f92b042c1 /bin/bash. I verified that I can ping the Docker image containing the Neo4j installation.

From the second Docker image, I tried to create a Database object or a Graph object.

import neo4j
import py2neo
from py2neo import Graph
graph = Graph("bolt://")

I tried different protocols and localhost rather than the IP. In each case, Python throws this:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/py2neo/database.py", line 88, in __new__
    inst = cls._instances[key]
KeyError: '5280a6d494b601f0256493eab3a08e55'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.7/site-packages/py2neo/database.py", line 305, in __new__
    database = Database(uri, **settings)
  File "/usr/local/lib/python3.7/site-packages/py2neo/database.py", line 92, in __new__
    from py2neo.internal.http import HTTPDriver, HTTPSDriver
  File "/usr/local/lib/python3.7/site-packages/py2neo/internal/http.py", line 26, in <module>
    from neo4j.addressing import SocketAddress
  File "/usr/local/lib/python3.7/site-packages/neo4j/addressing.py", line 26, in <module>
    from neo4j.exceptions import AddressError
ImportError: cannot import name 'AddressError' from 'neo4j.exceptions' (/usr/local/lib/python3.7/site-packages/neo4j/exceptions.py)

Am I missing a dependency, or is there another way I should be connecting the Docker images?

1 Answer 1


I had a similar error while using a virtual environment using PyCharm. In my case, I was using an upgraded version of neo4j-driver in my virtual environment compared to my host environment. I downgraded neo4j-driver from 1.7 to 1.6.2.

Make sure you have neo4j-driver installed in general.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.