pipx icon indicating copy to clipboard operation
pipx copied to clipboard

Cannot upgrade VCS packages with unchanged version number without uninstalling them irst

Open 0xallie opened this issue 3 years ago • 2 comments

Describe the bug After installing a package from a git URL, pipx install --force git+https://github.com/foo/foo.git@ref or pipx upgrade --force foo will not update the package, I have to do pipx uninstall foo first.

How to reproduce

❯ pipx install --verbose --force git+https://github.com/nyuszika7h/poetry.git@vcs-disable-hashes\#egg=poetry
pipx >(setup:711): pipx version is 0.16.1.0
pipx >(setup:712): Default python interpreter is '/home/nyuszika7h/.pyenv/versions/3.9.2/bin/python3.9'
pipx >(_parsed_package_to_package_or_url:128): cleaned package spec: git+https://github.com/nyuszika7h/poetry.git@vcs-disable-hashes#egg=poetry
creating virtual environment...
pipx >(run_subprocess:130): running /home/nyuszika7h/.pyenv/versions/3.9.2/bin/python3.9 -m venv --without-pip /tmp/tmpvp5wh88n
pipx >(run_subprocess:130): running /tmp/tmpvp5wh88n/bin/python -c import sysconfig; print(sysconfig.get_path('purelib'))
pipx >(run_subprocess:130): running /home/nyuszika7h/.local/pipx/shared/bin/python -c import sysconfig; print(sysconfig.get_path('purelib'))
pipx >(run_subprocess:130): running /tmp/tmpvp5wh88n/bin/python --version
determining package name from 'git+https://github.com/nyuszika7h/poetry.git@vcs-disable-hashes#egg=poetry'...
pipx >(run_subprocess:130): running /tmp/tmpvp5wh88n/bin/python -m pip list --format=json
pipx >(run_subprocess:130): running /tmp/tmpvp5wh88n/bin/python -m pip install --no-dependencies git+https://github.com/nyuszika7h/poetry.git@vcs-disable-hashes#egg=poetry
pipx >(run_subprocess:130): running /tmp/tmpvp5wh88n/bin/python -m pip list --format=json
pipx >(install_package_no_deps:286): Determined package name: poetry
pipx >(package_name_from_spec:309): Package name determined in 5.0s
pipx >(needs_upgrade:67): Time since last upgrade of shared libs, in seconds: 116. Upgrade will be run by pipx if greater than 2592000.
Installing to existing venv 'poetry'
creating virtual environment...
pipx >(run_subprocess:130): running /home/nyuszika7h/.pyenv/versions/3.9.2/bin/python3.9 -m venv --without-pip /home/nyuszika7h/.local/pipx/venvs/poetry
pipx >(run_subprocess:130): running /home/nyuszika7h/.local/pipx/venvs/poetry/bin/python -c import sysconfig; print(sysconfig.get_path('purelib'))
pipx >(run_subprocess:130): running /home/nyuszika7h/.local/pipx/venvs/poetry/bin/python --version
pipx >(_parsed_package_to_package_or_url:128): cleaned package spec: git+https://github.com/nyuszika7h/poetry.git@vcs-disable-hashes#egg=poetry
installing poetry from spec 'git+https://github.com/nyuszika7h/poetry.git@vcs-disable-hashes#egg=poetry'...
pipx >(run_subprocess:130): running /home/nyuszika7h/.local/pipx/venvs/poetry/bin/python -m pip install git+https://github.com/nyuszika7h/poetry.git@vcs-disable-hashes#egg=poetry
pipx >(run_subprocess:130): running <fetch_info_in_venv commands>
pipx >(get_venv_metadata_for_package:306): get_venv_metadata_for_package: 336ms
pipx >(_parsed_package_to_package_or_url:128): cleaned package spec: git+https://github.com/nyuszika7h/poetry.git@vcs-disable-hashes#egg=poetry
pipx >(_symlink_package_apps:112): Force is true. Removing /home/nyuszika7h/.local/bin/poetry.
pipx >(needs_upgrade:67): Time since last upgrade of shared libs, in seconds: 121. Upgrade will be run by pipx if greater than 2592000.
  installed package poetry 1.2.0a0, Python 3.9.2
  These apps are now globally available
    - poetry
    - virtualenv
done! ✨ 🌟 ✨

❯ pipx upgrade --verbose --force poetry
pipx >(setup:711): pipx version is 0.16.1.0
pipx >(setup:712): Default python interpreter is '/home/nyuszika7h/.pyenv/versions/3.9.2/bin/python3.9'
pipx >(run_pipx_command:166): Virtual Environment location is /home/nyuszika7h/.local/pipx/venvs/poetry
pipx >(needs_upgrade:67): Time since last upgrade of shared libs, in seconds: 137. Upgrade will be run by pipx if greater than 2592000.
pipx >(upgrade:88): Upgrading shared libraries in /home/nyuszika7h/.local/pipx/shared
upgrading shared libraries...
pipx >(run_subprocess:130): running /home/nyuszika7h/.local/pipx/shared/bin/python -m pip --disable-pip-version-check install --upgrade pip setuptools wheel
pipx >(_parsed_package_to_package_or_url:128): cleaned package spec: git+https://github.com/nyuszika7h/poetry.git@vcs-disable-hashes#egg=poetry
upgrading poetry from spec 'git+https://github.com/nyuszika7h/poetry.git@vcs-disable-hashes#egg=poetry'...
pipx >(run_subprocess:130): running /home/nyuszika7h/.local/pipx/venvs/poetry/bin/python -m pip install --upgrade git+https://github.com/nyuszika7h/poetry.git@vcs-disable-hashes#egg=poetry
pipx >(run_subprocess:130): running <fetch_info_in_venv commands>
pipx >(get_venv_metadata_for_package:306): get_venv_metadata_for_package: 330ms
pipx >(_parsed_package_to_package_or_url:128): cleaned package spec: git+https://github.com/nyuszika7h/poetry.git@vcs-disable-hashes#egg=poetry
pipx >(_symlink_package_apps:112): Force is true. Removing /home/nyuszika7h/.local/bin/poetry.
poetry is already at latest version 1.2.0a0 (location: /home/nyuszika7h/.local/pipx/venvs/poetry)

Expected behavior There should be a way to upgrade a package to the latest VCS revision without uninstalling even if the version number didn't change yet.

0xallie avatar Apr 02 '21 14:04 0xallie

There's also pipx reinstall which would probably do what you need in one command.

But yes, we probably need to revisit how --force works in these subcommands, it seems like it should work the way you expect.

itsayellow avatar Apr 02 '21 18:04 itsayellow

Duplicate to #582

uranusjr avatar Apr 02 '21 18:04 uranusjr