How to Fix ModuleNotFoundError and ImportError

Do proper module imports and make your life easier

Giorgos Myrianthous
Towards Data Science
5 min readSep 13, 2020

--

Photo by Leone Venter on unsplash.com

tl;dr

  • Use absolute imports
  • Append your project’s root directory to PYTHONPATH — In any environment you wish to run your Python application such as Docker, vagrant or your virtual environment i.e. in bin/activate, run (or e.g. add to bin/activate

--

--

I strive to build data-intensive systems that are not only functional, but also scalable, cost effective and maintainable over the long term.