I am trying to deploy a Django app to Heroku where one of the required packages lives on https://testpypi.python.org/pypi
and of course Django is on the main PyPI server.
The requirements.txt
file looks like so:
Django==1.7.7
-i https://testpypi.python.org/pypi
foo-bar==0.4
running pip install -r requirements.txt
fails with the following error:
Could not find any downloads that satisfy the requirement Django==1.7.7 (from -r requirements.txt (line 1))
Cleaning up...
No distributions at all found for Django==1.7.7 (from -r requirements.txt (line 1))
So it looks like pip
is trying to find Django on testpypi
So I tried this:
-i https://pypi.python.org/pypi/
Django==1.7.7
-i https://testpypi.python.org/pypi
foo-bar==0.4
It results in the same error.
If I place just one (doen't matter witch one) of packages in the requirements file pip is able to find the package and install it.
Question: What is the correct syntax for specifying multiple different index-url
arguments within a single file that can be read by the command pip install -r file
I don't think it matters but python is version 3.4.0 and pip is version pip 1.5.2
.
I have updated pip to version 6.0.8, error now reads as:
Could not find any downloads that satisfy the requirement Django==1.7.7 (from -r requirements.txt (line 2))
No distributions at all found for Django==1.7.7 (from -r requirements.txt (line 2))
To add the azure artifacts index to the install command, we've added --extra-index-url https://pkgs.dev.azure.com/<org>/_packaging/mypackage/pypi/simple/ at the top of the requirements. txt file and added the mypackage package to the requirements. txt list.
The most common command is pip freeze > requirements. txt , which records an environment's current package list into requirements. txt. If you want to install the dependencies in a virtual environment, create and activate that environment first, then use the Install from requirements.
Use the extra-index-url option to tell pip where your alternate package index lives. If your package index doesn't support SSL, you can supress warnings by identifying it as a trusted-host .
By definition, any private index definition will apply to every package
https://devcenter.heroku.com/articles/python-pip#private-indexes
All dependencies specified in that requirements file will resolve against that index.
As a workaround, you can create multiple requirements files and cascade them:
https://devcenter.heroku.com/articles/python-pip#cascading-requirements-files
If you would like to utilize multiple requirements files in your codebase, you can include the contents of another requirements file with pip:
-r ./path/to/prod-requirements.txt
Update: It turns out that the correct method of dealing with private indexes is to use --extra-index-url
switch. From the documentation of pip:
Note that using --index-url removes the use of PyPI, while using --extra-index-url will add additional indexes.
So, putting the line
--extra-index-url https://test.pypi.org/simple/
on top of your requirements.txt
should be enough. No need to cascade at all!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With