Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot install Python 3.9.3 on Ubuntu 18.04 #99

Closed
yang opened this issue Apr 4, 2021 · 4 comments
Closed

Cannot install Python 3.9.3 on Ubuntu 18.04 #99

yang opened this issue Apr 4, 2021 · 4 comments

Comments

@yang
Copy link

yang commented Apr 4, 2021

Hi, just trying to use this for the first time - please let me know if I'm missing something!

$ asdf install python 3.9.3
python-build 3.9.3 /home/yang/.asdf/installs/python/3.9.3
Downloading Python-3.9.3.tar.xz...
-> https://www.python.org/ftp/python/3.9.3/Python-3.9.3.tar.xz
Installing Python-3.9.3...

BUILD FAILED (Ubuntu 18.04 using python-build 1.2.24.1-10-g32ba5d5e)

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

Here's the end of that log:

(cd /home/yang/.asdf/installs/python/3.9.3/bin; ln -s pydoc3.9 pydoc3)
rm -f /home/yang/.asdf/installs/python/3.9.3/bin/2to3
(cd /home/yang/.asdf/installs/python/3.9.3/bin; ln -s 2to3-3.9 2to3)
if test "x" != "x" ; then \
        rm -f /home/yang/.asdf/installs/python/3.9.3/bin/python3-32; \
        (cd /home/yang/.asdf/installs/python/3.9.3/bin; ln -s python3.9-32 python3-32) \
fi
rm -f /home/yang/.asdf/installs/python/3.9.3/share/man/man1/python3.1
(cd /home/yang/.asdf/installs/python/3.9.3/share/man/man1; ln -s python3.9.1 python3.1)
if test "xupgrade" != "xno"  ; then \
        case upgrade in \
                upgrade) ensurepip="--upgrade" ;; \
                install|*) ensurepip="" ;; \
        esac; \
         ./python -E -m ensurepip \
                $ensurepip --root=/ ; \
fi
Traceback (most recent call last):
  File "<frozen zipimport>", line 520, in _get_decompress_func
ModuleNotFoundError: No module named 'zlib'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<frozen zipimport>", line 568, in _get_data
  File "<frozen zipimport>", line 523, in _get_decompress_func
zipimport.ZipImportError: can't decompress data; zlib not available

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 6, in <module>
  File "/tmp/python-build.20210404083722.12356/Python-3.9.3/Lib/runpy.py", line 206, in run_module
    mod_name, mod_spec, code = _get_module_details(mod_name)
  File "/tmp/python-build.20210404083722.12356/Python-3.9.3/Lib/runpy.py", line 147, in _get_module_details
    return _get_module_details(pkg_main_name, error)
  File "/tmp/python-build.20210404083722.12356/Python-3.9.3/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.20210404083722.12356/Python-3.9.3/Lib/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/tmp/python-build.20210404083722.12356/Python-3.9.3/Lib/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/tmp/python-build.20210404083722.12356/Python-3.9.3/Lib/ensurepip/__main__.py", line 5, in <module>
    sys.exit(ensurepip._main())
  File "/tmp/python-build.20210404083722.12356/Python-3.9.3/Lib/ensurepip/__init__.py", line 210, in _main
    return _bootstrap(
  File "/tmp/python-build.20210404083722.12356/Python-3.9.3/Lib/ensurepip/__init__.py", line 129, in _bootstrap
    return _run_pip(args + [p[0] for p in _PROJECTS], additional_paths)
  File "/tmp/python-build.20210404083722.12356/Python-3.9.3/Lib/ensurepip/__init__.py", line 38, in _run_pip
    return subprocess.run([sys.executable, "-c", code], check=True).returncode
  File "/tmp/python-build.20210404083722.12356/Python-3.9.3/Lib/subprocess.py", line 528, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/tmp/python-build.20210404083722.12356/Python-3.9.3/python', '-c', '\nimport runpy\nimport sys\nsys.path = [\'/tmp/tmpe4rnq5et/setuptools-49.2.1-py3-none-any.whl\', \'/tmp/tmpe4rnq5et/pip-20.2.3-py2.py3-none-any.whl\'] + sys.path\nsys.argv[1:] = [\'install\', \'--no-cache-dir\', \'--no-index\', \'--find-links\', \'/tmp/tmpe4rnq5et\', \'--root\', \'/\', \'--upgrade\', \'setuptools\', \'pip\']\nrunpy.run_module("pip", run_name="__main__", alter_sys=True)\n']' returned non-zero exit status 1.
Makefile:1255: recipe for target 'install' failed
make: *** [install] Error 1
@cho-m
Copy link

cho-m commented Apr 5, 2021

From error message:

ModuleNotFoundError: No module named 'zlib'

you might be missing system dependencies like zlib (Package zlib1g-dev on Ubuntu).

Make sure you have necessary build environment for python-build (which asdf-python uses): https://github.com/pyenv/pyenv/wiki#suggested-build-environment

You can also go through common issues wiki, which also includes list of recommended dependencies: https://github.com/pyenv/pyenv/wiki/Common-build-problems#prerequisites

@yang
Copy link
Author

yang commented Apr 5, 2021 via email

@cho-m
Copy link

cho-m commented Apr 6, 2021

Is there any way to install prebuilt binaries?

As far as I recall, I don't think so.
asdf-python uses pyenv's python-build which should compile the source code.
This might be due CPython only providing source code for Linux and maybe how C libraries are linked.

On the other hand, NodeJS provides binaries for all major OS (Windows/Linux/macOS): https://nodejs.org/en/download/
In this case, asdf-nodejs uses pre-built binaries.

@yang
Copy link
Author

yang commented Apr 6, 2021

Makes sense. Thanks again!

@yang yang closed this as completed Apr 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants