0

I've installed Python 3.11 in Debian 11 but after installing when I want to use pip3.11 with any package it throws the warning: pip is configured with locations that require TLS/SSL, however the SSL module in Python is not available and fails to download.

I've done

cd Python 3.11.5
./configure --prefix=/usr/local --enable-optimizations --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib"
sudo make
sudo make altinstall

Also tried this, this, and other similar solutions.

When I run sudo make it prompts

*** WARNING: renaming "_crypt" since importing it failed: libcrypt.so.2: cannot open shared object file: No such file or directory

The necessary bits to build these optional modules were not found:
_hashlib              _ssl                  _tkinter           
To find the necessary bits, look in setup.py in detect_modules() for the module's name.


The following modules built successfully but were removed because they could not be imported:
_crypt                                                         


Could not build the SSL module!
Python requires an OpenSSL 1.1.1 or newer

But I have it installed.

Tried: /configure --prefix=/usr/local --enable-optimizations --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib" --with-openssl="/home/linuxbrew/.linuxbrew/bin/openssl" but did not work either.

What can I do to build those missing packages? The one I'm most interested in is in SSL handler because it doesn't let me do anything with pip.

EDIT:

Tried installing wiht pyenv, same result:

File "/home/juanc/.pyenv/versions/3.10.12/lib/python3.10/ssl.py", line 99, in <module>
    import _ssl             # if we can't import it, let the error propagate
ModuleNotFoundError: No module named '_ssl'
ERROR: The Python ssl extension was not compiled. Missing the OpenSSL lib?

Please consult to the Wiki page to fix the problem.
https://github.com/pyenv/pyenv/wiki/Common-build-problems

I've reinstalled openssl following this tutorial (before I had it installed with brew) and now the path is /usr/local/bin/openssl.

Followed the pyenv wiki:

CPPFLAGS="-I/usr/local/include" \
LDFLAGS="-L/usr/local/lib64" \
pyenv install -v 3.10 # 3.11 is not available

But openssl keeps missing when python is built.

Pyenv ends with "succes", but there is nothing in ~/.pyenv/versions/ and pyenv versions does not recognize any other python version than system's.

Any clue?

juanmac
  • 121
  • 1
  • 12
  • Before running `./configure` you need to install a lot of dependencies. For `_ssl` you need to install `libssl-dev`: `sudo apt install -y libssl-dev` – phd Aug 31 '23 at 07:05
  • My advice is to use [`pyenv`](https://github.com/pyenv/pyenv#readme). See also https://github.com/pyenv/pyenv/wiki#suggested-build-environment for the list of required dependencies. – phd Aug 31 '23 at 07:10
  • Another advice: use `conda`. See https://stackoverflow.com/search?q=%5Bconda%5D+install+python and https://anaconda.org/conda-forge/python – phd Aug 31 '23 at 07:12
  • @phd thank's for your help. I do not like conda, I would prefer not no install it. I've already have `libssl-dev` installed. Followed your pyenv advice, but's the same, ssl keeps appearing. I'll update the question. – juanmac Aug 31 '23 at 14:46

0 Answers0