6

I tried installing python using the command pyenv install 3.8.11

Please let me know if you need more info. Thank you for looking. output:

BUILD FAILED (Ubuntu 20.04 using python-build 20180424)

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

Last 10 log lines:
  File "/tmp/python-build.20210821132713.23441/Python-3.8.11/Lib/ensurepip/__init__.py", line 206, in _main
    return _bootstrap(
  File "/tmp/python-build.20210821132713.23441/Python-3.8.11/Lib/ensurepip/__init__.py", line 125, in _bootstrap
    return _run_pip(args + [p[0] for p in _PROJECTS], additional_paths)
  File "/tmp/python-build.20210821132713.23441/Python-3.8.11/Lib/ensurepip/__init__.py", line 34, in _run_pip
    return subprocess.run([sys.executable, "-c", code], check=True).returncode
  File "/tmp/python-build.20210821132713.23441/Python-3.8.11/Lib/subprocess.py", line 516, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/tmp/python-build.20210821132713.23441/Python-3.8.11/python', '-c', '\nimport runpy\nimport sys\nsys.path = [\'/tmp/tmp7l0fqi9l/setuptools-56.0.0-py3-none-any.whl\', \'/tmp/tmp7l0fqi9l/pip-21.1.1-py3-none-any.whl\'] + sys.path\nsys.argv[1:] = [\'install\', \'--no-cache-dir\', \'--no-index\', \'--find-links\', \'/tmp/tmp7l0fqi9l\', \'--root\', \'/\', \'--upgrade\', \'setuptools\', \'pip\']\nrunpy.run_module("pip", run_name="__main__", alter_sys=True)\n']' returned non-zero exit status 1.
make: *** [Makefile:1198: install] Error 1

log:

Traceback (most recent call last):
  File "<string>", line 6, in <module>
  File "/tmp/python-build.20210821140419.301/Python-3.8.11/Lib/runpy.py", line 203, in run_module
    mod_name, mod_spec, code = _get_module_details(mod_name)
  File "/tmp/python-build.20210821140419.301/Python-3.8.11/Lib/runpy.py", line 144, in _get_module_details
    return _get_module_details(pkg_main_name, error)
  File "/tmp/python-build.20210821140419.301/Python-3.8.11/Lib/runpy.py", line 111, in _get_module_details
    __import__(pkg_name)
  File "<frozen zipimport>", line 241, in load_module
  File "<frozen zipimport>", line 709, in _get_module_code
  File "<frozen zipimport>", line 570, in _get_data
zipimport.ZipImportError: can't decompress data; zlib not available
Traceback (most recent call last):
  File "/tmp/python-build.20210821140419.301/Python-3.8.11/Lib/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/tmp/python-build.20210821140419.301/Python-3.8.11/Lib/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/tmp/python-build.20210821140419.301/Python-3.8.11/Lib/ensurepip/__main__.py", line 5, in <module>
    sys.exit(ensurepip._main())
  File "/tmp/python-build.20210821140419.301/Python-3.8.11/Lib/ensurepip/__init__.py", line 206, in _main
    return _bootstrap(
  File "/tmp/python-build.20210821140419.301/Python-3.8.11/Lib/ensurepip/__init__.py", line 125, in _bootstrap
    return _run_pip(args + [p[0] for p in _PROJECTS], additional_paths)
  File "/tmp/python-build.20210821140419.301/Python-3.8.11/Lib/ensurepip/__init__.py", line 34, in _run_pip
    return subprocess.run([sys.executable, "-c", code], check=True).returncode
  File "/tmp/python-build.20210821140419.301/Python-3.8.11/Lib/subprocess.py", line 516, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/tmp/python-build.20210821140419.301/Python-3.8.11/python', '-c', '\nimport runpy\nimport sys\nsys.path = [\'/tmp/tmp1imhbulh/setuptools-56.0.0-py3-none-any.whl\', \'/tmp/tmp1imhbulh/pip-21.1.1-py3-none-any.whl\'] + sys.path\nsys.argv[1:] = [\'install\', \'--no-cache-dir\', \'--no-index\', \'--find-links\', \'/tmp/tmp1imhbulh\', \'--root\', \'/\', \'--upgrade\', \'setuptools\', \'pip\']\nrunpy.run_module("pip", run_name="__main__", alter_sys=True)\n']' returned non-zero exit status 1.
make: *** [Makefile:1198: install] Error 1
9
  • Did you follow all of the installation instructions properly? Commented Aug 21, 2021 at 20:42
  • 1
    I've got a kind of PTSD, when I see that error. Take a look into the log file. Commented Aug 21, 2021 at 20:42
  • I believe I did follow them correctly. I'm still new to this, so I'm not sure what I'm supposed to look for. Commented Aug 21, 2021 at 20:52
  • 1
    The error should be in the log file (look at the file where it says Results logged to /tmp/python-build.XXXXXXXXXXXXX.log). The error should be towards the bottom of the file. You can include the contents of that file here so someone can help. Commented Aug 21, 2021 at 20:54
  • Okay, I think this is the section from that file that you're mentioning. It's a giant file. Commented Aug 21, 2021 at 21:11

1 Answer 1

16

pyenv requires some packages to build Python from source.

For Ubuntu, from pyenv wiki: suggested build environment

sudo apt-get install 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
Sign up to request clarification or add additional context in comments.

3 Comments

This fixed the issue. I went back and followed the guide, but they left this part out in the video. It was actually included in the written tutorial. Thank you and also thanks to everyone else who participated.
@Aeton No problem. Could you accept my answer, to flag the question as resolved?
Yes, it solves the problem but... it is sad that there is no eloquent error message to tell us what is wrong. "returned non-zero exit status 1." is not very eloquent.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.