Expand this details element for details on some of the problems seen with get-poetry.py and install-poetry.py on Python 3.10.
The previous get-poetry.py install script is not compatible with Python 3.10. Attempts to install Poetry with Python 3.10 and get-poetry.py may raise ModuleNotFoundError
(python-poetry/poetry#3071, python-poetry/poetry#3345) and other errors:
Traceback (most recent call last):
File "/opt/poetry/bin/poetry", line 17, in <module>
from poetry.console import main
File "/opt/poetry/lib/poetry/console/__init__.py", line 1, in <module>
from .application import Application
File "/opt/poetry/lib/poetry/console/application.py", line 3, in <module>
from cleo import Application as BaseApplication
ModuleNotFoundError: No module named 'cleo'
Poetry 1.1.11 claimed to resolve Python 3.10 issues, but it did not.
The new install-poetry.py script (added in python-poetry/poetry#3706) must therefore be used, but it was problematic when it was introduced.
install-poetry.py did not respect POETRY_VIRTUALENVS_CREATE
As of Poetry 1.1.7, there may be complications when using install-poetry.py without a virtualenv (POETRY_VIRTUALENVS_CREATE=false
). When installing dependencies, the following error is frequently seen:
OSError
Could not find a suitable TLS CA certificate bundle, invalid path:
/opt/poetry/venv/lib/python3.9/site-packages/certifi/cacert.pem
at /opt/poetry/venv/lib/python3.9/site-packages/requests/adapters.py:227
in cert_verify
In some situations, Poetry uninstalls its own dependencies. The OSError
above occurs because Poetry uninstalls requests
and certifi
, then complains that it can't find them. See:
- python-poetry/poetry#3139
- python-poetry/poetry#3957
- python-poetry/poetry#4195
- python-poetry/poetry#4336
- python-poetry/poetry#4470
Poetry may have also been incorrectly attempting to read from its virtualenv (instead of site-packages
) if it was not respecting POETRY_VIRTUALENVS_CREATE
. Downstream steps also did not appear to respect POETRY_VIRTUALENVS_CREATE
, so the application did not run. See:
- python-poetry/poetry#3870
- https://github.com/python-poetry/poetry/discussions/4271
- python-poetry/poetry#4369
- python-poetry/poetry#4414
- https://github.com/python-poetry/poetry/issues/4429#issuecomment-903694778
- python-poetry/poetry#4430
- python-poetry/poetry#4433
Poetry did not install packages correctly with install-poetry.py, POETRY_VIRTUALENVS_CREATE
, and Python 3.10
Poetry errored out with a JSONDecodeError
when attempting to install packages with Python 3.10. See python-poetry/poetry#4210. This appeared to be resolved as of Poetry 1.2.0a2.
There were also errors with Poetry's own virtualenv when using install-poetry.py, POETRY_VIRTUALENVS_CREATE
, and multiple versions of Python, including 3.8 and 3.9. Error tracebacks typically reported a traceback sequence of CalledProcessError
-> EnvCommandError
-> PoetryException
for each package, and appeared to involve virtualenv
and pip
. These errors may have been related to Poetry's "new installer", which can be disabled with the command poetry config experimental.new-installer false
or the environment variable POETRY_EXPERIMENTAL_NEW_INSTALLER=false
.
Example traceback from a GitHub Actions run:
CalledProcessError
Command '['/opt/poetry/venv/bin/python', '/opt/poetry/venv/lib/python3.8/site-packages/virtualenv/seed/wheels/embed/pip-21.0.1-py3-none-any.whl/pip', 'install', '--disable-pip-version-check', '--prefix', '/opt/hostedtoolcache/Python/3.8.11/x64', '--no-deps', 'file:/home/runner/.cache/pypoetry/artifacts/94/aa/c7/f2115774653c0d0bf72ce93092eb73de70854164adf9f00749a952ba9c/websockets-9.1-cp38-cp38-manylinux2010_x86_64.whl']' returned non-zero exit status 1.
at /opt/hostedtoolcache/Python/3.8.11/x64/lib/python3.8/subprocess.py:516 in run
512β # We don't call process.wait() as .__exit__ does that for us.
513β raise
514β retcode = process.poll()
515β if check and retcode:
β 516β raise CalledProcessError(retcode, process.args,
517β output=stdout, stderr=stderr)
518β return CompletedProcess(process.args, retcode, stdout, stderr)
519β
520β
The following error occurred when trying to handle this error:
EnvCommandError
Command ['/opt/poetry/venv/bin/python', '/opt/poetry/venv/lib/python3.8/site-packages/virtualenv/seed/wheels/embed/pip-21.0.1-py3-none-any.whl/pip', 'install', '--disable-pip-version-check', '--prefix', '/opt/hostedtoolcache/Python/3.8.11/x64', '--no-deps', 'file:/home/runner/.cache/pypoetry/artifacts/94/aa/c7/f2115774653c0d0bf72ce93092eb73de70854164adf9f00749a952ba9c/websockets-9.1-cp38-cp38-manylinux2010_x86_64.whl'] errored with the following return code 1, and output:
Traceback (most recent call last):
File "/opt/hostedtoolcache/Python/3.8.11/x64/lib/python3.8/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/opt/hostedtoolcache/Python/3.8.11/x64/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/opt/poetry/venv/lib/python3.8/site-packages/virtualenv/seed/wheels/embed/pip-21.0.1-py3-none-any.whl/pip/__main__.py", line 24, in <module>
File "/opt/poetry/venv/lib/python3.8/site-packages/virtualenv/seed/wheels/embed/pip-21.0.1-py3-none-any.whl/pip/_internal/cli/main.py", line 71, in main
File "/opt/poetry/venv/lib/python3.8/site-packages/virtualenv/seed/wheels/embed/pip-21.0.1-py3-none-any.whl/pip/_internal/commands/__init__.py", line 96, in create_command
File "/opt/hostedtoolcache/Python/3.8.11/x64/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
File "<frozen importlib._bootstrap>", line 618, in _load_backward_compatible
File "<frozen zipimport>", line 259, in load_module
File "/opt/poetry/venv/lib/python3.8/site-packages/virtualenv/seed/wheels/embed/pip-21.0.1-py3-none-any.whl/pip/_internal/commands/install.py", line 15, in <module>
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
File "<frozen importlib._bootstrap>", line 618, in _load_backward_compatible
File "<frozen zipimport>", line 259, in load_module
File "/opt/poetry/venv/lib/python3.8/site-packages/virtualenv/seed/wheels/embed/pip-21.0.1-py3-none-any.whl/pip/_internal/cli/req_command.py", line 21, in <module>
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
File "<frozen importlib._bootstrap>", line 618, in _load_backward_compatible
File "<frozen zipimport>", line 259, in load_module
File "/opt/poetry/venv/lib/python3.8/site-packages/virtualenv/seed/wheels/embed/pip-21.0.1-py3-none-any.whl/pip/_internal/req/__init__.py", line 8, in <module>
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
File "<frozen importlib._bootstrap>", line 618, in _load_backward_compatible
File "<frozen zipimport>", line 259, in load_module
File "/opt/poetry/venv/lib/python3.8/site-packages/virtualenv/seed/wheels/embed/pip-21.0.1-py3-none-any.whl/pip/_internal/req/req_install.py", line 32, in <module>
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
File "<frozen importlib._bootstrap>", line 618, in _load_backward_compatible
File "<frozen zipimport>", line 259, in load_module
File "/opt/poetry/venv/lib/python3.8/site-packages/virtualenv/seed/wheels/embed/pip-21.0.1-py3-none-any.whl/pip/_internal/pyproject.py", line 4, in <module>
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
File "<frozen importlib._bootstrap>", line 618, in _load_backward_compatible
File "<frozen zipimport>", line 259, in load_module
File "/opt/poetry/venv/lib/python3.8/site-packages/virtualenv/seed/wheels/embed/pip-21.0.1-py3-none-any.whl/pip/_vendor/toml/__init__.py", line 6, in <module>
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
File "<frozen importlib._bootstrap>", line 618, in _load_backward_compatible
File "<frozen zipimport>", line 259, in load_module
File "/opt/poetry/venv/lib/python3.8/site-packages/virtualenv/seed/wheels/embed/pip-21.0.1-py3-none-any.whl/pip/_vendor/toml/encoder.py", line 6, in <module>
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
File "<frozen importlib._bootstrap>", line 618, in _load_backward_compatible
File "<frozen zipimport>", line 259, in load_module
File "/opt/poetry/venv/lib/python3.8/site-packages/virtualenv/seed/wheels/embed/pip-21.0.1-py3-none-any.whl/pip/_vendor/toml/decoder.py", line 7, in <module>
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 971, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 914, in _find_spec
File "<frozen importlib._bootstrap_external>", line 1407, in find_spec
File "<frozen importlib._bootstrap_external>", line 1381, in _get_spec
File "<frozen importlib._bootstrap_external>", line 1362, in _legacy_get_spec
File "<frozen importlib._bootstrap>", line 414, in spec_from_loader
File "<frozen importlib._bootstrap_external>", line 709, in spec_from_file_location
File "<frozen zipimport>", line 191, in get_filename
File "<frozen zipimport>", line 709, in _get_module_code
File "<frozen zipimport>", line 536, in _get_data
FileNotFoundError: [Errno 2] No such file or directory: '/opt/poetry/venv/lib/python3.8/site-packages/virtualenv/seed/wheels/embed/pip-21.0.1-py3-none-any.whl'
at /opt/poetry/venv/lib/python3.8/site-packages/poetry/utils/env.py:1300 in _run
1296β output = subprocess.check_output(
1297β cmd, stderr=subprocess.STDOUT, env=env, **kwargs
1298β )
1299β except CalledProcessError as e:
β 1300β raise EnvCommandError(e, input=input_)
1301β
1302β return decode(output)
1303β
1304β def execute(self, bin: str, *args: str, **kwargs: Any) -> Optional[int]:
The following error occurred when trying to handle this error:
PoetryException
Failed to install file:/home/runner/.cache/pypoetry/artifacts/94/aa/c7/f2115774653c0d0bf72ce93092eb73de70854164adf9f00749a952ba9c/websockets-9.1-cp38-cp38-manylinux2010_x86_64.whl
at /opt/poetry/venv/lib/python3.8/site-packages/poetry/utils/pip.py:60 in pip_install
56β *env.get_pip_command(),
57β *args,
58β env={**os.environ, "PYTHONPATH": str(env.purelib)},
59β )
β 60β raise PoetryException(f"Failed to install {path.as_posix()}") from e
61β
62β
63β def pip_editable_install(directory: Path, environment: Env) -> Union[int, str]:
64β return pip_install(
May be somewhat related to:
- python-poetry/poetry#3336
- python-poetry/install.python-poetry.org#61
- python-poetry/poetry#4195
- python-poetry/poetry#4463
install-poetry.py was not present in stable releases
Poetry 1.1 releases did not include install-poetry.py in their source tree. This could be a problem for projects that fetch install-poetry.py from a specific Git tag, as this project does (br3ndonland/inboard#44).
For example:
- https://raw.githubusercontent.com/python-poetry/poetry/1.1.11/get-poetry.py returns the get-poetry.py install script
- https://raw.githubusercontent.com/python-poetry/poetry/1.1.11/install-poetry.py returns
404