Python is installed in a local directory.
My directory tree looks like this:
(local directory)/site-packages/toolkit/interface.py
You are reading this answer says that your __init__.py
is in the right place, you have installed all the dependencies and you are still getting the ImportError
.
I was facing a similar issue except that my program would run fine when ran using PyCharm but the above error when I would run it from the terminal. After digging further, I found out that PYTHONPATH
didn't have the entry for the project directory. So, I set PYTHONPATH
per Import statement works on PyCharm but not from terminal:
export PYTHONPATH=$PYTHONPATH:`pwd` (OR your project root directory)
There's another way to do this using sys.path
as:
import sys
sys.path.insert(0,'') OR
sys.path.append('')
You can use insert/append based on the order in which you want your project to be searched.