How can I publish a package on PyPI such that all dependencies are automatically installed, rather than manually by the user.
I specify the dependencies in setup.py with install_requires as follows:
setuptools.setup(name='myPackage',
version='1.0',
packages=setuptools.find_packages(),
include_package_data=True,
classifiers=[
'Programming Language :: Python :: 3',
'Operating System :: OS Independent',
'Topic :: Scientific/Engineering :: Bio-Informatics'
],
install_requires=['numpy', 'pandas', 'sklearn'],
python_requires='>=3'
)
And I have a requirements.txt file which is included in my MANIFEST.in:
numpy==1.15.4
sklearn==0.20.1
pandas==0.23.4
However, after publishing on test.pypi when I try to install the package, I get the following error:
Could not find a version that satisfies the requirement numpy (from myPackage==1.0.0) (from versions: )
No matching distribution found for sklearn (from myPackage==1.0.0)
This means that PyPI does not install the numpy dependency.
How do I enable automatic installation of my dependencies?
Should I use a virtual environment when building and publishing the package? How do I do this?
P.S. I am entirely new to this so I will appreciate explicit code or links to simple tutorial pages. Thank you.
解决方案
I realized that installing packages from test.PyPI does not install all packages, since some of these packages are hosted on PyPI and not test.PyPI.
When I published the package on PyPI as a pre-release version (1.0a1), instead on test.PyPI, the dependencies were correctly installed. Hence, the problem was purely with test.PyPI.