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

CalledProcessError Immediately after install when installing dynamic versioning plugin #7819

Open
1 task
LukeDev42 opened this issue Apr 20, 2023 · 2 comments
Labels
area/plugin-api Related to plugins/plugin API kind/bug Something isn't working as expected status/triage This issue needs to be triaged

Comments

@LukeDev42
Copy link

  • Poetry version: 1.4.2
  • Python version: 3.11.1
  • OS version and name: Windows 10; 19044.2846
  • pyproject.toml: N/A
  • [ x ] I am on the latest stable Poetry version, installed using a recommended method.
  • [ x ] I have searched the issues of this repo and believe that this is not a duplicate.
  • [ x ] 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 had a problem updating my project's dependencies. It returned CalledProcessError when I ran poetry install. I tried running it again and got a ModuleNotFound error for poetry.console. I then tried a reinstall of poetry.

I use pipx to manage my poetry installation so I ran:

pipx install poetry
poetry --version
   Poetry (version 1.4.2)
poetry self add "poetry-dynamic-versioning[plugin]"
Using version ^0.21.4 for poetry-dynamic-versioning

Updating dependencies
Resolving dependencies...

Package operations: 4 installs, 14 updates, 0 removals

  • Updating charset-normalizer (3.1.0 -> 3.0.1)
  • Updating more-itertools (9.1.0 -> 9.0.0)
  • Updating urllib3 (1.26.15 -> 1.26.14)
  • Updating zipp (3.15.0 -> 3.12.0)

  CalledProcessError

  Command '['C:\\Users\\user\\.local\\pipx\\venvs\\poetry\\Scripts\\python.exe', 'C:\\Users\\user\\.local\\pipx\\venvs\\poetry\\Lib\\site-packages\\virtualenv\\seed\\wheels\\embed\\pip-23.1-py3-none-any.whl\\pip', 'uninstall', 'charset-normalizer', '-y']' returned non-zero exit status 2.

  at C:\Program Files\Python311\Lib\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 ['C:\\Users\\user\\.local\\pipx\\venvs\\poetry\\Scripts\\python.exe', 'C:\\Users\\user\\.local\\pipx\\venvs\\poetry\\Lib\\site-packages\\virtualenv\\seed\\wheels\\embed\\pip-23.1-py3-none-any.whl\\pip', 'uninstall', 'charset-normalizer', '-y'] errored with the following return code 2

  Output:
  WARNING: Skipping C:\Users\user\.local\pipx\venvs\poetry\Lib\site-packages\more_itertools-9.1.0.dist-info due to invalid metadata entry 'name'
  Found existing installation: charset-normalizer 3.1.0
  Uninstalling charset-normalizer-3.1.0:
    Successfully uninstalled charset-normalizer-3.1.0
  ERROR: Exception:
  Traceback (most recent call last):
    File "C:\Users\user\.local\pipx\venvs\poetry\Lib\site-packages\virtualenv\seed\wheels\embed\pip-23.1-py3-none-any.whl\pip\_internal\cli\base_command.py", line 169, in exc_logging_wrapper
      status = run_func(*args)
               ^^^^^^^^^^^^^^^
    File "C:\Users\user\.local\pipx\venvs\poetry\Lib\site-packages\virtualenv\seed\wheels\embed\pip-23.1-py3-none-any.whl\pip\_internal\commands\uninstall.py", line 110, in run
      uninstall_pathset.commit()
    File "C:\Users\user\.local\pipx\venvs\poetry\Lib\site-packages\virtualenv\seed\wheels\embed\pip-23.1-py3-none-any.whl\pip\_internal\req\req_uninstall.py", line 432, in commit
      self._moved_paths.commit()
    File "C:\Users\user\.local\pipx\venvs\poetry\Lib\site-packages\virtualenv\seed\wheels\embed\pip-23.1-py3-none-any.whl\pip\_internal\req\req_uninstall.py", line 278, in commit
      save_dir.cleanup()
    File "C:\Users\user\.local\pipx\venvs\poetry\Lib\site-packages\virtualenv\seed\wheels\embed\pip-23.1-py3-none-any.whl\pip\_internal\utils\temp_dir.py", line 173, in cleanup
      rmtree(self._path)
    File "C:\Users\user\.local\pipx\venvs\poetry\Lib\site-packages\virtualenv\seed\wheels\embed\pip-23.1-py3-none-any.whl\pip\_vendor\tenacity\__init__.py", line 291, in wrapped_f
      return self(f, *args, **kw)
             ^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\user\.local\pipx\venvs\poetry\Lib\site-packages\virtualenv\seed\wheels\embed\pip-23.1-py3-none-any.whl\pip\_vendor\tenacity\__init__.py", line 381, in __call__
      do = self.iter(retry_state=retry_state)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\user\.local\pipx\venvs\poetry\Lib\site-packages\virtualenv\seed\wheels\embed\pip-23.1-py3-none-any.whl\pip\_vendor\tenacity\__init__.py", line 327, in iter
      raise retry_exc.reraise()
            ^^^^^^^^^^^^^^^^^^^
    File "C:\Users\user\.local\pipx\venvs\poetry\Lib\site-packages\virtualenv\seed\wheels\embed\pip-23.1-py3-none-any.whl\pip\_vendor\tenacity\__init__.py", line 160, in reraise
      raise self.last_attempt.result()
            ^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Program Files\Python311\Lib\concurrent\futures\_base.py", line 449, in result
      return self.__get_result()
             ^^^^^^^^^^^^^^^^^^^
    File "C:\Program Files\Python311\Lib\concurrent\futures\_base.py", line 401, in __get_result
      raise self._exception
    File "C:\Users\user\.local\pipx\venvs\poetry\Lib\site-packages\virtualenv\seed\wheels\embed\pip-23.1-py3-none-any.whl\pip\_vendor\tenacity\__init__.py", line 384, in __call__
      result = fn(*args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^
    File "C:\Users\user\.local\pipx\venvs\poetry\Lib\site-packages\virtualenv\seed\wheels\embed\pip-23.1-py3-none-any.whl\pip\_internal\utils\misc.py", line 130, in rmtree      shutil.rmtree(dir, ignore_errors=ignore_errors, onerror=rmtree_errorhandler)
    File "C:\Program Files\Python311\Lib\shutil.py", line 759, in rmtree
      return _rmtree_unsafe(path, onerror)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Program Files\Python311\Lib\shutil.py", line 622, in _rmtree_unsafe
      onerror(os.unlink, fullname, sys.exc_info())
    File "C:\Program Files\Python311\Lib\shutil.py", line 620, in _rmtree_unsafe
      os.unlink(fullname)
  PermissionError: [WinError 5] Access is denied: 'C:\\Users\\user\\.local\\pipx\\venvs\\poetry\\Lib\\site-packages\\~harset_normalizer\\md.cp311-win_amd64.pyd'


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

You can see it uninstalls charset-normalizer but then it throws an exception.

I then ran:

poetry --version
Traceback (most recent call last):
  File "C:\Users\user\.local\pipx\venvs\poetry\Lib\site-packages\requests\compat.py", line 11, in <module>
    import chardet
ModuleNotFoundError: No module named 'chardet'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\user\.local\pipx\venvs\poetry\Lib\site-packages\cleo\application.py", line 327, in run
    exit_code = self._run(io)
                ^^^^^^^^^^^^^
  File "C:\Users\user\.local\pipx\venvs\poetry\Lib\site-packages\poetry\console\application.py", line 188, in _run
    self._load_plugins(io)
  File "C:\Users\user\.local\pipx\venvs\poetry\Lib\site-packages\poetry\console\application.py", line 358, in _load_plugins
    manager.load_plugins()
  File "C:\Users\user\.local\pipx\venvs\poetry\Lib\site-packages\poetry\plugins\plugin_manager.py", line 38, in load_plugins
    self._load_plugin_entry_point(ep)
  File "C:\Users\user\.local\pipx\venvs\poetry\Lib\site-packages\poetry\plugins\plugin_manager.py", line 76, in _load_plugin_entry_point
    plugin = ep.load()  # type: ignore[no-untyped-call]
             ^^^^^^^^^
  File "C:\Program Files\Python311\Lib\importlib\metadata\__init__.py", line 202, in load
    module = import_module(match.group('module'))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1149, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "C:\Users\user\.local\pipx\venvs\poetry\Lib\site-packages\poetry_plugin_export\plugins.py", line 7, in <module>
    from poetry_plugin_export.command import ExportCommand
  File "C:\Users\user\.local\pipx\venvs\poetry\Lib\site-packages\poetry_plugin_export\command.py", line 10, in <module>
    from poetry_plugin_export.exporter import Exporter
  File "C:\Users\user\.local\pipx\venvs\poetry\Lib\site-packages\poetry_plugin_export\exporter.py", line 11, in <module>
    from poetry.repositories.http_repository import HTTPRepository
  File "C:\Users\user\.local\pipx\venvs\poetry\Lib\site-packages\poetry\repositories\http_repository.py", line 14, in <module>
    import requests
  File "C:\Users\user\.local\pipx\venvs\poetry\Lib\site-packages\requests\__init__.py", line 45, in <module>
    from .exceptions import RequestsDependencyWarning
  File "C:\Users\user\.local\pipx\venvs\poetry\Lib\site-packages\requests\exceptions.py", line 9, in <module>
    from .compat import JSONDecodeError as CompatJSONDecodeError
  File "C:\Users\user\.local\pipx\venvs\poetry\Lib\site-packages\requests\compat.py", line 13, in <module>
    import charset_normalizer as chardet
ModuleNotFoundError: No module named 'charset_normalizer'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\user\.local\pipx\venvs\poetry\Lib\site-packages\requests\compat.py", line 11, in <module>
    import chardet
ModuleNotFoundError: No module named 'chardet'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "c:\Users\user\.local\bin\poetry.exe\__main__.py", line 7, in <module>
  File "C:\Users\user\.local\pipx\venvs\poetry\Lib\site-packages\poetry\console\application.py", line 409, in main
    exit_code: int = Application().run()
                     ^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\.local\pipx\venvs\poetry\Lib\site-packages\cleo\application.py", line 338, in run
    self.render_error(e, io)
  File "C:\Users\user\.local\pipx\venvs\poetry\Lib\site-packages\poetry\console\application.py", line 180, in render_error
    self.set_solution_provider_repository(self._get_solution_provider_repository())
                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\.local\pipx\venvs\poetry\Lib\site-packages\poetry\console\application.py", line 398, in _get_solution_provider_repository
    from poetry.mixology.solutions.providers.python_requirement_solution_provider import (  # noqa: E501
  File "C:\Users\user\.local\pipx\venvs\poetry\Lib\site-packages\poetry\mixology\solutions\providers\__init__.py", line 3, in <module>
    from poetry.mixology.solutions.providers.python_requirement_solution_provider import (
  File "C:\Users\user\.local\pipx\venvs\poetry\Lib\site-packages\poetry\mixology\solutions\providers\python_requirement_solution_provider.py", line 9, in <module>
    from poetry.puzzle.exceptions import SolverProblemError
  File "C:\Users\user\.local\pipx\venvs\poetry\Lib\site-packages\poetry\puzzle\__init__.py", line 3, in <module>
    from poetry.puzzle.solver import Solver
  File "C:\Users\user\.local\pipx\venvs\poetry\Lib\site-packages\poetry\puzzle\solver.py", line 19, in <module>
    from poetry.puzzle.provider import Indicator
  File "C:\Users\user\.local\pipx\venvs\poetry\Lib\site-packages\poetry\puzzle\provider.py", line 38, in <module>
    from poetry.vcs.git import Git
  File "C:\Users\user\.local\pipx\venvs\poetry\Lib\site-packages\poetry\vcs\git\__init__.py", line 3, in <module>
    from poetry.vcs.git.backend import Git
  File "C:\Users\user\.local\pipx\venvs\poetry\Lib\site-packages\poetry\vcs\git\backend.py", line 22, in <module>
    from poetry.utils.authenticator import get_default_authenticator
  File "C:\Users\user\.local\pipx\venvs\poetry\Lib\site-packages\poetry\utils\authenticator.py", line 16, in <module>
    import requests
  File "C:\Users\user\.local\pipx\venvs\poetry\Lib\site-packages\requests\__init__.py", line 45, in <module>
    from .exceptions import RequestsDependencyWarning
  File "C:\Users\user\.local\pipx\venvs\poetry\Lib\site-packages\requests\exceptions.py", line 9, in <module>
    from .compat import JSONDecodeError as CompatJSONDecodeError
  File "C:\Users\user\.local\pipx\venvs\poetry\Lib\site-packages\requests\compat.py", line 13, in <module>
    import charset_normalizer as chardet
ModuleNotFoundError: No module named 'charset_normalizer'

I've tried reinstalling and get the same results.

@LukeDev42 LukeDev42 added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Apr 20, 2023
@dimbleby
Copy link
Contributor

looks essentially duplicate #7610.

personally I've never really trusted any of the poetry self stuff, I'd pipx inject if I were you

@valeriiisotnyk
Copy link

From windows I fix it via update or install packages like this - C:\Users\{USER}\AppData\Roaming\pypoetry\venv\Scripts\pip.exe install charset-normalizer

@Secrus Secrus added the area/plugin-api Related to plugins/plugin API label Oct 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/plugin-api Related to plugins/plugin API 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