asdf-community / asdf-python

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

[BUG] if .default-python-packages package installation fails python version isn't installed. #177

Open andrewcrook opened 8 months ago

andrewcrook commented 8 months ago

Provide environment information

OS:
Darwin Andrews-MBP 23.0.0 Darwin Kernel Version 23.0.0: Fri Sep 15 14:41:34 PDT 2023; root:xnu-10002.1.13~1/RELEASE_ARM64_T8103 arm64

SHELL:
zsh 5.9 (x86_64-apple-darwin23.0)

BASH VERSION:
3.2.57(1)-release

ASDF VERSION:
v0.13.1-0586b37

ASDF INTERNAL VARIABLES:
ASDF_DEFAULT_TOOL_VERSIONS_FILENAME=.tool-versions
ASDF_DATA_DIR=/Users/XXXX/.local/share/asdf
ASDF_DIR=/Users/XXXX/.config/asdf
ASDF_CONFIG_FILE=/Users/XXXX/.config/asdf-config/asdfrc

ASDF INSTALLED PLUGINS:
direnv                       https://github.com/asdf-community/asdf-direnv.git master 2b649c8
lua                          https://github.com/Stratus3D/asdf-lua.git HEAD 36fae6e
luajit                       https://github.com/smashedtoatoms/asdf-luaJIT.git HEAD bbfe3cd
nodejs                       https://github.com/asdf-vm/asdf-nodejs.git HEAD 9c4e0f2
python                       https://github.com/danhper/asdf-python.git daa7d6ee57 daa7d6e

To Reproduce

  1. create .default-python-packages

    # You can specify a non-default location of this file by setting a ASDF_PYTHON_DEFAULT_PACKAGES_FILE variable
    xdg_base_dirs

    Note xdg_base_dirs doesn’t work with the version of python we are going to install this is so we can get an error.

  2. run

    asdf install  python 3.8.10

    response

    
    python-build 3.8.10 /Users/XXXX/.local/share/asdf/installs/python/3.8.10
    python-build: use openssl from homebrew
    python-build: use readline from homebrew
    Downloading Python-3.8.10.tar.xz...
    -> https://www.python.org/ftp/python/3.8.10/Python-3.8.10.tar.xz
    Installing Python-3.8.10...
    patching file 'Misc/NEWS.d/next/Build/2021-10-11-16-27-38.bpo-45405.iSfdW5.rst'
    patching file configure
    patching file configure.ac
    python-build: use tcl-tk from homebrew
    python-build: use readline from homebrew
    python-build: use ncurses from homebrew
    python-build: use zlib from xcode sdk
    Installed Python-3.8.10 to /Users/XXXX/.local/share/asdf/installs/python/3.8.10

Installing default python packages...ERROR: Could not find a version that satisfies the requirement xdg_base_dirs (from versions: none) ERROR: No matching distribution found for xdg_base_dirs WARNING: You are using pip version 21.1.1; however, version 23.3.1 is available. You should consider upgrading via the '/Users/XXXX/.local/share/asdf/installs/python/3.8.10/bin/python3.8 -m pip install --upgrade pip' command.


5. run

asdf list python

see 3.8.10 is missing 

4. run

ls /Users/XXXX/.local/share/asdf/installs/python/


see 3.8.10 is missing 

### Describe the Bug

if you use` .default-python-packages`
and a package install fails when installing python
The compiled version of python isn't left in the `~/.local/share/asdf/installs/python/ ` directory
I am not sure if this isn't copied or if it is some sort of rollback.

if you correct or remove issue in` .default-python-packages`
everything works as it should.

### Expected Behaviour

if ` .default-python-packages` fails  the compiled version of python should remain on the `~/.local/share/asdf/installs/python/`  directory so the issue can be resolved by the user using pip.
dadastoor commented 6 months ago

I too am experiencing this bug and it's really annoying because it forces me to pin a lower version of packages so that there is a common version between python versions