PIP: How to Cascade Requirements Files and Use Private Indexes? [duplicate]

2024/10/13 22:26:20

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.

My setup looks like this.

# requirements.txt
-r requirements/req2.txt
-r requirements/req3.txt
# requirements/req2.txt
Django==1.7.7
# requirements/req3.txt
-i https://testpypi.python.org/pypi
foo-bar==0.4

Running the command: pip install -r requirements.txt results in the following error.

Could not find any downloads that satisfy the requirement 
Django==1.7.7 (from -r ./requirements/req2.txt (line 2))
No distributions at all found for Django==1.7.7 
(from -r ./requirements/req2.txt (line 2))

So to me it looks like the -i argument in req3 is being set then pip tries to look for Django on the testpypi server.

I tried adding -i https://pypi.python.org/pypi to req2.txt but I still get the same error. (perhaps https://pypi.python.org/pypi is the wrong url)

In addition if I run either req*.txt file individually the installation of the package is successful?

How can one cascade requirements files and use private indexes?

Admittedly this question and this one are quite similar but neither deal with private indexs

Answer

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://testpypi.python.org/pypi

on top of your requirements.txt should be enough. No need to cascade at all!

https://en.xdnf.cn/q/118029.html

Related Q&A

Python error: TypeError: cannot compare a dtyped [float64] array with a scalar of type [bool]

Below is a small sample of my dataframe. In [10]: dfOut[10]:TXN_KEY Send_Agent Pay_Agent Send_Amount Pay_Amount 0 13272184 AWD120279 AEU002152 85.99 85.04 1 13272947 ARA03012…

How to remove grey boundary lines in a map when plotting a netcdf using imshow in matplotlib?

Is it possible to remove the grey boundary lines around the in following map? I am trying to plotting a netcdf using matplotlib.from netCDF4 import Dataset # clarify use of Dataset import matplotlib.p…

function that takes one column value and returns another column value

Apologies, if this is a duplicate please let me know, Ill gladly delete.My dataset: Index Col 1 Col 20 1 4, 5, 6 1 2 7, 8, 9 2 3 10, 11, 12 3 …

Python write value from dictionary based on match in range of columns

From my df showing employees with multiple levels of managers (see prior question here), I want to map rows to a department ID, based on a manager ID that may appear across multiple columns:eid, mid…

Merge two dataframes based on a column

I want to compare name column in two dataframes df1 and df2 , output the matching rows from dataframe df1 and store the result in new dataframe df3. How do i do this in Pandas ? df1place name qty unit…

Python/Pandas - building a new column based in columns comparison

I have this dataframe:df:CNPJ Revenues 2016 Revenues 2015 Revenues 2014 0 01.637.895/0001-32 R$ 12.696.658 NaN R$ 10.848.213 1 02.916.265/0001-60 …

Present blank screen, wait for key press -- how?

lo,I am currently trying to code a simple routine for an experiment we are planning to run. The experiment starts by entering a subject number and creating a bunch of files. I got that part working. Ne…

Images appearing in all but 1 flask page

I am creating a web app in flask, python, mysql. When viewing every other page on my website my images load, but when viewing one specific page, I cant get any images to load using already working code…

Python: Write nested list objects to csv file

Im trying to write data from a list of lists to a csv file. This is a simplified version of what I haveclass Point(object): def __init__(self, weight, height):self.weight = weightself.height = heightde…

Entire module is not detected by __init__.py

I have a relatively small python program which is setup like thisRoot--Network--DTOLots of py files which contain classes.Other py files in the projectBoth in the Network and the DTO folder there is an…