I'm doing a script to automatize the downloading and the installation of a repository from GitHub. However, my environment needs some special dependencies which aren't specified in requirements.txt file. So, my goal is:
git clone
pip install -r requirements.txt
but
ignoring the bad dependencieswget file.whl
and pip install file.whl
)My question is, how can I ignore the packages from the requirements.txt file with the pip install command? I know that I can open file, comment or erase that lines and install with pip, but I want to achieve with a full automatization task.
Solution 1: If the file.whl have the same version as your ignored packages, you can just flip 2 and 3 and it should be ok.
Solution 2: if the file.whl have a different version than your ignored packages, you can remove them dynamically from the pip file. For example (Linux), using:
pip install -r $(grep -v '^ *#\|^pkg1\|^pkg2' requirements.txt | grep .)
Similar procedure can be done in powershell in windows.
Note: solution 2 code was taken directly from https://www.shellhacks.com/pip-install-requirements-exclude-specific-packages/