Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

poetry self update fails for pipx-installed poetry #8618

Closed
3 of 4 tasks
ilyagr opened this issue Nov 4, 2023 · 3 comments
Closed
3 of 4 tasks

poetry self update fails for pipx-installed poetry #8618

ilyagr opened this issue Nov 4, 2023 · 3 comments
Assignees
Labels
area/distribution Related to the distribution and installation of Poetry itself kind/bug Something isn't working as expected status/triage This issue needs to be triaged

Comments

@ilyagr
Copy link
Contributor

ilyagr commented Nov 4, 2023

  • Poetry version: 1.6.2 and 1.7.0

  • Python version: 3.11.6

  • OS version and name: Debian testing

  • pyproject.toml: n/a

  • I am on the latest stable Poetry version, installed using a recommended method.

  • I have searched the issues of this repo and believe that this is not a duplicate.

  • I have consulted the FAQ and blog for any relevant entries or release notes.

  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option) and have included the output below.

Issue

I tried upgrading from poetry 1.6.2, installed via pipx, to poetry 1.7.0 with poetry self update. The result was the error below.

I'm using pipx 1.2.1 and python 3.11.6 on Debian.

I believe that poetry self update should either call pipx upgrade or tell the user to do it, unless it's deprecated as per #7872.

I think/hope most people will figure out the problem, so this is not a major issue, but it'd still be nice to see fixed.

$ poetry self update
Updating Poetry version ...

Using version ^1.7.0 for poetry

Updating dependencies
Resolving dependencies... Downloading https://files.pythonhosted.org/packages/99/bc/058b8ff87871fce6615ad032d62c773272f243266b110f7b86d146cf
Resolving dependencies... (2.4s)

Package operations: 1 install, 19 updates, 0 removals

  • Updating cffi (1.15.1 -> 1.16.0)
  • Updating charset-normalizer (3.2.0 -> 3.3.2)
  • Updating cryptography (41.0.3 -> 41.0.5)
  • Updating urllib3 (1.26.16 -> 2.0.7)
  • Updating zipp (3.16.2 -> 3.17.0)
  • Updating filelock (3.12.2 -> 3.13.1)
  • Updating msgpack (1.0.5 -> 1.0.7)
  • Updating packaging (23.1 -> 23.2)
  • Updating platformdirs (3.10.0 -> 3.11.0)
  • Updating poetry-core (1.7.0 -> 1.8.1)
  • Updating rapidfuzz (2.15.1 -> 3.5.2)
  • Updating build (0.10.0 -> 1.0.3)
  • Updating cleo (2.0.1 -> 2.1.0)
  • Updating dulwich (0.21.5 -> 0.21.6)
  • Installing fastjsonschema (2.18.1)
  • Updating shellingham (1.5.0.post1 -> 1.5.4)
  • Updating tomlkit (0.12.1 -> 0.12.2)
  • Updating trove-classifiers (2023.8.7 -> 2023.10.18)
  • Updating virtualenv (20.24.3 -> 20.24.6)
  • Updating poetry (1.6.1 -> 1.7.0): Failed

  CalledProcessError

  Command '['/home/ilyagr/.local/pipx/venvs/poetry/bin/python', '/home/ilyagr/.local/pipx/venvs/poetry/lib/python3.11/site-packages/virtualenv/seed/wheels/embed/pip-23.2.1-py3-none-any.whl/pip', 'uninstall', 'poetry', '-y']' returned non-zero exit status 2.

  at /usr/lib/python3.11/subprocess.py:571 in run
       567│             # We don't call process.wait() as .__exit__ does that for us.
       568│             raise
       569│         retcode = process.poll()
       570│         if check and retcode:
    →  571│             raise CalledProcessError(retcode, process.args,
       572│                                      output=stdout, stderr=stderr)
       573│     return CompletedProcess(process.args, retcode, stdout, stderr)
       574│
       575│

