Skip to content

poetry install reports ModuleNotFoundError: No module named 'distutils.cmd' #6649

@hogru

Description

@hogru
  • 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.
Using virtualenv: /home/stephan/.cache/pypoetry/virtualenvs/molgen-aFkgrORK-py3.9
Project environment contains an empty path in sys_path, ignoring.
Installing dependencies from lock file

Finding the necessary packages for the current system

Package operations: 161 installs, 1 update, 0 removals, 1 skipped

  • Installing attrs (22.1.0)
  • Installing pyrsistent (0.18.1)
  • Installing six (1.16.0)
  • Installing traitlets (5.4.0)
[keyring.backend] Loading KWallet
[keyring.backend] Loading KWallet
[keyring.backend] Loading KWallet
[keyring.backend] Loading KWallet
[keyring.backend] Loading SecretService
[keyring.backend] Loading SecretService
[keyring.backend] Loading SecretService
[keyring.backend] Loading SecretService
[keyring.backend] Loading Windows
[keyring.backend] Loading Windows
[keyring.backend] Loading Windows
[keyring.backend] Loading Windows
[keyring.backend] Loading chainer
[keyring.backend] Loading chainer
[keyring.backend] Loading chainer
[keyring.backend] Loading chainer
[keyring.backend] Loading libsecret
[keyring.backend] Loading libsecret
[keyring.backend] Loading libsecret
[keyring.backend] Loading libsecret
[keyring.backend] Loading macOS
[keyring.backend] Loading macOS
[keyring.backend] Loading macOS
[keyring.backend] Loading macOS
No suitable keyring backend found
No suitable keyring backend found
No suitable keyring backends were found
No suitable keyring backend found
No suitable keyring backends were found
No suitable keyring backend found
Keyring is not available, credentials will be stored and retrieved from configuration files as plaintext.
No suitable keyring backends were found
Keyring is not available, credentials will be stored and retrieved from configuration files as plaintext.
No suitable keyring backends were found
Creating new session for pypi.org
Keyring is not available, credentials will be stored and retrieved from configuration files as plaintext.
Creating new session for pypi.org
Keyring is not available, credentials will be stored and retrieved from configuration files as plaintext.
[urllib3.connectionpool] Starting new HTTPS connection (1): pypi.org:443
[urllib3.connectionpool] Starting new HTTPS connection (1): pypi.org:443
[urllib3.connectionpool] Starting new HTTPS connection (2): pypi.org:443
[urllib3.connectionpool] Starting new HTTPS connection (2): pypi.org:443
[urllib3.connectionpool] https://pypi.org:443 "GET /pypi/pyrsistent/0.18.1/json HTTP/1.1" 304 0
[urllib3.connectionpool] https://pypi.org:443 "GET /pypi/attrs/22.1.0/json HTTP/1.1" 304 0
[urllib3.connectionpool] https://pypi.org:443 "GET /pypi/traitlets/5.4.0/json HTTP/1.1" 304 0
[urllib3.connectionpool] https://pypi.org:443 "GET /pypi/six/1.16.0/json HTTP/1.1" 304 0
Skipping wheel pyrsistent-0.18.1-cp310-cp310-macosx_10_9_universal2.whl as this is not supported by the current environment
Skipping wheel pyrsistent-0.18.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl as this is not supported by the current environment
Skipping wheel pyrsistent-0.18.1-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl as this is not supported by the current environment
Skipping wheel pyrsistent-0.18.1-cp310-cp310-win32.whl as this is not supported by the current environment
Skipping wheel pyrsistent-0.18.1-cp310-cp310-win_amd64.whl as this is not supported by the current environment
Skipping wheel pyrsistent-0.18.1-cp37-cp37m-macosx_10_9_x86_64.whl as this is not supported by the current environment
Skipping wheel pyrsistent-0.18.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl as this is not supported by the current environment
Skipping wheel pyrsistent-0.18.1-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl as this is not supported by the current environment
Skipping wheel pyrsistent-0.18.1-cp37-cp37m-win32.whl as this is not supported by the current environment
Skipping wheel pyrsistent-0.18.1-cp37-cp37m-win_amd64.whl as this is not supported by the current environment
Skipping wheel pyrsistent-0.18.1-cp38-cp38-macosx_10_9_universal2.whl as this is not supported by the current environment
Skipping wheel pyrsistent-0.18.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl as this is not supported by the current environment
Skipping wheel pyrsistent-0.18.1-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl as this is not supported by the current environment
Skipping wheel pyrsistent-0.18.1-cp38-cp38-win32.whl as this is not supported by the current environment
Skipping wheel pyrsistent-0.18.1-cp38-cp38-win_amd64.whl as this is not supported by the current environment
Skipping wheel pyrsistent-0.18.1-cp39-cp39-macosx_10_9_universal2.whl as this is not supported by the current environment
Skipping wheel pyrsistent-0.18.1-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl as this is not supported by the current environment
Skipping wheel pyrsistent-0.18.1-cp39-cp39-win32.whl as this is not supported by the current environment
Skipping wheel pyrsistent-0.18.1-cp39-cp39-win_amd64.whl as this is not supported by the current environment

  Stack trace:

  2  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/utils/env.py:1472 in _run
      1470│                 )
      1471│             else:
    → 1472│                 output = subprocess.check_output(
      1473│                     command, stderr=subprocess.STDOUT, env=env, **kwargs
      1474│                 )

  1  /usr/lib/python3.10/subprocess.py:420 in check_output
       418│         kwargs['input'] = empty
       419│ 
    →  420│     return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
       421│                **kwargs).stdout
       422│ 

  CalledProcessError

  Command '['/home/stephan/.cache/pypoetry/virtualenvs/molgen-aFkgrORK-py3.9/bin/python', '-m', 'pip', 'install', '--disable-pip-version-check', '--prefix', '/home/stephan/.cache/pypoetry/virtualenvs/molgen-aFkgrORK-py3.9', '--no-deps', '/home/stephan/.cache/pypoetry/artifacts/ea/eb/26/48f70b8979b5485e5b34939e4957ffc0486da8bf749d1081472b8ee6e1/traitlets-5.4.0-py3-none-any.whl']' returned non-zero exit status 1.

  at /usr/lib/python3.10/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:


  Stack trace:

  3  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/utils/pip.py:49 in pip_install
       47│ 
       48│     try:
    →  49│         return environment.run_pip(*args)
       50│     except EnvCommandError as e:
       51│         raise PoetryException(f"Failed to install {path.as_posix()}") from e

  2  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/utils/env.py:1435 in run_pip
      1433│         pip = self.get_pip_command()
      1434│         cmd = pip + list(args)
    → 1435│         return self._run(cmd, **kwargs)
      1436│ 
      1437│     def run_python_script(self, content: str, **kwargs: Any) -> int | str:

  1  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/utils/env.py:1712 in _run
      1710│     def _run(self, cmd: list[str], **kwargs: Any) -> int | str:
      1711│         kwargs["env"] = self.get_temp_environ(environ=kwargs.get("env"))
    → 1712│         return super()._run(cmd, **kwargs)
      1713│ 
      1714│     def get_temp_environ(

  EnvCommandError

  Command ['/home/stephan/.cache/pypoetry/virtualenvs/molgen-aFkgrORK-py3.9/bin/python', '-m', 'pip', 'install', '--disable-pip-version-check', '--prefix', '/home/stephan/.cache/pypoetry/virtualenvs/molgen-aFkgrORK-py3.9', '--no-deps', '/home/stephan/.cache/pypoetry/artifacts/ea/eb/26/48f70b8979b5485e5b34939e4957ffc0486da8bf749d1081472b8ee6e1/traitlets-5.4.0-py3-none-any.whl'] errored with the following return code 1, and output: 
  Traceback (most recent call last):
    File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main
      return _run_code(code, main_globals, None,
    File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
      exec(code, run_globals)
    File "/home/stephan/.cache/pypoetry/virtualenvs/molgen-aFkgrORK-py3.9/lib/python3.9/site-packages/pip/__main__.py", line 29, in <module>
      from pip._internal.cli.main import main as _main
    File "/home/stephan/.cache/pypoetry/virtualenvs/molgen-aFkgrORK-py3.9/lib/python3.9/site-packages/pip/_internal/cli/main.py", line 9, in <module>
      from pip._internal.cli.autocompletion import autocomplete
    File "/home/stephan/.cache/pypoetry/virtualenvs/molgen-aFkgrORK-py3.9/lib/python3.9/site-packages/pip/_internal/cli/autocompletion.py", line 10, in <module>
      from pip._internal.cli.main_parser import create_main_parser
    File "/home/stephan/.cache/pypoetry/virtualenvs/molgen-aFkgrORK-py3.9/lib/python3.9/site-packages/pip/_internal/cli/main_parser.py", line 8, in <module>
      from pip._internal.cli import cmdoptions
    File "/home/stephan/.cache/pypoetry/virtualenvs/molgen-aFkgrORK-py3.9/lib/python3.9/site-packages/pip/_internal/cli/cmdoptions.py", line 24, in <module>
      from pip._internal.cli.parser import ConfigOptionParser
    File "/home/stephan/.cache/pypoetry/virtualenvs/molgen-aFkgrORK-py3.9/lib/python3.9/site-packages/pip/_internal/cli/parser.py", line 12, in <module>
      from pip._internal.configuration import Configuration, ConfigurationError
    File "/home/stephan/.cache/pypoetry/virtualenvs/molgen-aFkgrORK-py3.9/lib/python3.9/site-packages/pip/_internal/configuration.py", line 26, in <module>
      from pip._internal.utils.logging import getLogger
    File "/home/stephan/.cache/pypoetry/virtualenvs/molgen-aFkgrORK-py3.9/lib/python3.9/site-packages/pip/_internal/utils/logging.py", line 29, in <module>
      from pip._internal.utils.misc import ensure_dir
    File "/home/stephan/.cache/pypoetry/virtualenvs/molgen-aFkgrORK-py3.9/lib/python3.9/site-packages/pip/_internal/utils/misc.py", line 42, in <module>
      from pip._internal.locations import get_major_minor_version
    File "/home/stephan/.cache/pypoetry/virtualenvs/molgen-aFkgrORK-py3.9/lib/python3.9/site-packages/pip/_internal/locations/__init__.py", line 67, in <module>
      from . import _distutils
    File "/home/stephan/.cache/pypoetry/virtualenvs/molgen-aFkgrORK-py3.9/lib/python3.9/site-packages/pip/_internal/locations/_distutils.py", line 20, in <module>
      from distutils.cmd import Command as DistutilsCommand
  ModuleNotFoundError: No module named 'distutils.cmd'
  

  at ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/utils/env.py:1476 in _run
      1472│                 output = subprocess.check_output(
      1473│                     command, stderr=subprocess.STDOUT, env=env, **kwargs
      1474│                 )
      1475│         except CalledProcessError as e:
    → 1476│             raise EnvCommandError(e, input=input_)
      1477│ 
      1478│         return decode(output)
      1479│ 
      1480│     def execute(self, bin: str, *args: str, **kwargs: Any) -> int:

The following error occurred when trying to handle this error:


  Stack trace:

  5  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/installation/executor.py:253 in _execute_operation
      251│ 
      252│             try:
    → 253│                 result = self._do_execute_operation(operation)
      254│             except EnvCommandError as e:
      255│                 if e.e.returncode == -2:

  4  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/installation/executor.py:326 in _do_execute_operation
      324│             return 0
      325│ 
    → 326│         result: int = getattr(self, f"_execute_{method}")(operation)
      327│ 
      328│         if result != 0:

  3  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/installation/executor.py:446 in _execute_install
      444│ 
      445│     def _execute_install(self, operation: Install | Update) -> int:
    → 446│         status_code = self._install(operation)
      447│ 
      448│         self._save_url_reference(operation)

  2  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/installation/executor.py:488 in _install
      486│         )
      487│         self._write(operation, message)
    → 488│         return self.pip_install(archive, upgrade=operation.job_type == "update")
      489│ 
      490│     def _update(self, operation: Install | Update) -> int:

  1  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/installation/executor.py:123 in pip_install
      121│     ) -> int:
      122│         try:
    → 123│             pip_install(req, self._env, upgrade=upgrade, editable=editable)
      124│         except EnvCommandError as e:
      125│             output = decode(e.e.output)

  PoetryException

  Failed to install /home/stephan/.cache/pypoetry/artifacts/ea/eb/26/48f70b8979b5485e5b34939e4957ffc0486da8bf749d1081472b8ee6e1/traitlets-5.4.0-py3-none-any.whl

  at ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/utils/pip.py:51 in pip_install
       47│ 
       48│     try:
       49│         return environment.run_pip(*args)
       50│     except EnvCommandError as e:
    →  51│         raise PoetryException(f"Failed to install {path.as_posix()}") from e
       52│ 


  Stack trace:

  2  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/utils/env.py:1472 in _run
      1470│                 )
      1471│             else:
    → 1472│                 output = subprocess.check_output(
      1473│                     command, stderr=subprocess.STDOUT, env=env, **kwargs
      1474│                 )

  1  /usr/lib/python3.10/subprocess.py:420 in check_output
       418│         kwargs['input'] = empty
       419│ 
    →  420│     return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
       421│                **kwargs).stdout
       422│ 

  CalledProcessError

  Command '['/home/stephan/.cache/pypoetry/virtualenvs/molgen-aFkgrORK-py3.9/bin/python', '-m', 'pip', 'install', '--disable-pip-version-check', '--prefix', '/home/stephan/.cache/pypoetry/virtualenvs/molgen-aFkgrORK-py3.9', '--no-deps', '/home/stephan/.cache/pypoetry/artifacts/62/f0/59/eeccc31c495183d61944cc7da7adc89fecd84f334e12642effe639ec20/attrs-22.1.0-py2.py3-none-any.whl']' returned non-zero exit status 1.

  at /usr/lib/python3.10/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:


  Stack trace:

  3  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/utils/pip.py:49 in pip_install
       47│ 
       48│     try:
    →  49│         return environment.run_pip(*args)
       50│     except EnvCommandError as e:
       51│         raise PoetryException(f"Failed to install {path.as_posix()}") from e

  2  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/utils/env.py:1435 in run_pip
      1433│         pip = self.get_pip_command()
      1434│         cmd = pip + list(args)
    → 1435│         return self._run(cmd, **kwargs)
      1436│ 
      1437│     def run_python_script(self, content: str, **kwargs: Any) -> int | str:

  1  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/utils/env.py:1712 in _run
      1710│     def _run(self, cmd: list[str], **kwargs: Any) -> int | str:
      1711│         kwargs["env"] = self.get_temp_environ(environ=kwargs.get("env"))
    → 1712│         return super()._run(cmd, **kwargs)
      1713│ 
      1714│     def get_temp_environ(

  EnvCommandError

  Command ['/home/stephan/.cache/pypoetry/virtualenvs/molgen-aFkgrORK-py3.9/bin/python', '-m', 'pip', 'install', '--disable-pip-version-check', '--prefix', '/home/stephan/.cache/pypoetry/virtualenvs/molgen-aFkgrORK-py3.9', '--no-deps', '/home/stephan/.cache/pypoetry/artifacts/62/f0/59/eeccc31c495183d61944cc7da7adc89fecd84f334e12642effe639ec20/attrs-22.1.0-py2.py3-none-any.whl'] errored with the following return code 1, and output: 
  Traceback (most recent call last):
    File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main
      return _run_code(code, main_globals, None,
    File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
      exec(code, run_globals)
    File "/home/stephan/.cache/pypoetry/virtualenvs/molgen-aFkgrORK-py3.9/lib/python3.9/site-packages/pip/__main__.py", line 29, in <module>
      from pip._internal.cli.main import main as _main
    File "/home/stephan/.cache/pypoetry/virtualenvs/molgen-aFkgrORK-py3.9/lib/python3.9/site-packages/pip/_internal/cli/main.py", line 9, in <module>
      from pip._internal.cli.autocompletion import autocomplete
    File "/home/stephan/.cache/pypoetry/virtualenvs/molgen-aFkgrORK-py3.9/lib/python3.9/site-packages/pip/_internal/cli/autocompletion.py", line 10, in <module>
      from pip._internal.cli.main_parser import create_main_parser
    File "/home/stephan/.cache/pypoetry/virtualenvs/molgen-aFkgrORK-py3.9/lib/python3.9/site-packages/pip/_internal/cli/main_parser.py", line 8, in <module>
      from pip._internal.cli import cmdoptions
    File "/home/stephan/.cache/pypoetry/virtualenvs/molgen-aFkgrORK-py3.9/lib/python3.9/site-packages/pip/_internal/cli/cmdoptions.py", line 24, in <module>
      from pip._internal.cli.parser import ConfigOptionParser
    File "/home/stephan/.cache/pypoetry/virtualenvs/molgen-aFkgrORK-py3.9/lib/python3.9/site-packages/pip/_internal/cli/parser.py", line 12, in <module>
      from pip._internal.configuration import Configuration, ConfigurationError
    File "/home/stephan/.cache/pypoetry/virtualenvs/molgen-aFkgrORK-py3.9/lib/python3.9/site-packages/pip/_internal/configuration.py", line 26, in <module>
      from pip._internal.utils.logging import getLogger
    File "/home/stephan/.cache/pypoetry/virtualenvs/molgen-aFkgrORK-py3.9/lib/python3.9/site-packages/pip/_internal/utils/logging.py", line 29, in <module>
      from pip._internal.utils.misc import ensure_dir
    File "/home/stephan/.cache/pypoetry/virtualenvs/molgen-aFkgrORK-py3.9/lib/python3.9/site-packages/pip/_internal/utils/misc.py", line 42, in <module>
      from pip._internal.locations import get_major_minor_version
    File "/home/stephan/.cache/pypoetry/virtualenvs/molgen-aFkgrORK-py3.9/lib/python3.9/site-packages/pip/_internal/locations/__init__.py", line 67, in <module>
      from . import _distutils
    File "/home/stephan/.cache/pypoetry/virtualenvs/molgen-aFkgrORK-py3.9/lib/python3.9/site-packages/pip/_internal/locations/_distutils.py", line 20, in <module>
      from distutils.cmd import Command as DistutilsCommand
  ModuleNotFoundError: No module named 'distutils.cmd'
  

  at ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/utils/env.py:1476 in _run
      1472│                 output = subprocess.check_output(
      1473│                     command, stderr=subprocess.STDOUT, env=env, **kwargs
      1474│                 )
      1475│         except CalledProcessError as e:
    → 1476│             raise EnvCommandError(e, input=input_)
      1477│ 
      1478│         return decode(output)
      1479│ 
      1480│     def execute(self, bin: str, *args: str, **kwargs: Any) -> int:

The following error occurred when trying to handle this error:


  Stack trace:

  5  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/installation/executor.py:253 in _execute_operation
      251│ 
      252│             try:
    → 253│                 result = self._do_execute_operation(operation)
      254│             except EnvCommandError as e:
      255│                 if e.e.returncode == -2:

  4  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/installation/executor.py:326 in _do_execute_operation
      324│             return 0
      325│ 
    → 326│         result: int = getattr(self, f"_execute_{method}")(operation)
      327│ 
      328│         if result != 0:

  3  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/installation/executor.py:446 in _execute_install
      444│ 
      445│     def _execute_install(self, operation: Install | Update) -> int:
    → 446│         status_code = self._install(operation)
      447│ 
      448│         self._save_url_reference(operation)

  2  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/installation/executor.py:488 in _install
      486│         )
      487│         self._write(operation, message)
    → 488│         return self.pip_install(archive, upgrade=operation.job_type == "update")
      489│ 
      490│     def _update(self, operation: Install | Update) -> int:

  1  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/installation/executor.py:123 in pip_install
      121│     ) -> int:
      122│         try:
    → 123│             pip_install(req, self._env, upgrade=upgrade, editable=editable)
      124│         except EnvCommandError as e:
      125│             output = decode(e.e.output)

  PoetryException

  Failed to install /home/stephan/.cache/pypoetry/artifacts/62/f0/59/eeccc31c495183d61944cc7da7adc89fecd84f334e12642effe639ec20/attrs-22.1.0-py2.py3-none-any.whl

  at ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/utils/pip.py:51 in pip_install
       47│ 
       48│     try:
       49│         return environment.run_pip(*args)
       50│     except EnvCommandError as e:
    →  51│         raise PoetryException(f"Failed to install {path.as_posix()}") from e
       52│ 


  Stack trace:

  2  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/utils/env.py:1472 in _run
      1470│                 )
      1471│             else:
    → 1472│                 output = subprocess.check_output(
      1473│                     command, stderr=subprocess.STDOUT, env=env, **kwargs
      1474│                 )

  1  /usr/lib/python3.10/subprocess.py:420 in check_output
       418│         kwargs['input'] = empty
       419│ 
    →  420│     return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
       421│                **kwargs).stdout
       422│ 

  CalledProcessError

  Command '['/home/stephan/.cache/pypoetry/virtualenvs/molgen-aFkgrORK-py3.9/bin/python', '-m', 'pip', 'install', '--disable-pip-version-check', '--prefix', '/home/stephan/.cache/pypoetry/virtualenvs/molgen-aFkgrORK-py3.9', '--no-deps', '/home/stephan/.cache/pypoetry/artifacts/08/9f/47/c16ae03035fc69eaf100ea39657a49baaeef714e25a52575710c34cd48/six-1.16.0-py2.py3-none-any.whl']' returned non-zero exit status 1.

  at /usr/lib/python3.10/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:


  Stack trace:

  3  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/utils/pip.py:49 in pip_install
       47│ 
       48│     try:
    →  49│         return environment.run_pip(*args)
       50│     except EnvCommandError as e:
       51│         raise PoetryException(f"Failed to install {path.as_posix()}") from e

  2  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/utils/env.py:1435 in run_pip
      1433│         pip = self.get_pip_command()
      1434│         cmd = pip + list(args)
    → 1435│         return self._run(cmd, **kwargs)
      1436│ 
      1437│     def run_python_script(self, content: str, **kwargs: Any) -> int | str:

  1  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/utils/env.py:1712 in _run
      1710│     def _run(self, cmd: list[str], **kwargs: Any) -> int | str:
      1711│         kwargs["env"] = self.get_temp_environ(environ=kwargs.get("env"))
    → 1712│         return super()._run(cmd, **kwargs)
      1713│ 
      1714│     def get_temp_environ(

  EnvCommandError

  Command ['/home/stephan/.cache/pypoetry/virtualenvs/molgen-aFkgrORK-py3.9/bin/python', '-m', 'pip', 'install', '--disable-pip-version-check', '--prefix', '/home/stephan/.cache/pypoetry/virtualenvs/molgen-aFkgrORK-py3.9', '--no-deps', '/home/stephan/.cache/pypoetry/artifacts/08/9f/47/c16ae03035fc69eaf100ea39657a49baaeef714e25a52575710c34cd48/six-1.16.0-py2.py3-none-any.whl'] errored with the following return code 1, and output: 
  Traceback (most recent call last):
    File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main
      return _run_code(code, main_globals, None,
    File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
      exec(code, run_globals)
    File "/home/stephan/.cache/pypoetry/virtualenvs/molgen-aFkgrORK-py3.9/lib/python3.9/site-packages/pip/__main__.py", line 29, in <module>
      from pip._internal.cli.main import main as _main
    File "/home/stephan/.cache/pypoetry/virtualenvs/molgen-aFkgrORK-py3.9/lib/python3.9/site-packages/pip/_internal/cli/main.py", line 9, in <module>
      from pip._internal.cli.autocompletion import autocomplete
    File "/home/stephan/.cache/pypoetry/virtualenvs/molgen-aFkgrORK-py3.9/lib/python3.9/site-packages/pip/_internal/cli/autocompletion.py", line 10, in <module>
      from pip._internal.cli.main_parser import create_main_parser
    File "/home/stephan/.cache/pypoetry/virtualenvs/molgen-aFkgrORK-py3.9/lib/python3.9/site-packages/pip/_internal/cli/main_parser.py", line 8, in <module>
      from pip._internal.cli import cmdoptions
    File "/home/stephan/.cache/pypoetry/virtualenvs/molgen-aFkgrORK-py3.9/lib/python3.9/site-packages/pip/_internal/cli/cmdoptions.py", line 24, in <module>
      from pip._internal.cli.parser import ConfigOptionParser
    File "/home/stephan/.cache/pypoetry/virtualenvs/molgen-aFkgrORK-py3.9/lib/python3.9/site-packages/pip/_internal/cli/parser.py", line 12, in <module>
      from pip._internal.configuration import Configuration, ConfigurationError
    File "/home/stephan/.cache/pypoetry/virtualenvs/molgen-aFkgrORK-py3.9/lib/python3.9/site-packages/pip/_internal/configuration.py", line 26, in <module>
      from pip._internal.utils.logging import getLogger
    File "/home/stephan/.cache/pypoetry/virtualenvs/molgen-aFkgrORK-py3.9/lib/python3.9/site-packages/pip/_internal/utils/logging.py", line 29, in <module>
      from pip._internal.utils.misc import ensure_dir
    File "/home/stephan/.cache/pypoetry/virtualenvs/molgen-aFkgrORK-py3.9/lib/python3.9/site-packages/pip/_internal/utils/misc.py", line 42, in <module>
      from pip._internal.locations import get_major_minor_version
    File "/home/stephan/.cache/pypoetry/virtualenvs/molgen-aFkgrORK-py3.9/lib/python3.9/site-packages/pip/_internal/locations/__init__.py", line 67, in <module>
      from . import _distutils
    File "/home/stephan/.cache/pypoetry/virtualenvs/molgen-aFkgrORK-py3.9/lib/python3.9/site-packages/pip/_internal/locations/_distutils.py", line 20, in <module>
      from distutils.cmd import Command as DistutilsCommand
  ModuleNotFoundError: No module named 'distutils.cmd'
  

  at ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/utils/env.py:1476 in _run
      1472│                 output = subprocess.check_output(
      1473│                     command, stderr=subprocess.STDOUT, env=env, **kwargs
      1474│                 )
      1475│         except CalledProcessError as e:
    → 1476│             raise EnvCommandError(e, input=input_)
      1477│ 
      1478│         return decode(output)
      1479│ 
      1480│     def execute(self, bin: str, *args: str, **kwargs: Any) -> int:

The following error occurred when trying to handle this error:


  Stack trace:

  5  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/installation/executor.py:253 in _execute_operation
      251│ 
      252│             try:
    → 253│                 result = self._do_execute_operation(operation)
      254│             except EnvCommandError as e:
      255│                 if e.e.returncode == -2:

  4  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/installation/executor.py:326 in _do_execute_operation
      324│             return 0
      325│ 
    → 326│         result: int = getattr(self, f"_execute_{method}")(operation)
      327│ 
      328│         if result != 0:

  3  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/installation/executor.py:446 in _execute_install
      444│ 
      445│     def _execute_install(self, operation: Install | Update) -> int:
    → 446│         status_code = self._install(operation)
      447│ 
      448│         self._save_url_reference(operation)

  2  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/installation/executor.py:488 in _install
      486│         )
      487│         self._write(operation, message)
    → 488│         return self.pip_install(archive, upgrade=operation.job_type == "update")
      489│ 
      490│     def _update(self, operation: Install | Update) -> int:

  1  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/installation/executor.py:123 in pip_install
      121│     ) -> int:
      122│         try:
    → 123│             pip_install(req, self._env, upgrade=upgrade, editable=editable)
      124│         except EnvCommandError as e:
      125│             output = decode(e.e.output)

  PoetryException

  Failed to install /home/stephan/.cache/pypoetry/artifacts/08/9f/47/c16ae03035fc69eaf100ea39657a49baaeef714e25a52575710c34cd48/six-1.16.0-py2.py3-none-any.whl

  at ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/utils/pip.py:51 in pip_install
       47│ 
       48│     try:
       49│         return environment.run_pip(*args)
       50│     except EnvCommandError as e:
    →  51│         raise PoetryException(f"Failed to install {path.as_posix()}") from e
       52│ 


  Stack trace:

  2  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/utils/env.py:1472 in _run
      1470│                 )
      1471│             else:
    → 1472│                 output = subprocess.check_output(
      1473│                     command, stderr=subprocess.STDOUT, env=env, **kwargs
      1474│                 )

  1  /usr/lib/python3.10/subprocess.py:420 in check_output
       418│         kwargs['input'] = empty
       419│ 
    →  420│     return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
       421│                **kwargs).stdout
       422│ 

  CalledProcessError

  Command '['/home/stephan/.cache/pypoetry/virtualenvs/molgen-aFkgrORK-py3.9/bin/python', '-m', 'pip', 'install', '--disable-pip-version-check', '--prefix', '/home/stephan/.cache/pypoetry/virtualenvs/molgen-aFkgrORK-py3.9', '--no-deps', '/home/stephan/.cache/pypoetry/artifacts/0a/90/60/922630fb195d328e65883c7ca534e135921b3a28c1473b2468ff04c147/pyrsistent-0.18.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl']' returned non-zero exit status 1.

  at /usr/lib/python3.10/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:


  Stack trace:

  3  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/utils/pip.py:49 in pip_install
       47│ 
       48│     try:
    →  49│         return environment.run_pip(*args)
       50│     except EnvCommandError as e:
       51│         raise PoetryException(f"Failed to install {path.as_posix()}") from e

  2  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/utils/env.py:1435 in run_pip
      1433│         pip = self.get_pip_command()
      1434│         cmd = pip + list(args)
    → 1435│         return self._run(cmd, **kwargs)
      1436│ 
      1437│     def run_python_script(self, content: str, **kwargs: Any) -> int | str:

  1  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/utils/env.py:1712 in _run
      1710│     def _run(self, cmd: list[str], **kwargs: Any) -> int | str:
      1711│         kwargs["env"] = self.get_temp_environ(environ=kwargs.get("env"))
    → 1712│         return super()._run(cmd, **kwargs)
      1713│ 
      1714│     def get_temp_environ(

  EnvCommandError

  Command ['/home/stephan/.cache/pypoetry/virtualenvs/molgen-aFkgrORK-py3.9/bin/python', '-m', 'pip', 'install', '--disable-pip-version-check', '--prefix', '/home/stephan/.cache/pypoetry/virtualenvs/molgen-aFkgrORK-py3.9', '--no-deps', '/home/stephan/.cache/pypoetry/artifacts/0a/90/60/922630fb195d328e65883c7ca534e135921b3a28c1473b2468ff04c147/pyrsistent-0.18.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl'] errored with the following return code 1, and output: 
  Traceback (most recent call last):
    File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main
      return _run_code(code, main_globals, None,
    File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
      exec(code, run_globals)
    File "/home/stephan/.cache/pypoetry/virtualenvs/molgen-aFkgrORK-py3.9/lib/python3.9/site-packages/pip/__main__.py", line 29, in <module>
      from pip._internal.cli.main import main as _main
    File "/home/stephan/.cache/pypoetry/virtualenvs/molgen-aFkgrORK-py3.9/lib/python3.9/site-packages/pip/_internal/cli/main.py", line 9, in <module>
      from pip._internal.cli.autocompletion import autocomplete
    File "/home/stephan/.cache/pypoetry/virtualenvs/molgen-aFkgrORK-py3.9/lib/python3.9/site-packages/pip/_internal/cli/autocompletion.py", line 10, in <module>
      from pip._internal.cli.main_parser import create_main_parser
    File "/home/stephan/.cache/pypoetry/virtualenvs/molgen-aFkgrORK-py3.9/lib/python3.9/site-packages/pip/_internal/cli/main_parser.py", line 8, in <module>
      from pip._internal.cli import cmdoptions
    File "/home/stephan/.cache/pypoetry/virtualenvs/molgen-aFkgrORK-py3.9/lib/python3.9/site-packages/pip/_internal/cli/cmdoptions.py", line 24, in <module>
      from pip._internal.cli.parser import ConfigOptionParser
    File "/home/stephan/.cache/pypoetry/virtualenvs/molgen-aFkgrORK-py3.9/lib/python3.9/site-packages/pip/_internal/cli/parser.py", line 12, in <module>
      from pip._internal.configuration import Configuration, ConfigurationError
    File "/home/stephan/.cache/pypoetry/virtualenvs/molgen-aFkgrORK-py3.9/lib/python3.9/site-packages/pip/_internal/configuration.py", line 26, in <module>
      from pip._internal.utils.logging import getLogger
    File "/home/stephan/.cache/pypoetry/virtualenvs/molgen-aFkgrORK-py3.9/lib/python3.9/site-packages/pip/_internal/utils/logging.py", line 29, in <module>
      from pip._internal.utils.misc import ensure_dir
    File "/home/stephan/.cache/pypoetry/virtualenvs/molgen-aFkgrORK-py3.9/lib/python3.9/site-packages/pip/_internal/utils/misc.py", line 42, in <module>
      from pip._internal.locations import get_major_minor_version
    File "/home/stephan/.cache/pypoetry/virtualenvs/molgen-aFkgrORK-py3.9/lib/python3.9/site-packages/pip/_internal/locations/__init__.py", line 67, in <module>
      from . import _distutils
    File "/home/stephan/.cache/pypoetry/virtualenvs/molgen-aFkgrORK-py3.9/lib/python3.9/site-packages/pip/_internal/locations/_distutils.py", line 20, in <module>
      from distutils.cmd import Command as DistutilsCommand
  ModuleNotFoundError: No module named 'distutils.cmd'
  

  at ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/utils/env.py:1476 in _run
      1472│                 output = subprocess.check_output(
      1473│                     command, stderr=subprocess.STDOUT, env=env, **kwargs
      1474│                 )
      1475│         except CalledProcessError as e:
    → 1476│             raise EnvCommandError(e, input=input_)
      1477│ 
      1478│         return decode(output)
      1479│ 
      1480│     def execute(self, bin: str, *args: str, **kwargs: Any) -> int:

The following error occurred when trying to handle this error:


  Stack trace:

  5  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/installation/executor.py:253 in _execute_operation
      251│ 
      252│             try:
    → 253│                 result = self._do_execute_operation(operation)
      254│             except EnvCommandError as e:
      255│                 if e.e.returncode == -2:

  4  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/installation/executor.py:326 in _do_execute_operation
      324│             return 0
      325│ 
    → 326│         result: int = getattr(self, f"_execute_{method}")(operation)
      327│ 
      328│         if result != 0:

  3  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/installation/executor.py:446 in _execute_install
      444│ 
      445│     def _execute_install(self, operation: Install | Update) -> int:
    → 446│         status_code = self._install(operation)
      447│ 
      448│         self._save_url_reference(operation)

  2  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/installation/executor.py:488 in _install
      486│         )
      487│         self._write(operation, message)
    → 488│         return self.pip_install(archive, upgrade=operation.job_type == "update")
      489│ 
      490│     def _update(self, operation: Install | Update) -> int:

  1  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/installation/executor.py:123 in pip_install
      121│     ) -> int:
      122│         try:
    → 123│             pip_install(req, self._env, upgrade=upgrade, editable=editable)
      124│         except EnvCommandError as e:
      125│             output = decode(e.e.output)

  PoetryException

  Failed to install /home/stephan/.cache/pypoetry/artifacts/0a/90/60/922630fb195d328e65883c7ca534e135921b3a28c1473b2468ff04c147/pyrsistent-0.18.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

  at ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/utils/pip.py:51 in pip_install
       47│ 
       48│     try:
       49│         return environment.run_pip(*args)
       50│     except EnvCommandError as e:
    →  51│         raise PoetryException(f"Failed to install {path.as_posix()}") from e
       52│ 

Issue

Problem

  • I setup a new Ubuntu 22.04 desktop
  • I install poetry, works as expected, i.e. I can call poetry --version
  • I clone a github repo which I was working with on another machine
  • I cd into the directory with the pyproject.toml file
  • I run poetry shell
  • I run poetry install
  • poetry reports errors (see output above), the main one seems to be ModuleNotFoundError: No module named 'distutils.cmd'
  • I get the same error when running pip --version in the virtual environment, but not outside of it

What I tried so far

  • Checked which pip / pip3 / python / python3 to see whether they use the virtual environment
  • (Re-) Install distutils: sudo apt install python3-distutils / sudo apt-get install python3-distutils both in- and outside the virtual environment
  • sudo apt-get install python3-apt (as per a web forum recommendation)
  • Delete poetry.lock

What else can I do/try. I am not on Linux most of the time so I might easily miss something.

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugSomething isn't working as expectedstatus/triageThis issue needs to be triaged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions