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
----> 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




from neo4j import GraphDatabase, basic_auth

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


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?


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.

1 Like

No luck :frowning:

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 ( ), 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/", line 14, in
import importlib.machinery # importlib first so we can test #15386 via -m
File "/root/anaconda3/lib/python3.6/importlib/", line 57, in
import types
File "/mnt/xvdb/neo4j-1.7.2/neo4j/types/", 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
[u190318@localhost ~]$ ls  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 install
[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]$ 
1 Like


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?


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..

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.


Haha. It's almost same procedure.

  • download neobolt from pypi
  • install as above(python3 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 :slight_smile:

1 Like

I'm so happy. Enjoy neo4j !

1 Like

Hi Kiuchi,

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

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 !

Now it works for me :slight_smile: