Cannot Insall python using pyenv

Dear Community,

This may not be directly relevant to Garuda community but I could not find the solution to my problem. Please help me to resolve this issue.
I am new to Arch. I am trying to install Python using pyenv. When I use the command

Here is the terminal output which I am getting:

yenv install 3.10.6
Downloading Python-3.10.6.tar.xz...
-> https://www.python.org/ftp/python/3.10.6/Python-3.10.6.tar.xz
Installing Python-3.10.6...
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/lepton/.pyenv/versions/3.10.6/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


BUILD FAILED (Garuda Soaring using python-build 20180424)

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

Last 10 log lines:
install|*) ensurepip="" ;; \
esac; \
LD_LIBRARY_PATH=/tmp/python-build.20230430200650.300141/Python-3.10.6 ./python -E -m ensurepip \
$ensurepip --root=/ ; \
fi
Looking in links: /tmp/tmpfbfy0dvh
Processing /tmp/tmpfbfy0dvh/setuptools-63.2.0-py3-none-any.whl
Processing /tmp/tmpfbfy0dvh/pip-22.2.1-py3-none-any.whl
Installing collected packages: setuptools, pip
Successfully installed pip-22.2.1 setuptools-63.2.0

It seems that during installation it cannot find openssl in my file system. I went through the github link provided above and tried this:

cho 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.zshrc

➜  ~ export CPPFLAGS="-I/usr/include/openssl"
➜  ~ export LDFLAGS="-L/usr/lib/openssl"
➜  ~ pyenv install 3.10.6

But it still has same issue.

I used where is open ssl and I got this :

whereis openssl
openssl: /usr/bin/openssl /usr/local/bin/openssl /usr/include/openssl /usr/share/man/man1/openssl.1ssl.gz

I cannot understand what is the issue here?

Thank you in advance

Hi there,

How did you install pyenv? As it is available in official repositories, you just have to install it using

sudo pacman -Syu pyenv

Then, you can simply list available versions using

pyenv install --list

or to show it in interactive way,

pyenv install --list | less

Then, you can install a particular version from the list, like 3.10.6 as in your example, using

pyenv install 3.10.6

Working perfectly fine here

 ╰─pyenv install 3.10.6

Downloading Python-3.10.6.tar.xz...
-> https://www.python.org/ftp/python/3.10.6/Python-3.10.6.tar.xz
Installing Python-3.10.6...
Installed Python-3.10.6 to /home/naman/.pyenv/versions/3.10.6

Please tell us how you installed pyenv

2 Likes

Thanks for the quick response.

I used following command:

git clone https://github.com/pyenv/pyenv.git ~/.pyenv
exec zsh

I tried using your way but still get the same error.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.