cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

ModuleNotFoundError: No module named 'neo4j'

Hi Team,

I am trying access neo4j db through Jupyter notebook. But i am getting a below error when i try to access using python.

import pandas as pd
pd.set_option('display.max_colwidth', -1)
import math

from neo4j.v1 import GraphDatabase
driver = GraphDatabase.driver("hostname:7687", auth=('UN', 'PWD'))


ModuleNotFoundError Traceback (most recent call last)
in ()
3 import math
4
----> 5 from neo4j.v1 import GraphDatabase
6 driver = GraphDatabase.driver("bolt://:7687", auth=('UN', 'pwd')) # update IP

ModuleNotFoundError: No module named 'neo4j'

Note: Jupyter notebook runs in EC2 instance.

I tried pip install neo4j-driver ==1.6.2 did not help. Because my linus server pip freeze not showing neo4j-driver

Thanks,
Nithin.

18 REPLIES 18

m-kiuchi
Node Clone

Hi,

Try

from neo4j import GraphDatabase, basic_auth

instead of neo4j.v1. It is old style and deprecated.

Hi,

it didn't work with both neo4j and neo4j.v1. Pip freeze not listing out neo4j-driver.

Can you please help me on how to resolve this?

Thanks,
Nithin.

1.6.2 sounds old... try latest version. I've confirmed to work with 1.7.1.

And, I afraid that you may mix Python2 and Python3...
Try python3 -m pip install neo4j --user and install latest bolt driver instead of running pip itself.
Then, try again with python3. Neo4j driver doesn't support python2. https://github.com/neo4j/neo4j-python-driver

Thanks, it worked for me.

No luck

Getting below error :
root@ip-10-206-162-180:/home/ubuntu# python --version
Python 3.6.1 :: Anaconda 4.4.0 (64-bit)
root@ip-10-206-162-180:/home/ubuntu# python3 -m pip install neo4j
Collecting neo4j
Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7fe553e96b70>: Failed to establish a new connection: [Errno 101] Network is unreachable',)': /simple/neo4j/

I seem that you cannot reach internet. Ask your network admin.
You may download neo4j package and corresponding packages by yourself ( https://pypi.org/project/neo4j/ ), but I don't recommend...

I have downloaded the neo4j-1.7.2.tar.gz and i did tar -xf neo4j-1.7.2.tar.gz. I can see neo4j-1.7.2 package.

But when i run

root@ip-10-206-162-180:/mnt/xvdb/neo4j-1.7.2/neo4j# python3 -m pip install neo4j --user
Could not import runpy module
Traceback (most recent call last):
File "/root/anaconda3/lib/python3.6/runpy.py", line 14, in
import importlib.machinery # importlib first so we can test #15386 via -m
File "/root/anaconda3/lib/python3.6/importlib/init.py", line 57, in
import types
File "/mnt/xvdb/neo4j-1.7.2/neo4j/types/init.py", line 29, in
from neo4j import Record
ModuleNotFoundError: No module named 'neo4j'

Before running your script, install neo4j driver like below.

[u190318@localhost ~]$ which python3
~/anaconda3/bin/python3
[u190318@localhost ~]$ ls
Anaconda3-2018.12-Linux-x86_64.sh  anaconda3  neo4j-1.7.2  neo4j-1.7.2.tar.gz
[u190318@localhost ~]$ cd neo4j-1.7.2/
[u190318@localhost neo4j-1.7.2]$ python3 setup.py install
(snip)
[u190318@localhost neo4j-1.7.2]$ python3
Python 3.7.1 (default, Dec 14 2018, 19:28:38) 
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from neo4j import GraphDatabase
>>> 
[u190318@localhost neo4j-1.7.2]$ 

Thanks
Now it works for me

Hi,

Above steps are running fine. But still in Jupyter notebook not able to import graphdatabase.

After doing above steps, need to restart my jupyter again?

Thanks,
Nithin.

I'm happy that you've succeed to install neo4j driver.
In my experience, you don't need to restart kernel, but just run cell including driver import.
But just in case, you had better to restart kernel, if you can..

Hi m-kiuchi,
I have downloaded driver from


and uploaded in AWS S3 and updated same Glue's python library section but I am getting error "no module named neo4j"
Kindly help

Wow.. You are correct but now i am running into another issue

ModuleNotFoundError: No module named 'neobolt'

Please assist me how to knock this out.

Thanks,
Nithin.

Haha. It's almost same procedure.

  • download neobolt from pypi https://pypi.org/project/neobolt/
  • install as above(python3 setup.py install)
  • run your notebook again. You don't need add 'import neobolt'. It's used by neo4j driver itself.

Great!! Thank you so much. All my issues resolved. I am able to load data into Neo4j DB using Jupyter notebook.

For you 5 stars

I'm so happy. Enjoy neo4j !

Hi Kiuchi,

This is out of topic from the above question. I have apoc plugins - apoc-3.5.0.1-all.jar
in neo4j DB. But when i run below Cypher query getting below error

match(n {path:'/PROJECTS/DATA/SERIAL/MORT/PUB_MORT_SVCG/ARCH/CAPDW_FW_LPS_MONTHLY_2520'})
with (n)
call apoc.path.expandConfig(n,{relationshipFilter: "TO",
labelFilter: "",
uniqueness: "",
minLevel:1, maxLevel:5,
filterStartNode:false}) yield path as path
return path
Limit 100;

Neo.ClientError.Procedure.ProcedureNotFound: There is no procedure with the name apoc.path.expandConfig registered for this database instance. Please ensure you've spelled the procedure name correctly and that the procedure is properly deployed.

I have some idea, but you had better to create another topic. See you there !