Score:1

pyenv Python 3.11.5 install fails in Kubuntu 23.04

cn flag

I'm using zsh and oh-my-zsh. I'm doing

➜  ~ pyenv install 3.11.5

and the output is:

Downloading Python-3.11.5.tar.xz...
-> https://www.python.org/ftp/python/3.11.5/Python-3.11.5.tar.xz
Installing Python-3.11.5...
Traceback (most recent call last):                                        
  File "<string>", line 1, in <module>
  File "/home/irem/.pyenv/versions/3.11.5/lib/python3.11/ctypes/__init__.py", line 8, in <module>
from _ctypes import Union, Structure, Array
ModuleNotFoundError: No module named '_ctypes'
WARNING: The Python ctypes extension was not compiled. Missing the libffi lib?
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/irem/.pyenv/versions/3.11.5/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 23.04 using python-build 20180424)

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

Last 10 log lines:
    LD_LIBRARY_PATH=/tmp/python-build.20230902112800.123560/Python-3.11.5 ./python -E -m ensurepip \
            $ensurepip --root=/ ; \
fi
Looking in links: /tmp/tmpurefphym
Processing /tmp/tmpurefphym/setuptools-65.5.0-py3-none-any.whl
Processing /tmp/tmpurefphym/pip-23.2.1-py3-none-any.whl
Installing collected packages: setuptools, pip
  WARNING: The scripts pip3 and pip3.11 are installed in '/home/irem/.pyenv/versions/3.11.5/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-23.2.1 setuptools-65.5.0

I saw a bunch of answers that say python must be aliased somewhere, but I did not do that. Here's what's in my .zshrc file:

export ZSH="$HOME/.oh-my-zsh"
plugins=(git)

source $ZSH/oh-my-zsh.sh

# pyenv
export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init --path)"
eval "$(pyenv virtualenv-init -)"

# alias nvim
alias vi="nvim"

As for the various oh-my-zsh config files, they all have the default options as far as I know. I did not personally change anything.

I should also add that:

➜  ~ openssl version
OpenSSL 3.0.8 7 Feb 2023 (Library: OpenSSL 3.0.8 7 Feb 2023)
➜  ~ openssl version -d
OPENSSLDIR: "/usr/lib/ssl"
muru avatar
us flag
You probably need the openssl development headers (`libssl-dev` or something like that) installed
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.