The Python Oracle

pip: force install ignoring dependencies

Become part of the top 3% of the developers by applying to Toptal https://topt.al/25cXVn

--

Music by Eric Matyas
https://www.soundimage.org
Track title: Puddle Jumping Looping

--

Chapters
00:00 Question
00:26 Accepted answer (Score 382)
00:46 Answer 2 (Score 15)
01:13 Answer 3 (Score 13)
01:58 Thank you

--

Full question
https://stackoverflow.com/questions/1275...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#python #pip

#avk47



ACCEPTED ANSWER

Score 449


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



ANSWER 2

Score 27


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



ANSWER 3

Score 12


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}



ANSWER 4

Score 2


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)