Search code examples
databasegraphneo4jconnectionpy2neo

Using Graph() in py2neo gives ImportError


I am a beginner in py2neo and Neo4j. I have installed py2neo latest version. I downloaded Neo4j server and started it using command(I am using mac)

./bin/neo4j console

I waited until the following message was displayed in the terminal.

Remote interface available at http://localhost:7474/

In python, from terminal I tried the following and got the error below.

from py2neo import Graph
graph = Graph()

The error message is below

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/rameshr/anaconda2/lib/python2.7/site-     packages/py2neo/database.py", line 305, in __new__
database = Database(uri, **settings)
File "/Users/rameshr/anaconda2/lib/python2.7/site-packages/py2neo/database.py", line 92, in __new__
from py2neo.internal.http import HTTPDriver, HTTPSDriver
File "/Users/rameshr/anaconda2/lib/python2.7/site- packages/py2neo/internal/http.py", line 27, in <module>
from neo4j.bolt import ServerInfo
File "/Users/rameshr/anaconda2/lib/python2.7/site-packages/neo4j/bolt/__init__.py", line 21, in <module>
from .connection import *
File "/Users/rameshr/anaconda2/lib/python2.7/site-packages/neo4j/bolt/connection.py", line 33, in <module>
from io import BytesIO
File "/Users/rameshr/anaconda2/lib/python2.7/site-packages/neo4j/bolt/io.py", line 24, in <module>
from neo4j.compat import memoryview_at
ImportError: cannot import name memoryview_at

I couldn’t find any similar problem. Could someone give me pointers on what could be done please?


Solution

  • I eventually found that the default neo4j-driver which came with py2neo had some problem. Doing the below solved it.

    pip install neo4j-driver==1.6.2