I try to install ansible in a WSL2 instance (Debian) and got the following issues:
According to https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html#id18 I did
$ python3 -m pip install --user ansible
but this gave the
error: externally-managed-environment
× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
python3-xyz, where xyz is the package you are trying to
install.
If you wish to install a non-Debian-packaged Python package,
create a virtual environment using python3 -m venv path/to/venv.
Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
sure you have python3-full installed.
If you wish to install a non-Debian packaged Python application,
it may be easiest to use pipx install xyz, which will manage a
virtual environment for you. Make sure you have pipx installed.
See /usr/share/doc/python3.11/README.venv for more information.
note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
I installed pipx and tried
pipx install --include-deps ansible
Fatal error from pip prevented installation. Full pip output in file:
/home/norbert/.local/pipx/logs/cmd_2024-01-10_12.26.55_pip_errors.log
pip seemed to fail to build package:
pycparser
Some possibly relevant errors from pip install:
ssl.SSLError: [SSL: DECRYPTION_FAILED_OR_BAD_RECORD_MAC] decryption failed or bad record mac (_ssl.c:2546)
pip._vendor.urllib3.exceptions.SSLError: [SSL: DECRYPTION_FAILED_OR_BAD_RECORD_MAC] decryption failed or bad record mac (_ssl.c:2546)
Error installing ansible.
The error log showed
PIP STDOUT
----------
Collecting ansible
Using cached ansible-9.1.0-py3-none-any.whl.metadata (7.9 kB)
Collecting ansible-core~=2.16.1 (from ansible)
Using cached ansible_core-2.16.2-py3-none-any.whl.metadata (6.9 kB)
Collecting jinja2>=3.0.0 (from ansible-core~=2.16.1->ansible)
Using cached Jinja2-3.1.2-py3-none-any.whl (133 kB)
Collecting PyYAML>=5.1 (from ansible-core~=2.16.1->ansible)
Using cached PyYAML-6.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (2.1 kB)
Collecting cryptography (from ansible-core~=2.16.1->ansible)
Using cached cryptography-41.0.7-cp37-abi3-manylinux_2_28_x86_64.whl.metadata (5.2 kB)
Collecting packaging (from ansible-core~=2.16.1->ansible)
Using cached packaging-23.2-py3-none-any.whl.metadata (3.2 kB)
Collecting resolvelib<1.1.0,>=0.5.3 (from ansible-core~=2.16.1->ansible)
Using cached resolvelib-1.0.1-py2.py3-none-any.whl (17 kB)
Collecting MarkupSafe>=2.0 (from jinja2>=3.0.0->ansible-core~=2.16.1->ansible)
Using cached MarkupSafe-2.1.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (3.0 kB)
Collecting cffi>=1.12 (from cryptography->ansible-core~=2.16.1->ansible)
Using cached cffi-1.16.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB)
Collecting pycparser (from cffi>=1.12->cryptography->ansible-core~=2.16.1->ansible)
Using cached pycparser-2.21-py2.py3-none-any.whl (118 kB)
Downloading ansible-9.1.0-py3-none-any.whl (48.1 MB)
━━━━━━━━━━━━━━━━ 19.8/48.1 MB 10.5 MB/s eta 0:00:03
PIP STDERR
----------
ERROR: Exception:
Traceback (most recent call last):
File "/home/norbert/.local/pipx/shared/lib/python3.11/site-packages/pip/_vendor/urllib3/response.py", line 438, in _error_catcher
yield
File "/home/norbert/.local/pipx/shared/lib/python3.11/site-packages/pip/_vendor/urllib3/response.py", line 561, in read
data = self._fp_read(amt) if not fp_closed else b""
^^^^^^^^^^^^^^^^^^
File "/home/norbert/.local/pipx/shared/lib/python3.11/site-packages/pip/_vendor/urllib3/response.py", line 527, in _fp_read
return self._fp.read(amt) if amt is not None else self._fp.read()
^^^^^^^^^^^^^^^^^^
File "/home/norbert/.local/pipx/shared/lib/python3.11/site-packages/pip/_vendor/cachecontrol/filewrapper.py", line 98, in read
data: bytes = self.__fp.read(amt)
^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/http/client.py", line 465, in read
s = self.fp.read(amt)
^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/socket.py", line 706, in readinto
return self._sock.recv_into(b)
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/ssl.py", line 1278, in recv_into
return self.read(nbytes, buffer)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/ssl.py", line 1134, in read
return self._sslobj.read(len, buffer)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ssl.SSLError: [SSL: DECRYPTION_FAILED_OR_BAD_RECORD_MAC] decryption failed or bad record mac (_ssl.c:2546)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/norbert/.local/pipx/shared/lib/python3.11/site-packages/pip/_internal/cli/base_command.py", line 180, in exc_logging_wrapper
status = run_func(*args)
^^^^^^^^^^^^^^^
File "/home/norbert/.local/pipx/shared/lib/python3.11/site-packages/pip/_internal/cli/req_command.py", line 245, in wrapper
return func(self, options, args)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/norbert/.local/pipx/shared/lib/python3.11/site-packages/pip/_internal/commands/install.py", line 377, in run
requirement_set = resolver.resolve(
^^^^^^^^^^^^^^^^^
File "/home/norbert/.local/pipx/shared/lib/python3.11/site-packages/pip/_internal/resolution/resolvelib/resolver.py", line 179, in resolve
self.factory.preparer.prepare_linked_requirements_more(reqs)
File "/home/norbert/.local/pipx/shared/lib/python3.11/site-packages/pip/_internal/operations/prepare.py", line 552, in prepare_linked_requirements_more
self._complete_partial_requirements(
File "/home/norbert/.local/pipx/shared/lib/python3.11/site-packages/pip/_internal/operations/prepare.py", line 467, in _complete_partial_requirements
for link, (filepath, _) in batch_download:
File "/home/norbert/.local/pipx/shared/lib/python3.11/site-packages/pip/_internal/network/download.py", line 183, in __call__
for chunk in chunks:
File "/home/norbert/.local/pipx/shared/lib/python3.11/site-packages/pip/_internal/cli/progress_bars.py", line 53, in _rich_progress_bar
for chunk in iterable:
File "/home/norbert/.local/pipx/shared/lib/python3.11/site-packages/pip/_internal/network/utils.py", line 63, in response_chunks
for chunk in response.raw.stream(
File "/home/norbert/.local/pipx/shared/lib/python3.11/site-packages/pip/_vendor/urllib3/response.py", line 622, in stream
data = self.read(amt=amt, decode_content=decode_content)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/norbert/.local/pipx/shared/lib/python3.11/site-packages/pip/_vendor/urllib3/response.py", line 560, in read
with self._error_catcher():
File "/usr/lib/python3.11/contextlib.py", line 155, in __exit__
self.gen.throw(typ, value, traceback)
File "/home/norbert/.local/pipx/shared/lib/python3.11/site-packages/pip/_vendor/urllib3/response.py", line 449, in _error_catcher
raise SSLError(e)
pip._vendor.urllib3.exceptions.SSLError: [SSL: DECRYPTION_FAILED_OR_BAD_RECORD_MAC] decryption failed or bad record mac (_ssl.c:2546)
And now I am stuck.
Any Ideas how to proceed ?
Thanks a lot !