Unfortunately there isn't a direct way to exclude specific packages during pip install
.
I've created a script called pip-mark-installed
to manually mark a package as installed for pip:
pip install pip-mark-installed
pip-mark-installed opencv-python
The script creates the necessary metadata files that pip uses to determine if a package is installed. To uninstall the dummy package use the normal pip uninstall
.
It allows setting specific versions for the dummy packages for dependency resolution
pip-mark-installed opencv-python==4.5.1 opencv-contrib-python==4.5.1