NeuronQ
NeuronQ

Reputation: 8215

pip: force install ignoring dependencies

Is there any way to force install a pip python package ignoring all its dependencies that cannot be satisfied?

(I don't care how "wrong" it is to do so, I just need to do it, any logic and reasoning aside...)

Upvotes: 331

Views: 387906

Answers (4)

Matt G.
Matt G.

Reputation: 41

I came up to this question looking for a resolution when first package requires foo-lib<=1.1 and second package requires foo-lib>=1.0, so incompatible foo-lib==1.2 is forcefully installed (as the newest) during the installation of a second package.

The version can be additionally limited with pip install {second_package} "foo-lib==1.1". (doc)

Upvotes: 2

Hamed Baziyad
Hamed Baziyad

Reputation: 2029

When I was trying install librosa package with pip (pip install librosa), this error appeared:

ERROR: Cannot uninstall 'llvmlite'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

I tried to remove llvmlite, but pip uninstall could not remove it. So, I used capability of ignore of pip by this code:

pip install librosa --ignore-installed llvmlite

Indeed, you can use this rule for ignoring a package you don't want to consider:

pip install {package you want to install} --ignore-installed {installed package you don't want to consider}

Upvotes: 13

Charlie Parker
Charlie Parker

Reputation: 5266

Try the following:

pip install --no-deps <LIB_NAME>

or

pip install --no-dependencies <LIB_NAME>

or

pip install --no-deps -r requirements.txt

or

pip install --no-dependencies -r requirements.txt

Upvotes: 28

Jeff Tratner
Jeff Tratner

Reputation: 17126

pip has a --no-dependencies switch. You should use that.

For more information, run pip install -h, where you'll see this line:

--no-deps, --no-dependencies
                        Ignore package dependencies

Upvotes: 463

Related Questions