pythonpip

pip install without upgrading a specific dependency


I'm trying to pip install a library that has a lot of dependencies. I have a patched version of one dependency that I would like not updated when I install the library. How can I prevent this patched dependency from being updated?


(Specifically, I want to pip install fastai without upgrading my version of torch, but do install other dependencies required)


Solution

  • If you install this dependency before running pip install it won't install it again.

    This means to you can install your patched version and then your package:

    For instance:

    From pypi with another version

    pip install requests==2.17.0
    pip install kinto
    

    From a Git branch

    git clone git@github.com:kennethreitz/requests.git
    pip install -e requests
    pip install kinto
    

    From a egg or a wheel

    wget https://github.com/kennethreitz/requests/archive/v2.21.0.tar.gz
    pip install v2.21.0.tar.gz
    pip install kinto