I do my first steps in python package distributions.
Unfortunately, I have ModuleNotFoundError
after successful install from pip.
My dirs layout is pretty simple:
maindir
|- setup.py
|- pysoft
|- __init__.py
|- main.py
|- pylib.py
main.py:
import pylib
def main():
print("main program")
pylib.libfunc()
if __name__ == '__main__':
main()
pylib.py:
def libfunc():
print("lib func")
setup.py:
import setuptools
setuptools.setup(
name='pysoft',
version='0.0.21',
author='als',
author_email='als@gnail.com',
description='deploy tester',
py_modules=['pylib'],
packages=setuptools.find_packages(),
python_requires='>=3.6',
entry_points={
'console_scripts': [
'pysoft = pysoft.main:main',
],
},
)
I do packaging and uploading to test.pypi.org:
python3 setup.py sdist bdist_wheel
python3 -m twine upload --repository-url https://test.pypi.org/legacy/ dist/*
I setup and start new virtualenv
and install my package:
python3 -m pip install -i https://test.pypi.org/simple/ pysoft
Then I try to run it, but got error:
pysoft
Traceback (most recent call last):
File "/home/fat/buff/tt/bin/pysoft", line 5, in <module>
from pysoft.main import main
File "/home/fat/buff/tt/lib/python3.6/site-packages/pysoft/main.py", line 1, in <module>
import pylib
ModuleNotFoundError: No module named 'pylib'
Could you figure out where I have wrong step?