Skip to content Skip to sidebar Skip to footer

Python Install Wheel Leads To Import Error

I'd like to make a wheel binary distribution, intstall it and then import it in python. My steps are I first create the wheel: python ./my_package/setup.py bdist_wheel I install t

Solution 1:

I had the very same error, but it was due to my setup.py not specifying the entry "packages=setuptools.find_packages()". Everythings builds nicely without that but you can't import anything even though pip shows it to be installed.

Solution 2:

If you need to execute the setup script from another directory, ensure you are entering the project dir in the script.

from setuptools import setup

root = os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir))
os.chdir(root)

# or using pathlib (Python>=3.4):
import patlib
root = pathlib.Path(__file__).parent
os.chdir(str(root))

setup(...)

Solution 3:

In my case, in order to solve it I just had to upgrade pip (since Docker installed pip 9).

python3 -m pip install --upgrade pip

Post a Comment for "Python Install Wheel Leads To Import Error"