I'm using python's virtual environment (python3 -m venv venv) and pip with requirements.txt. I need to use a package (python-particle) which has a dependency on a very old version of requests (2.7.0). I want to use a more recent version of requests (2.25.0 or later), but because python-particle is explicitly calling out "requests==2.7.0" I get an error when trying to use a later version of requests.
Is there a way to tell pip that the user requested version takes priority? Alternatively, is there a way to tell pip to do dependency resolution for all packages except one?
Things I've tried...
- I saw:
setup.py & pip: override one of the dependency's sub-dependency from requirements.txt
$ more requirements.txt
pexpect>=3.3
python-dateutil>=2.4.2
pytz>=2015.4
six>=1.15.0
python-particle>=0.2
$ more constraints.txt
requests>=2.25.0
but when I tried that I still got the error:
ERROR: Cannot install -r requirements.txt (line 5) because these package versions have conflicting dependencies.
The conflict is caused by:
python-particle 0.2 depends on requests==2.7.0
The user requested (constraint) requests>=2.25.0
To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip attempt to solve the dependency conflict
ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/user_guide/#fixing-conflicting-dependencies
The version of pip that I'm using is:
$ pip --version
pip 21.3.1 from /home/xyzzy/src/tools/venv/lib/python3.9/site-packages/pip (python 3.9)
- I also tried using --no-deps for just the one dependency (python-particle), but that didn't work. My requirements.txt for this attempt:
pexpect>=3.3
python-dateutil>=2.4.2
pytz>=2015.4
requests>=2.25.0
six>=1.15.0
python-particle>=0.2 --install-option="--no-deps"
The error message from pip:
ERROR: Cannot install -r requirements.txt (line 6) and requests>=2.25.0 because these package versions have conflicting dependencies.
The conflict is caused by:
The user requested requests>=2.25.0
python-particle 0.2 depends on requests==2.7.0
To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip attempt to solve the dependency conflict
ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/user_guide/#fixing-conflicting-dependencies