Cannot import module with PyCharm, why?

Question:

PyCharm 2018.1.3 pro / Python 3.6.1 / Module: neo4j-driver 1.5.3

The strange thing is that if I trying to import neo4j.v1 using script editor in PyCharm and run it I’m getting error:

Traceback (most recent call last): File “C:/experiment/Cypher.py”,
line 1, in from neo4j.v1 import GraphDatabase ModuleNotFoundError: No
module named ‘neo4j’

Process finished with exit code 1

But this script works just fine if I call it using Windows PowerShell environment using simple command prompt:

> python C:/experiment/Cypher.py

So, I think that something is wrong with settings or with PyCharm. What should I do to solve this problem?

Asked By: Quanti Monati

||

Answers:

From pycharm,

goto settings -> project Interpreter

Click on + button on top right corner and you will get pop-up window of Available packages. Then search for neo4j python package.

Then click on Install package to install the package.

Answered By: user5777975

neo4j.v1 is not a default python module, it is not automatically installed when you install python.

To install neo4j.v1 Follow the instructions here.

Its possible to install it directly from pycharm, as other answers have pointed out, but its better to download from the official source to make sure all related dependencies and packages are properly installed.

Answered By: Flaming_Dorito