What is the alternative to using --process-depende

2020-07-03 04:07发布

问题:

I am using Python 2.7. I am trying to pip install a repo (on internal github) that has a dependency on another repo (also on internal github). I tried several options but the one that worked was like this:

(env)abc$ cat requirements.txt
 -e git://github.abc.com/abc/abc.git#egg=my_abc --process-dependency-links

(env)abc$ pip install -r requirements.txt

But I got a warning while running the command line that said:

"DEPRECATION: Dependency Links processing has been deprecated and will be removed in a future release."

I am on pip v7.1.2. What is the right way to do this?

回答1:

You can use PEP 508 URL requirements:

pip @ https://github.com/pypa/pip/archive/19.2.3.zip

They'll work for direct requirements (via the CLI, or listed in requirements.txt) and packages that aren't downloaded by pip from PyPI. Note that support for this was released in pip 18.0 (i.e. early 2018, because pip's on CalVer now).


In OP's case, the requirements.txt can be unchanged (though, they'd want to remove --process-dependency-links), if the dependency links are updated to the PEP 508 format.



回答2:

Try using --process-dependency-links flag option. You might also have to use --allow-external packagename or --allow-unverified packagename, where packagename actually specifies whichever dependency you want to install that's not in an official repository

Note:Since it's deprecated functionality, the --process-dependency-links flag will be completely removed soon. I believe the preferred approach is to supply a requirements.txt file instead. For Example : Let i have certain requirements for my project, so i will write that in requirements.txt.

&cat requirements.txt

django-compressor>=1.4,<1.5
django-grappelli>=2.6.3,<2.7
django-bootstrap-form>=3.1,<3.2

Next i can install it using :

$ pip install -r requirements.txt

That's all you have to do