Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pass --no-deps in PIP requirements.txt

Tags:

python

pip

I need to pass a flag of --no-deps to one of my packages in my requirements.txt file to ignore the dependencies of a package. I've tried putting it above, blow, before, and after the package to no avail. I can do it by itself no problem but not within a requirements.txt file

pip install <package> --no-deps 

requirements.txt

<package> --no-deps 
like image 923
Austin Avatar asked Aug 03 '15 23:08

Austin


People also ask

Can I put pip in requirements txt?

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.

What is pip DEPS?

pip is capable of determining and installing the dependencies of packages. The process of determining which version of a dependency to install is known as dependency resolution. This behaviour can be disabled by passing --no-deps to pip install.

How do I resolve dependencies in pip?

Unfortunately, pip makes no attempt to resolve dependency conflicts. For example, if you install two packages, package A may require a different version of a dependency than package B requires. Pip can install from either Source Distributions (sdist) or Wheel (. whl) files.


2 Answers

Unfortunately there is no option for this, at time of writing.

The best you can do is freeze everything from your master environment, and use "--no-deps" when you pip install. This is OK since dependencies will be frozen already.

like image 132
s29 Avatar answered Sep 21 '22 10:09

s29


According to the documentation you have to write:

<package> --install-option="--no-deps" 
like image 40
Xebax Avatar answered Sep 19 '22 10:09

Xebax