The following error occurred when trying to handle this error:


  EnvCommandError

  Command ['/home/ilyagr/.local/pipx/venvs/poetry/bin/python', '/home/ilyagr/.local/pipx/venvs/poetry/lib/python3.11/site-packages/virtualenv/seed/wheels/embed/pip-23.2.1-py3-none-any.whl/pip', 'uninstall', 'poetry', '-y'] errored with the following return code 2

  Output:
  /home/ilyagr/.local/pipx/venvs/poetry/bin/python: can't open file '/home/ilyagr/.local/pipx/venvs/poetry/lib/python3.11/site-packages/virtualenv/seed/wheels/embed/pip-23.2.1-py3-none-any.whl/pip': [Errno 2] No such file or directory


  at ~/.local/pipx/venvs/poetry/lib/python3.11/site-packages/poetry/utils/env/base_env.py:363 in _run
      359│                 output = subprocess.check_output(
      360│                     cmd, stderr=stderr, env=env, text=True, **kwargs
      361│                 )
      362│         except CalledProcessError as e:
    → 363│             raise EnvCommandError(e, input=input_)
      364│
      365│         return output
      366│
      367│     def execute(self, bin: str, *args: str, **kwargs: Any) -> int:
@ilyagr ilyagr added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Nov 4, 2023
@dimbleby
Copy link
Contributor

dimbleby commented Nov 4, 2023

Previously: #7170.

People probably also try to self update installations made by some other means altogether eg their package manager. Perhaps it wouldn't be the worst idea for the poetry installer to leave behind some sort of marker file that poetry self could look for - and just bail out if not found.

As usual: if you care about this, then a pull request is overwhelmingly the most likely way to make something happen.

@visch
Copy link

visch commented Feb 23, 2024

I hit this but in a slightly different way with plugins today. Hope this posts helps someone else like me in the future, and maybe contributes to the core fix here!

End result is poetry is unusable and I get No module named 'poetry.core.semver'

To replicate

  1. pipx install poetry
  2. poetry self add "poetry-dynamic-versioning[plugin]"
  3. Any poetry command will now fail

Here's the output of 2 above which shows pretty clearly what's going on

poetry self add "poetry-dynamic-versioning[plugin]"
Using version ^1.2.0 for poetry-dynamic-versioning

Updating dependencies
Resolving dependencies... (0.2s)
Warning: The locked version 0.3.5 for poetry-types is a yanked version. Reason for being yanked: Incompatible with poetry>=1.5

Package operations: 2 installs, 20 updates, 0 removals

  • Downgrading cffi (1.16.0 -> 1.15.1)
  • Downgrading certifi (2024.2.2 -> 2022.12.7)
  • Downgrading charset-normalizer (3.3.2 -> 3.0.1)
  • Downgrading cryptography (42.0.4 -> 39.0.0)
  • Downgrading idna (3.6 -> 3.4)
  • Downgrading more-itertools (10.2.0 -> 9.0.0)
  • Installing pyparsing (3.0.9)
  • Downgrading urllib3 (2.2.1 -> 1.26.14)
  • Downgrading zipp (3.17.0 -> 3.11.0)
  • Downgrading importlib-metadata (7.0.1 -> 4.13.0)
  • Downgrading jaraco-classes (3.3.1 -> 3.2.3)
  • Downgrading msgpack (1.0.7 -> 1.0.4)
  • Downgrading packaging (23.2 -> 21.3)
  • Downgrading requests (2.31.0 -> 2.28.2)
  • Downgrading markupsafe (2.1.5 -> 2.1.1)
  • Downgrading pexpect (4.9.0 -> 4.8.0)
  • Downgrading requests-toolbelt (1.0.0 -> 0.10.1)
  • Downgrading shellingham (1.5.4 -> 1.5.0.post1)
  • Downgrading tomlkit (0.12.3 -> 0.11.6)
  • Downgrading trove-classifiers (2024.2.22 -> 2023.1.12)
  • Downgrading jinja2 (3.1.3 -> 3.1.2)
  • Installing poetry-types (0.3.5)
Warning: The file chosen for install of poetry-types 0.3.5 (poetry_types-0.3.5-py3-none-any.whl) is yanked. Reason for being yanked: Incompatible with poetry>=1.5

The work around is to not use poetry self add for plugins for poetry installed with pipx. Instead use pipx inject poetry poetry-dynamic-versioning[plugin]

@finswimmer
Copy link
Member

Hello @ilyagr,

you haven't come back to this issue for a long while. So I assume this is solved in the meantime and I can close this ticket.

Feel free to leave a comment if you disagree.

fin swimmer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/distribution Related to the distribution and installation of Poetry itself kind/bug Something isn't working as expected status/triage This issue needs to be triaged
Projects
None yet
Development

No branches or pull requests

5 participants