'How to override python package version constraint during pip install

We have an organization level constraint file to specify what versions of python packages can be installed. This is configured in pip.conf

For one of the project, we want to install a different version of a package. For example, pyyaml is pinned at 5.4.1 in constraints file, whereas for the project we would like 6.0

Tried specifying inline in pip install command,

pip install pyyaml==6.0 

This didn't help as the build failed with conflict error,

ERROR: Cannot install pyyaml==6.0 because these package versions have conflicting dependencies.

The conflict is caused by:
The user requested pyyaml==6.0
The user requested (constraint) pyyaml==5.4.1

pip version: 21.3.1


Solution 1:[1]

# constrains.txt
   pyyaml==5.4.1
$ pip install pyyaml==6.0 -c constrains.txt

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Gino Mempin