I built a Python package with a setup.py that looks like:
from setuptools import setup, find_packages
setup(
name='my_package',
version='0.1',
url='https://github.com/me/my_package',
download_url='https://github.com/dwnlod.tar.gz',
author='me',
author_email='[email protected]',
license='MIT',
packages=['my_package'],
install_requires=[
'numpy',
'other_package'
]
)
When I install the package locally with
pip install .
Pip installs all the dependencies in install_requires. However, when I register the package through PyPI, and use
pip install my_package
Pip does not install the dependencies. (I did this with a fresh environment, so the packages are not installed already; the install fails.) What's going on? Reading through the documentation, it looks like maybe something like
install_requires=[
'numpy==1.14.1',
'other_package==ve.rs.ion'
]
Might work better, because the versions are specified. Could this be the problem?
Here is a link to the repo:
Your setup.py
contains the following line:
path = pkg_resources.resource_filename('pycda', 'models/tinynet.h5')
Based on the traceback I get when trying to install your package, this call makes pkg_resources
try to import your package, but your package imports numpy
. Because numpy
can't be installed unless pip knows it's a dependency, and because it can't know it's a dependency without running setup.py
, and because setup.py
can't run without first making the above pkg_resources
call, we end up in the situation that numpy
is required before we can know it's required; hence, an error. The solution is to delete the above line, which should be easy, as the path
variable isn't even used!