Answers: <p>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.</p>
  
  <p>Make sure you have neo4j-driver installed in general.</p>
  
Answers: CC BY-SA 4.0
Answers: 2018-10-26T15:45:20.153Z
Answers: 2018-10-26T15:45:20.153Z
Answers: anonymous
Body: <p>I am having difficulty creating a <code>Graph</code> object on Neo4j 3.4.6 using py2neo 4.10 with Python 3.7.0.</p>
  
  <p>I created a Docker container running Neo4j, and I disabled authentication using Dockerfile entry <code>ENV NEO4J_AUTH=none</code>. I verified that I can browse to the Neo4j database from the host with <a href="http://localhost:7474" rel="nofollow noreferrer">http://localhost:7474</a> and that I was not required to enter a password.</p>
  
  <p>I created a second Docker contain for my web server. I accessed the Bash shell using <code>Docker exec -it 033f92b042c1 /bin/bash</code>. I verified that I can ping the Docker image containing the Neo4j installation.</p>
  
  <p>From the second Docker image, I tried to create a <code>Database</code> object or a <code>Graph</code> object. </p>
  
  <pre><code>import neo4j
  import py2neo
  from py2neo import Graph
  graph = Graph("bolt://172.17.0.3:7687")
  </code></pre>
  
  <p>I tried different protocols and <code>localhost</code> rather than the IP. In each case, Python throws this:</p>
  
  <pre><code>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 "&lt;stdin&gt;", line 1, in &lt;module&gt;
    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 &lt;module&gt;
      from neo4j.addressing import SocketAddress
    File "/usr/local/lib/python3.7/site-packages/neo4j/addressing.py", line 26, in &lt;module&gt;
      from neo4j.exceptions import AddressError
  ImportError: cannot import name 'AddressError' from 'neo4j.exceptions' (/usr/local/lib/python3.7/site-packages/neo4j/exceptions.py)
  </code></pre>
  
  <p>Am I missing a dependency, or is there another way I should be connecting the Docker images?</p>
  
Tags: <docker>
Title: py2neo AddressError When Connecting to neo4j in Docker
UserDisplayName: Jacob Quisenberry
ThreadText: # py2neo AddressError When Connecting to neo4j in Docker
  
  (Asked by: username_0 on 2018-08-22)
  
  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://172.17.0.3:7687")
  
  ```
  
  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?
  
  **Tags:** docker
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-10-26. Score: 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.
  
  
  ---
  
  