I have followed this tutorial to upload a package to PyPI. My package is now uploaded to test instance of the index: https://test.pypi.org/project/ilya-ezplots/#files. However when I install it with pip, I still can't import it.
>>> import ilya_ezplots
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'ilya_ezplots'
I have inspected the site-packages of my python interpreter, and found only ilya_ezplots-0.0.2.dist-info
directory. For other packages there would be two directories, e.g. h5py-2.9.0.dist-info
and h5py
.
My setup.py:
import setuptools
setuptools.setup(
name="ilya_ezplots",
version="0.0.2",
packages=['plots'],
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
],
)
Upload script:
#!/usr/bin/env bash
rm -r dist
python setup.py sdist bdist_wheel
python -m twine upload -r testpypi dist/* -u ikamensh
File structure:
./
./plots/__init__.py
./setup.py
./upload.sh
Let's me point you to my previous answer: https://stackoverflow.com/a/54599368/7976758
ilya_ezplots
is the name of your distribution but it's not importable name. The importable name after installation is plots
. So:
import plots