Problems with installing Python 3.11.1 using pyenv
Asked Answered
F

1

5

I tried to install Python 3.11.1 using Pyenv and got this:

➜  ~ pyenv install 3.11.1 
Downloading Python-3.11.1.tar.xz...
-> https://www.python.org/ftp/python/3.11.1/Python-3.11.1.tar.xz
Installing Python-3.11.1...
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/eustignos/.pyenv/versions/3.11.1/lib/python3.11/ssl.py", line 100, 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


BUILD FAILED (Ubuntu 22.10 using python-build 20180424)

Inspect or clean up the working tree at /tmp/python-build.20230112175103.128449
Results logged to /tmp/python-build.20230112175103.128449.log

Last 10 log lines:
        LD_LIBRARY_PATH=/tmp/python-build.20230112175103.128449/Python-3.11.1 ./python -E -m ensurepip \
                $ensurepip --root=/ ; \
fi
Looking in links: /tmp/tmpba6xv1b0
Processing /tmp/tmpba6xv1b0/setuptools-65.5.0-py3-none-any.whl
Processing /tmp/tmpba6xv1b0/pip-22.3.1-py3-none-any.whl
Installing collected packages: setuptools, pip
  WARNING: The scripts pip3 and pip3.11 are installed in '/home/{user}/.pyenv/versions/3.11.1/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed pip-22.3.1 setuptools-65.5.0

OpenSSL is installed 2 different ways (using apt - latest for 22.10 and 2 with brew - 1.1 and 3) By default:

➜  ~ openssl version
OpenSSL 1.1.1s  1 Nov 2022
➜  ~ which openssl
/home/linuxbrew/.linuxbrew/bin/openssl

Fenugreek answered 12/1, 2023 at 12:7 Comment(0)
F
6

Solved this way:

➜  ~ CONFIGURE_OPTS="--with-openssl=$(brew --prefix openssl)" pyenv install 3.11.1

And got the same message but for tkinter lib. Installed this by

➜  ~ brew install tcl-tk

And everything worked nice:

➜  ~ CONFIGURE_OPTS="--with-openssl=$(brew --prefix openssl)" pyenv install 3.11.1
Downloading Python-3.11.1.tar.xz...
-> https://www.python.org/ftp/python/3.11.1/Python-3.11.1.tar.xz
Installing Python-3.11.1...
Installed Python-3.11.1 to /home/eustignos/.pyenv/versions/3.11.1
Fenugreek answered 12/1, 2023 at 12:9 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.