@uranusjr
pip should pick the currently-installed foo
unless bar
explicitly says that version is not compatible.
That is true, but the whole problem arises because the latest version of bar
requires a newer version of foo
. foo
is expensive to download and install and I don’t have a special requirement for bar
. Thus, I just want the latest version of bar
that I can run with foo
.
If you add --use-feature=2020-resolver
, I believe pip would even try to find a version of bar
that can work with the currently-installed foo
.
That kinda works. In that case the command would look like this:
$ pip install --use-feature=2020-resolver $(python -c "import foo; print(f'{foo.__name__}=={foo.__version__}')") bar
Unfortunately this downloads every single version of bar
until it finds a match. Example: foo==chardet
and bar==requests
:
$ pip install chardet==3.0.0
[...]
$ pip install --use-feature=2020-resolver $(python -c "import chardet; print(f'{chardet.__name__}=={chardet.__version__}')") requests
Requirement already satisfied: chardet==3.0.0 in ./.venv/lib/python3.6/site-packages (3.0.0)
Collecting requests
Using cached requests-2.24.0-py2.py3-none-any.whl (61 kB)
Collecting requests
Using cached requests-2.23.0-py2.py3-none-any.whl (58 kB)
Collecting requests
Using cached requests-2.22.0-py2.py3-none-any.whl (57 kB)
Collecting requests
Using cached requests-2.21.0-py2.py3-none-any.whl (57 kB)
Collecting requests
Using cached requests-2.20.1-py2.py3-none-any.whl (57 kB)
Collecting requests
Using cached requests-2.20.0-py2.py3-none-any.whl (60 kB)
Collecting requests
Using cached requests-2.19.1-py2.py3-none-any.whl (91 kB)
Collecting requests
Using cached requests-2.19.0-py2.py3-none-any.whl (91 kB)
Collecting requests
Using cached requests-2.18.4-py2.py3-none-any.whl (88 kB)
Collecting requests
Using cached requests-2.18.3-py2.py3-none-any.whl (88 kB)
Collecting requests
Using cached requests-2.18.2-py2.py3-none-any.whl (88 kB)
Collecting requests
Using cached requests-2.18.1-py2.py3-none-any.whl (88 kB)
Collecting requests
Using cached requests-2.18.0-py2.py3-none-any.whl (563 kB)
Collecting requests
Using cached requests-2.17.3-py2.py3-none-any.whl (87 kB)
Collecting requests
Using cached requests-2.17.2-py2.py3-none-any.whl (87 kB)
Collecting requests
Using cached requests-2.17.1-py2.py3-none-any.whl (87 kB)
Collecting requests
Using cached requests-2.17.0-py2.py3-none-any.whl (87 kB)
Collecting requests
Using cached requests-2.16.5-py2.py3-none-any.whl (87 kB)
Collecting requests
Using cached requests-2.16.4-py2.py3-none-any.whl (87 kB)
Collecting requests
Using cached requests-2.16.3-py2.py3-none-any.whl (86 kB)
Collecting requests
Using cached requests-2.16.2-py2.py3-none-any.whl (86 kB)
Collecting requests
Using cached requests-2.16.1-py2.py3-none-any.whl (85 kB)
Collecting requests
Using cached requests-2.16.0-py2.py3-none-any.whl (85 kB)
Collecting requests
Using cached requests-2.15.1-py2.py3-none-any.whl (558 kB)
Installing collected packages: requests
Successfully installed requests-2.15.1
As I said before, in my actual case bar
is expensive to download and thus this is not a feasible approach.