How can I fix "No module named 'api.neo4j'"?

Hi everyone,

Justin here.

I’m busy with Building Neo4j Applications with Python. I'm working in Windows. When I run the tests, I get this error: "ModuleNotFoundError: No module named 'api.neo4j'"

I've successfully installed all the modules in the requirements.txt. And I don't know what else I need to install to get this to work. I'd appreciate any help.

Thank you in advance.

This error happens when the current module isn't in the PYTHONPATH environment variable. To get around this I have added PYTHONPATH=. to the start of the command.

PYTHONPATH=. pytest tests/05_authentication__test.py

You could also run export PYTHONPATH=. in the terminal to apply it for that session.

Thanks Adam! This seems to work. I appreciate the help.

1 Like