How to fix "No matching distribution found for {package name}" when installing own package from test.pypi
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
"
Related videos on Youtube
Shahriyar Shawon
I'm using this so i don't fail my programming class in school edit: I used this and I didn't fail my programming class in school!
Updated on September 15, 2022Comments
-
Shahriyar Shawon over 1 year
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
andtwine 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 aboutI'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
-
anthony sottile over 4 years
--extra-index-url https://pypi.org/simple
-