asdf-community / asdf-python

Python plugin for the asdf version manager
https://github.com/asdf-vm/asdf
MIT License
651 stars 56 forks source link

Cannot install Python 3.9.3 on Ubuntu 18.04 #99

Closed yang closed 3 years ago

yang commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

Thank you!

Is there any way to install prebuilt binaries? (I'm new to asdf but this is possible with tools like nodeenv.) That would be ideal (easier and faster for most users).

On Mon, Apr 5, 2021 at 2:56 PM Michael Cho @.***> wrote:

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: 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

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/danhper/asdf-python/issues/99#issuecomment-813673633, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAABXWJWR555QX6D6Q3OI2DTHIWZJANCNFSM42LFN5PQ .

cho-m commented 3 years ago

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 commented 3 years ago

Makes sense. Thanks again!