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

Broken poetry installation after failed update with poetry self update 1.5.0 #8054

Closed
2 of 4 tasks
pacanada opened this issue Jun 1, 2023 · 4 comments
Closed
2 of 4 tasks
Labels
kind/bug Something isn't working as expected status/triage This issue needs to be triaged

Comments

@pacanada
Copy link

pacanada commented Jun 1, 2023

  • Poetry 1.4.1:
  • Python 3.10.4:
  • Windows 10:
  • pyproject.toml:
  • 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

When trying to update poetry to version 1.5.0 running poetry self update 1.5.0 I got the following error message

Updating Poetry version ...


Updating dependencies
Resolving dependencies...

Writing lock file

Package operations: 0 installs, 17 updates, 0 removals

  • Updating certifi (2022.12.7 -> 2023.5.7)
  • Updating urllib3 (1.26.15 -> 1.26.16)
  • Updating attrs (22.2.0 -> 23.1.0)
  • Updating filelock (3.10.7 -> 3.12.0)
  • Updating importlib-metadata (6.1.0 -> 6.6.0)
  • Updating packaging (23.0 -> 23.1)
  • Updating platformdirs (2.6.2 -> 3.5.1)
  • Updating poetry-core (1.5.2 -> 1.6.0)
  • Updating rapidfuzz (2.13.7 -> 2.15.1)
  • Updating requests (2.28.2 -> 2.31.0)

  CalledProcessError

  Command '['C:\\Users\\pacaa\\AppData\\Roaming\\pypoetry\\venv\\Scripts\\python.exe', '-m', 'pip', 'uninstall', 'rapidfuzz', '-y']' returned non-zero exit status 2.

  at ~\.pyenv\pyenv-win\versions\3.10.4\lib\subprocess.py:524 in run
       520│             # We don't call process.wait() as .__exit__ does that for us.
       521│             raise
       522│         retcode = process.poll()
       523│         if check and retcode:
    →  524│             raise CalledProcessError(retcode, process.args,
       525│                                      output=stdout, stderr=stderr)
       526│     return CompletedProcess(process.args, retcode, stdout, stderr)
       527│
       528│

The following error occurred when trying to handle this error:


  EnvCommandError

  Command ['C:\\Users\\pacaa\\AppData\\Roaming\\pypoetry\\venv\\Scripts\\python.exe', '-m', 'pip', 'uninstall', 'rapidfuzz', '-y'] errored with the following return code 2

  Output:
  Found existing installation: rapidfuzz 2.13.7
  Uninstalling rapidfuzz-2.13.7:
    Successfully uninstalled rapidfuzz-2.13.7
  ERROR: Exception:
  Traceback (most recent call last):
    File "C:\Users\pacaa\AppData\Roaming\pypoetry\venv\lib\site-packages\pip\_internal\cli\base_command.py", line 160, in exc_logging_wrapper
      status = run_func(*args)
    File "C:\Users\pacaa\AppData\Roaming\pypoetry\venv\lib\site-packages\pip\_internal\commands\uninstall.py", line 110, in run
      uninstall_pathset.commit()
    File "C:\Users\pacaa\AppData\Roaming\pypoetry\venv\lib\site-packages\pip\_internal\req\req_uninstall.py", line 424, in commit
      self._moved_paths.commit()
    File "C:\Users\pacaa\AppData\Roaming\pypoetry\venv\lib\site-packages\pip\_internal\req\req_uninstall.py", line 277, in commit
      save_dir.cleanup()
    File "C:\Users\pacaa\AppData\Roaming\pypoetry\venv\lib\site-packages\pip\_internal\utils\temp_dir.py", line 173, in cleanup
      rmtree(self._path)
    File "C:\Users\pacaa\AppData\Roaming\pypoetry\venv\lib\site-packages\pip\_vendor\tenacity\__init__.py", line 328, in wrapped_f
      return self(f, *args, **kw)
    File "C:\Users\pacaa\AppData\Roaming\pypoetry\venv\lib\site-packages\pip\_vendor\tenacity\__init__.py", line 408, in __call__
      do = self.iter(retry_state=retry_state)
    File "C:\Users\pacaa\AppData\Roaming\pypoetry\venv\lib\site-packages\pip\_vendor\tenacity\__init__.py", line 364, in iter
      raise retry_exc.reraise()
    File "C:\Users\pacaa\AppData\Roaming\pypoetry\venv\lib\site-packages\pip\_vendor\tenacity\__init__.py", line 197, in reraise
      raise self.last_attempt.result()
    File "C:\Users\pacaa\.pyenv\pyenv-win\versions\3.10.4\lib\concurrent\futures\_base.py", line 439, in result
      return self.__get_result()
    File "C:\Users\pacaa\.pyenv\pyenv-win\versions\3.10.4\lib\concurrent\futures\_base.py", line 391, in __get_result
      raise self._exception
    File "C:\Users\pacaa\AppData\Roaming\pypoetry\venv\lib\site-packages\pip\_vendor\tenacity\__init__.py", line 411, in __call__
      result = fn(*args, **kwargs)
    File "C:\Users\pacaa\AppData\Roaming\pypoetry\venv\lib\site-packages\pip\_internal\utils\misc.py", line 129, in rmtree
      shutil.rmtree(dir, ignore_errors=ignore_errors, onerror=rmtree_errorhandler)
    File "C:\Users\pacaa\.pyenv\pyenv-win\versions\3.10.4\lib\shutil.py", line 747, in rmtree
      return _rmtree_unsafe(path, onerror)
    File "C:\Users\pacaa\.pyenv\pyenv-win\versions\3.10.4\lib\shutil.py", line 612, in _rmtree_unsafe
      _rmtree_unsafe(fullname, onerror)
    File "C:\Users\pacaa\.pyenv\pyenv-win\versions\3.10.4\lib\shutil.py", line 617, in _rmtree_unsafe
      onerror(os.unlink, fullname, sys.exc_info())
    File "C:\Users\pacaa\.pyenv\pyenv-win\versions\3.10.4\lib\shutil.py", line 615, in _rmtree_unsafe
      os.unlink(fullname)
  PermissionError: [WinError 5] Access is denied: 'C:\\Users\\pacaa\\AppData\\Roaming\\pypoetry\\venv\\Lib\\site-packages\\~apidfuzz\\distance\\metrics_cpp.cp310-win_amd64.pyd'


  at venv\lib\site-packages\poetry\utils\env.py:1546 in _run
      1542│                 )
      1543│             else:
      1544│                 output = subprocess.check_output(cmd, stderr=stderr, env=env, **kwargs)
      1545│         except CalledProcessError as e:
    → 1546│             raise EnvCommandError(e, input=input_)
      1547│
      1548│         return decode(output)
      1549│
      1550│     def execute(self, bin: str, *args: str, **kwargs: Any) -> int:

which broke the poetry installation, making poetry unusable:

> poetry
Traceback (most recent call last):
  File "C:\Users\pacaa\.pyenv\pyenv-win\versions\3.10.4\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\pacaa\.pyenv\pyenv-win\versions\3.10.4\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\pacaa\AppData\Roaming\Python\Scripts\poetry.exe\__main__.py", line 4, in <module>
  File "C:\Users\pacaa\AppData\Roaming\pypoetry\venv\lib\site-packages\poetry\console\application.py", line 11, in <module>
    from cleo.application import Application as BaseApplication
  File "C:\Users\pacaa\AppData\Roaming\pypoetry\venv\lib\site-packages\cleo\application.py", line 12, in <module>
    from cleo.commands.completions_command import CompletionsCommand
  File "C:\Users\pacaa\AppData\Roaming\pypoetry\venv\lib\site-packages\cleo\commands\completions_command.py", line 10, in <module>
    from cleo import helpers
  File "C:\Users\pacaa\AppData\Roaming\pypoetry\venv\lib\site-packages\cleo\helpers.py", line 5, in <module>
    from cleo.io.inputs.argument import Argument
  File "C:\Users\pacaa\AppData\Roaming\pypoetry\venv\lib\site-packages\cleo\io\inputs\argument.py", line 5, in <module>
    from cleo.exceptions import CleoLogicError
  File "C:\Users\pacaa\AppData\Roaming\pypoetry\venv\lib\site-packages\cleo\exceptions\__init__.py", line 3, in <module>
    from cleo._utils import find_similar_names
  File "C:\Users\pacaa\AppData\Roaming\pypoetry\venv\lib\site-packages\cleo\_utils.py", line 8, in <module>
    from rapidfuzz.distance import Levenshtein
ModuleNotFoundError: No module named 'rapidfuzz'

The expected behaviour would be to be able to use the current poetry installation (1.4.1)

@pacanada pacanada added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Jun 1, 2023
@ralbertazzi
Copy link
Contributor

Looks like the installation broke because of a permission error, which goes outside of Poetry's responsibilities. I agree it would be best for Poetry to self update in a sort of transactional way, and revert if something goes wrong, but I don't see this getting implemented anytime soon.

For now I would suggest to cleanup your Poetry installation manually and re-install the version you desire.

@dimbleby
Copy link
Contributor

dimbleby commented Jun 1, 2023

duplicate #7610, #7819. see also #7872

@adam-grant-hendry
Copy link

• Updating poetry-core (1.5.2 -> 1.6.0)

Is there a chance poetry.exe in venv\Scripts is conflicting with the base poetry.exe?

e.g. %APPDATA%\Python\Scripts\poetry.exe and %APPDATA%\pypoetry\venv\Scripts\poetry.exe are both working at the same time?

Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
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

4 participants