pipx icon indicating copy to clipboard operation
pipx copied to clipboard

`runpip` and `--pip-args` doesn't work anymore in `pipx` 1.7.1

Open jaklan opened this issue 1 year ago • 3 comments

Describe the bug

runpip and --pip-args started to fail even if the specified pip command is correct.

How to reproduce

❯ pipx runpip dbt-core "install black"
ERROR: unknown command "install black" - maybe you meant "install"
'/Users/jaklan/.local/pipx/venvs/dbt-core/bin/python -m pip install black' failed

But when running the command by hand - it works:

❯ /Users/jaklan/.local/pipx/venvs/dbt-core/bin/python -m pip install black
Collecting black
...
Successfully installed black-24.8.0 mypy-extensions-1.0.0 platformdirs-4.2.2 tomli-2.0.1

The same for --pip-args:

❯ pipx install dbt-core --pip-args "install dbt-core~=1.8.0" --suffix "1.8"
Fatal error from pip prevented installation. Full pip output in file:
    /Users/jaklan/.local/pipx/logs/cmd_2024-08-26_11.53.16_pip_errors.log

Some possibly relevant errors from pip install:
    ERROR: Could not find a version that satisfies the requirement install (from versions: none)
    ERROR: No matching distribution found for install

Error installing dbt-core.

but:

❯ pipx install dbt-core --suffix "1.8"
  installed package dbt-core 1.8.5 (dbt-core1.8), installed using Python 3.10.9
  These apps are now globally available
    - dbt1.8
done! ✨ 🌟 ✨

jaklan avatar Aug 26 '24 09:08 jaklan

What's interesting - other pip commands work:

❯ pipx runpip dbt-core "freeze"
agate==1.9.1
annotated-types==0.7.0
...
❯ pipx runpip dbt-core "--version"
pip 24.2 from /Users/jaklan/.local/pipx/shared/lib/python3.10/site-packages/pip (python 3.10)

jaklan avatar Aug 26 '24 10:08 jaklan

And just to clarify the use-case:

  • runpip issue I discovered by coincidence, as I wanted quickly to overwrite some dependency in venv to test sth
  • --pip-args is more painful, as we used to use pipx install dbt-core --pip-args "install dbt-core~=1.8.0" to "pin" the version to specific minor release, but still be able to upgrade the patch one
    (new pipx pin command pins the patch version, so it's not a direct replacement)

jaklan avatar Aug 26 '24 10:08 jaklan

One more test:

> pipx install dbt-core --pip-args "dbt-core~=1.8.0" --suffix "1.8"
  installed package dbt-core 1.8.5 (dbt-core1.8), installed using Python 3.10.9
  These apps are now globally available
    - dbt1.8
done! ✨ 🌟 ✨

so it seems install is just used implicitly now and there's no need to specify it in --pip-args anymore.

̶H̶o̶w̶e̶v̶e̶r̶,̶ ̶s̶t̶i̶l̶l̶ ̶n̶o̶t̶ ̶a̶b̶l̶e̶ ̶t̶o̶ ̶m̶a̶k̶e̶ ̶i̶t̶ ̶w̶o̶r̶k̶ ̶f̶o̶r̶ ̶̶r̶u̶n̶p̶i̶p̶̶:̶

̶>̶ ̶p̶i̶p̶x̶ ̶r̶u̶n̶p̶i̶p̶ ̶d̶b̶t̶-̶c̶o̶r̶e̶1̶.̶8̶ ̶"̶b̶l̶a̶c̶k̶"̶
̶E̶R̶R̶O̶R̶:̶ ̶u̶n̶k̶n̶o̶w̶n̶ ̶c̶o̶m̶m̶a̶n̶d̶ ̶"̶b̶l̶a̶c̶k̶"̶
̶'̶/̶U̶s̶e̶r̶s̶/̶j̶a̶k̶l̶a̶n̶/̶.̶l̶o̶c̶a̶l̶/̶p̶i̶p̶x̶/̶v̶e̶n̶v̶s̶/̶d̶b̶t̶-̶c̶o̶r̶e̶1̶-̶8̶/̶b̶i̶n̶/̶p̶y̶t̶h̶o̶n̶ ̶-̶m̶ ̶p̶i̶p̶ ̶b̶l̶a̶c̶k̶'̶ ̶f̶a̶i̶l̶e̶d̶
̶
̶>̶ ̶p̶i̶p̶x̶ ̶r̶u̶n̶p̶i̶p̶ ̶d̶b̶t̶-̶c̶o̶r̶e̶1̶.̶8̶ ̶"̶i̶n̶s̶t̶a̶l̶l̶ ̶b̶l̶a̶c̶k̶"̶
̶E̶R̶R̶O̶R̶:̶ ̶u̶n̶k̶n̶o̶w̶n̶ ̶c̶o̶m̶m̶a̶n̶d̶ ̶"̶i̶n̶s̶t̶a̶l̶l̶ ̶b̶l̶a̶c̶k̶"̶ ̶-̶ ̶m̶a̶y̶b̶e̶ ̶y̶o̶u̶ ̶m̶e̶a̶n̶t̶ ̶"̶i̶n̶s̶t̶a̶l̶l̶"̶
̶'̶/̶U̶s̶e̶r̶s̶/̶j̶a̶k̶l̶a̶n̶/̶.̶l̶o̶c̶a̶l̶/̶p̶i̶p̶x̶/̶v̶e̶n̶v̶s̶/̶d̶b̶t̶-̶c̶o̶r̶e̶1̶-̶8̶/̶b̶i̶n̶/̶p̶y̶t̶h̶o̶n̶ ̶-̶m̶ ̶p̶i̶p̶ ̶i̶n̶s̶t̶a̶l̶l̶ ̶b̶l̶a̶c̶k̶'̶ ̶f̶a̶i̶l̶e̶d̶

Ah gosh, finally:

> pipx runpip dbt-core1.8 install black
Collecting black
...
Installing collected packages: tomli, platformdirs, mypy-extensions, black
Successfully installed black-24.8.0 mypy-extensions-1.0.0 platformdirs-4.2.2 tomli-2.0.1

We just have to avoid quotation marks to make it work.

jaklan avatar Aug 27 '24 14:08 jaklan