简体   繁体   中英

PIP not able to install dependencies

I have built and published a package to pypi using poetry build, and have also specified dependencies which it uses inside pyproject.toml

[tool.poetry.dependencies]
python = "^3.6"
PyGithub = "1.54.1"
colorama = "0.4.4"
PyInquirer = "1.0.3"

However when I install and run this package on a computer without those installed, I get this error

ERROR: Could not find version that satisfies the requirement PyGithub==1.54.1 (from <my_package_name_here) (from versions: none)

ERROR: No matching distribution found for PyGithub==1.54.1 (from <my_package_name_here)

How can I make pip install those automatically whenever someone installs my package using pip install package ? Or is it not possible? This looks like it's trying to install them but can't find them?

So I figured out what was wrong - I was testing the package on test.pypi , and since I was doing that, it was trying to install the required dependencies from there, and not from the ordinary PyPi. When published to PyPi everything is working.

Make sure your are using the public pypi repository index . If not, probably you're using test.pypi or another private repository, which does not contains all dependencies you specified.

In that case you can pass an extra repository index.

Use pip extra-index-url

pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple PACKAGE==PACKAGE_VERSION

By using an extra index, if pip couldn't find a package in the private repository it'll take look at the oficial index.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM