Search code examples
pythonneo4jpy2neo

py2neo: no module named core


I am trying to upload some files into a Neo4j database using python.

I am using Python 2.7.6 and haved successfully installed neo4j-driver and py2neo modues:

$ sudo pip install neo4j-driver
Downloading/unpacking neo4j-driver
  Downloading neo4j-driver-1.3.1.tar.gz (167kB): 167kB downloaded
  Running setup.py (path:/tmp/pip_build_root/neo4j-driver/setup.py) egg_info for package neo4j-driver

    warning: no previously-included files matching '*.class' found anywhere in distribution
    warning: no previously-included files matching '*.pyc' found anywhere in distribution
    warning: no previously-included files matching '*.pyo' found anywhere in distribution
    warning: no previously-included files matching '*.so' found anywhere in distribution
    warning: no previously-included files matching '*.dll' found anywhere in distribution
    warning: no previously-included files matching '__pycache__' found anywhere in distribution
    no previously-included directories found matching 'test'
Installing collected packages: neo4j-driver
  Running setup.py install for neo4j-driver
    building 'neo4j.bolt._io' extension
    x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c neo4j/bolt/_io.c -o build/temp.linux-x86_64-2.7/neo4j/bolt/_io.o
    x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/neo4j/bolt/_io.o -o build/lib.linux-x86_64-2.7/neo4j/bolt/_io.so
    building 'neo4j.packstream._packer' extension
    x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c neo4j/packstream/_packer.c -o build/temp.linux-x86_64-2.7/neo4j/packstream/_packer.o
    x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/neo4j/packstream/_packer.o -o build/lib.linux-x86_64-2.7/neo4j/packstream/_packer.so
    building 'neo4j.packstream._unpacker' extension
    x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c neo4j/packstream/_unpacker.c -o build/temp.linux-x86_64-2.7/neo4j/packstream/_unpacker.o
    x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/neo4j/packstream/_unpacker.o -o build/lib.linux-x86_64-2.7/neo4j/packstream/_unpacker.so

    warning: no previously-included files matching '*.class' found anywhere in distribution
    warning: no previously-included files matching '*.pyc' found anywhere in distribution
    warning: no previously-included files matching '*.pyo' found anywhere in distribution
    warning: no previously-included files matching '*.so' found anywhere in distribution
    warning: no previously-included files matching '*.dll' found anywhere in distribution
    warning: no previously-included files matching '__pycache__' found anywhere in distribution
    no previously-included directories found matching 'test'
  Could not find .egg-info directory in install record for neo4j-driver
Successfully installed neo4j-driver
Cleaning up...






$ sudo pip install py2neo
Downloading/unpacking py2neo
  Downloading py2neo-3.1.2.tar.gz (100kB): 100kB downloaded
  Running setup.py (path:/tmp/pip_build_root/py2neo/setup.py) egg_info for package py2neo

    warning: no previously-included files found matching 'CONTRIBUTING.md'
    warning: no previously-included files found matching 'README.md'
    warning: no previously-included files matching '*' found under directory 'test'
    warning: no previously-included files matching '*' found under directory 'test_ext'
Installing collected packages: py2neo
  Running setup.py install for py2neo

    warning: no previously-included files found matching 'CONTRIBUTING.md'
    warning: no previously-included files found matching 'README.md'
    warning: no previously-included files matching '*' found under directory 'test'
    warning: no previously-included files matching '*' found under directory 'test_ext'
    Installing neokit script to /usr/local/bin
    Installing geoff script to /usr/local/bin
    Installing py2neo script to /usr/local/bin
  Could not find .egg-info directory in install record for py2neo
Successfully installed py2neo
Cleaning up...

but there are complaints of no module called core

$ python
Python 2.7.6 (default, Jun 22 2015, 17:58:13) 
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from py2neo.core import Graph
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named core
>>> 

Anyone else had this issue?


Solution

  • The py2neo docs says you should use:

    from py2neo import Graph
    

    instead of:

    from py2neo.core import Graph
    

    That is: remove the .core from the above code line. Take a look in this link.