Checking setuptools install_requires on testpypi

Question:

I am trying test a python package I want to release using test test.pypi.

In the setup.py file I have install_requires=['numpy>=1.15','scipy>=0.0','scikit-learn>=0.2','numba>=0.0'],

Scipy and Numpy get downloaded and install as expected.

I get the following error: ERROR: Could not find a version that satisfies the requirement numba>=0.0

As a note, if I do pip install numba before my test package it will work, but I am trying to make the package work correctly.

I notice when it does the scipy requirement first, it shows Downloading https://test-files.pythonhosted.org/packages/68/72/eb962a3ae2755af6b1f31f7a94dccc21bfc41bb1637c5877a043e711b1d7/scipy-0.1.tar.gz .

So from the url, it seems like it is using test-files, but is this the regular pypi or just the test one?

My question is: what is the appropriate way to write the install_requires so I can make sure the test works before putting it on the actual pypi site?

Asked By: 001001

||

Answers:

There is nothing wrong with your syntax, it is just that unlike scipy, numpy, and scikit-learn, there is no numba hosted on the test PyPI instance. Compare:

https://pypi.org/project/numba/ <– 200 OK

https://test.pypi.org/project/numba/ <– 404 Not Found

(Note: that 404 was true at the time of writing this answer, but it appears as though a version of numba has now been uploaded to the test index, on Feb 9th 2021)

My question is: what is the appropriate way to write the install_requires so I can make sure the test works before putting it on the actual pypi site?

How you wrote install_requires is OK. To smoke test it, by uploading your package to test PyPI and checking that it installs properly, use the test PyPI as an extra index url, rather than as a replacement --index-url:

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

This way yourpackage can be found in test PyPI but the install requirements such as numba can still be resolved on main PyPI.

Answered By: wim
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.