Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix "No matching distribution found for {package name}" when installing own package from test.pypi [duplicate]

When I push my python package to test.pypi.org I am unable to install the package on both a different machine and a different virtual environment. I'm getting errors saying there is no distributions for the dependencies for my package and and error message saying that no version to satisfy requirement was found.

I've tried to parse my requirements.txt in my setup.py file and then run python setup.py sdist bdist_wheel and twine upload --repository-url https://test.pypi.org/legacy/ dist/* to build and upload it to test.pipy.org but the problem still persists.

My setup.py looks like this

...


dependencies=''
with open("requirements.txt","r") as f:
        dependencies = f.read().splitlines()


setup(
    name="FlagWaver",
    version="0.0.54",
    description=DESCRIPTION,
    long_description = LONG_DESCRIPTION,
    long_description_content_type = "text/markdown",
    url="https://github.com/ShahriyarShawon/flag-wave",
    author="Shahriyar Shawon",
    author_email="[email protected]",
    license="Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International",
    packages = [
        "FlagWaver"
    ],
    classifiers = [
        "Programming Language :: Python :: 3"
    ],
    install_requires = dependencies

)

And I run this bash script to build and upload

#!/bin/zsh

pipenv shell
python setup.py sdist bdist_wheel
twine upload --repository-url https://test.pypi.org/legacy/ dist/*

My requirements.txt looks like this

bleach==3.1.0
certifi==2019.6.16
chardet==3.0.4
cycler==0.10.0
docutils==0.15.2
idna==2.8
imageio==2.5.0
kiwisolver==1.1.0
matplotlib==3.1.1
numpy==1.17.0
opencv-python==4.1.0.25
pandas==0.25.0
Pillow==6.1.0
pkginfo==1.5.0.1
Pygments==2.4.2
pyparsing==2.4.2
python-dateutil==2.8.0
pytz==2019.2
readme-renderer==24.0
requests==2.22.0
requests-toolbelt==0.9.1
six==1.12.0
tqdm==4.32.2
twine==1.13.0
urllib3==1.25.3
webencodings==0.5.1

And everythime I try to run pip install -i https://test.pypi.org/simple/ FlagWaver (this is how test.pypi told me to install my package) It seems to always pick a different dependency to complain about

I'm expecting to successfully install my package with all the dependencies listed in the requirements.txt while also being able to successfully create a pipfile.lock file. Instead I get error messages like

ERROR: Could not find a version that satisfies the requirement opencv-python==4.1.0.25 (from FlagWaver) (from versions: none)
ERROR: No matching distribution found for opencv-python==4.1.0.25 (from FlagWaver)

NOTE: opencv-python can be replaced with just about any other dependency listed it the requiremnets.txt file

like image 614
Shahriyar Shawon Avatar asked Aug 08 '19 03:08

Shahriyar Shawon


People also ask

How do I install an older version of a python package?

How do I Install a Specific Version of a Python Package? To install a specific version of a Python package you can use pip: pip install YourPackage==YourVersion . For example, if you want to install an older version of Pandas you can do as follows: pip install pandas==1.1. 3 .

Could not find a version that satisfies the requirement module from versions none?

The error "Could not find a version that satisfies the requirement" is often caused due to not having the necessary permissions to install a package for all users on the machine. To solve the error, install the package scoped to the specific user with the --user option.


1 Answers

I have not use test.pypi.org, but it looks when you install a package from there it only looks for dependencies on test.pypi.org, which does not have all of the same packages, or versions as pypi.org.

Based on this article you can pull your package from test.pypi.org, but the dependencies from pypi.org, which should solve your problem

"If you want to allow pip to also pull other packages from PyPI you can specify --extra-index-url to point to PyPI. This is useful when the package you’re testing has dependencies:

pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple your-package"

like image 123
wjw Avatar answered Sep 16 '22 12:09

wjw