Canonical replacement for -use-mirror

PyPI may be unreliable. I had an unsuccessful number of Travis-CI builds because pip was unable to install one of my requirements (lxml is the most famous culprit).

Various online resources recommend the --use-mirrors flag, which still solved the problem for me. However --use-mirrors deprecated for a number of good reasons.

Unfortunately, as mentioned in the link, one of the main reasons for removing the flag is that the new supported PyPI CDN should not have the same problems. It does. I still have problems with my builds, and I still canโ€™t install packages reliably with pip unless I use --use-mirrors .

release notes for version 1.5 on 2014-01-01 recommend using one of the -i , -index-url or --extra-index-url flags. Which is great, with the exception of ... We face some of the same problems that --use-mirrors , namely, that these mirrors cannot necessarily be trusted.

The PyPI mirror list has actually been deleted, leaving us with unofficial mirrors . Thus, I have a choice: continue to use --use-mirrors and hope that one of the above problems is fixed before it is removed, or select a mirror and hope that it works and is trustworthy.

Is there a generally accepted and reliable mirror? Or a widespread and reliable alternative? Basically, how do I solve this problem?

+6
source share
1 answer

Honestly, I have never encountered the problem you are describing, so I donโ€™t know what to do to resolve problems with the pypi public index.

However, as a general practice; I can recommend the following that we use during deployment (since the systems we deploy do not have access to the Internet):

  • Create a local pypi mirror and publish your packages there. You can do this in many ways. A simple approach with basket , or you can do what we have done and create your own pypi mirror (see How to collapse my own pypi? For some suggestions).

  • Use wheel . This is what we are moving to, because the installation process is very simple and does not require dependency on other servers.

I know that the global pypi index is a great convenience, but as part of the deployment chain I would use it as a backup; for one, it is on a network that I do not control (therefore, it may be unreachable or unreliable); and, more importantly, my systems may not need access to the Internet during the build process.

+2
source

Source: https://habr.com/ru/post/982186/


All Articles