Quantcast
Channel: Active questions tagged ubuntu - Stack Overflow
Viewing all articles
Browse latest Browse all 6025

Unable to Install Python 3.6.8 Using PyEnv in an Ubuntu Docker Container: Segmentation Fault and Missing libffi

$
0
0

I'm attempting to set up a new Docker container using the Ubuntu latest image and install multiple Python versions using PyEnv. While I successfully installed Python 3.8.10, I'm encountering issues when trying to install Python 3.6.8.

Steps to Reproduce:

  1. Start the Docker container:docker run -it --label 'python-envs' -v ~/Desktop/python-envs/:/workspace/python-envs:rw --hostname python --name python-envs ubuntu:latest

System information with uname -a:Linux python 6.5.0-35-generic #35~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue May 7 09:00:52 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

  1. Installed pyenv: curl https://pyenv.run | bash

Verify installed Python versions, I installed version 3.8.10 before and had success:pyenv versions

Output:* system (set by /root/.pyenv/version)3.8.10

  1. installed the needed libraries:

apt install -y make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev

  1. Attempt to install Python 3.6.8:

pyenv install 3.6.8

Error Encountered:

Downloading Python-3.6.8.tar.xz...-> https://www.python.org/ftp/python/3.6.8/Python-3.6.8.tar.xzInstalling Python-3.6.8.../root/.pyenv/plugins/python-build/bin/python-build: line 1863: 30193 Segmentation fault      (core dumped) "$PYTHON_BIN" -c "import $1"WARNING: The Python ctypes extension was not compiled. Missing the libffi lib?/root/.pyenv/plugins/python-build/bin/python-build: line 2089: 30200 Segmentation fault      (core dumped) "$PYTHON_BIN" $python_opts -m ensurepip ${ensurepip_opts} > /dev/null 2>&1Installing pip from https://bootstrap.pypa.io/pip/3.6/get-pip.py.../root/.pyenv/plugins/python-build/bin/python-build: line 2065: 30204 Segmentation fault      (core dumped) "${PYTHON_BIN}" -s "${get_pip}" ${GET_PIP_OPTS} 1>&4 2>&1error: failed to install pip via get-pip.pyBUILD FAILED (Ubuntu 24.04 using python-build 20180424)Inspect or clean up the working tree at /tmp/python-build.20240612063012.18758Results logged to /tmp/python-build.20240612063012.18758.logLast 10 log lines:                install|*) ensurepip="" ;; \        esac; \        LD_LIBRARY_PATH=/tmp/python-build.20240612063012.18758/Python-3.6.8 ./python -E -m ensurepip \                $ensurepip --root=/ ; \fiLooking in links: /tmp/tmpm_fdsrq7Collecting setuptoolsCollecting pipInstalling collected packages: setuptools, pipSuccessfully installed pip-18.1 setuptools-40.6.2

Cleaned up previous attempts: pyenv uninstall 3.6.8

Used environment variables to adjust build configuration:

CFLAGS="-O2 -D_FORTIFY_SOURCE=2 -fstack-protector-strong -fno-plt \-Wformat -Werror=format-security -fPIC" \LDFLAGS="-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -Wl,--as-needed" \

None of these steps have resolved the issue. What could be causing the segmentation fault during the installation of Python 3.6.8 using PyEnv? Are there additional steps or configurations I need to consider?

Any insights or suggestions would be greatly appreciated!


Viewing all articles
Browse latest Browse all 6025

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>