Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pip can't install packages listed in install_requires [duplicate]

Tags:

python

pip

pypi

I created a Python package, uploaded it to TestPyPI, and try to install it to a new virtual environment. pip cannot install the required packages, but if I try to install the same packages with pip install -r requirements.txt, it works.

I created my setup.py file following the guidelines listed in Packaging Python Projects. I uploaded my package to TestPyPI and try to install it to a brand new virtual environment with Python 3.6.4 and pip 19.1.1.

Here is my install instruction: pip install -i https://test.pypi.org/simple/ my-package-name==0.0.1

Here is what I have in setuptools.setup call (only related stuff):

   packages=setuptools.find_packages(),
    classifiers=[
        "Programming Language :: Python :: 3.4",
        "Programming Language :: Python :: 3.5",
        "Programming Language :: Python :: 3.6",
        "Programming Language :: Python :: 3.7",
        'License :: OSI Approved :: MIT License',
        'Operating System :: OS Independent',
    ],
    install_requires=[
        "requests",
        "jsonpickle",
        "pandas",
        "matplotlib",
        "seaborn",
        "Pillow"
    ]

It starts by successfull installing matplotlib, but I get the following error later:

ERROR: Could not find a version that satisfies the requirement jsonpickle (from my-package-name==0.0.1) (from versions: none) ERROR: No matching distribution found for jsonpickle (from my-package-name==0.0.1)

I also tried with specifying package versions, but then I cannot install any packages.

As I have told, I can install the packages just fine by using pip install -r requirements.txt command.

like image 782
goktugerce Avatar asked Sep 14 '25 08:09

goktugerce


1 Answers

This is an unfortunate (and known) downside to TestPyPI: The issue is that jsonpickle does not exist on TestPyPI, and by installing your package from there, you are telling pip to look for dependencies there as well.

Instead, you should publish to PyPI instead, and use a pre-release version so as not to pollute your versions. You can delete these pre-releases from the project later.

like image 172
Dustin Ingram Avatar answered Sep 15 '25 21:09

Dustin Ingram