I've made two packages (pphp
and xmlx
) and distributed and uploaded them the standard way, using python setup.py sdist bdist_wheel
and twine upload dist/*
.
I then tried installing them using pip install
, and it seemed to work fine... but then, in the interactive shell:
>>> import xmlx
Traceback (most recent call last):
File <module>, line 1:
import xmlx
ImportError: No module named xmlx
I then tried python setup.py install
but same result (seemed fine but didn't work).
So what's going on?
This is the repository for
xmlx
, yes? Yoursetup.py
declares the packages in your project withpackages=find_packages()
, but your project does not contain any import packages, only a single-file module,xmlx.py
. This must be declared in yoursetup.py
by instead writing:(Also,
dist/
and*.egg-info/
are build artifacts and should not be stored in version control; I recommend adding them to your.gitignore
.)