"asdf list all python" returns no output when used with asdf v0.16.0
Provide environment information
OS:
Linux workstation.domain.com 6.12.11-200.fc41.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Jan 24 04:59:58 UTC 2025 x86_64 GNU/Linux
SHELL:
GNU bash, version 5.2.32(1)-release (x86_64-redhat-linux-gnu)
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
BASH VERSION:
5.2.32(1)-release
ASDF VERSION:
v0.16.0
ASDF INTERNAL VARIABLES:
ASDF_DEFAULT_TOOL_VERSIONS_FILENAME=.tool-versions
ASDF_DATA_DIR=/home/user/.asdf
ASDF_CONFIG_FILE=/home/user/.asdfrc
ASDF INSTALLED PLUGINS
python https://github.com/danhper/asdf-python.git a3a01856098d6d2b9642e382f5b38e70275726d1
To Reproduce
- Uninstall asdf v0.15
- Migrate to asdf v0.16.0 by following the Upgrading to 0.16.0 documentation
- Install the asdf python plugin
- Run the command
asdf list all python
Describe the Bug
Running asdf list all python returns no output.
$ asdf list all python
$
Expected Behaviour
Running "asdf list all python" should return the list of all python versions available for installation.
After otherwise configuring asdf according to the upgrade guide, I got this working by removing and then adding the asdf Python plugin again. I can only assume that by reinstalling the plugin, a working version of the underlying pyenv repo was cloned and used.
asdf plugin remove python
asdf plugin add python
asdf list all python
asdf plugin remove python
asdf plugin add python
asdf list all python
The commands helped me, but I had to run it every time I ran the following: asdf plugin update --all
Not a stable solution. It works on one laptop and never works on another same-type laptop.
Would be happy to have a permanent solution.
Synopis and workaround
Running asdf plugin update python (or asdf plugin update --all) deletes everything in $ASDF_DATA_DIR/plugins/python/pyenv/, except the .git folder. This is a symptom of https://github.com/asdf-vm/asdf/issues/1948. The following workaround restores the contents of the pyenv/ directory:
git -C "$ASDF_DATA_DIR/plugins/python/pyenv/" restore .
Steps to reproduce the problem
Setup the environment
asdf plugin add python # [✓] status code 0
asdf list all python | wc -l # [✓] prints 912
asdf install python 3.10.16 # [✓] status code 0
asdf list all python | wc -l # [✓] prints 912
~/.asdf/plugins/python/bin/list-all # [✓] prints space-separated list of python versions
~/.asdf/plugins/python/bin/list-all | wc -c # [✓] prints 13777
~/.asdf/plugins/python/pyenv/plugins/python-build/bin/python-build --definitions | wc -l # [✓] prints 911
Trigger the problem
asdf plugin update python # triggers the bug. the call returns status code 0.
# after this line, calls to "asdf list all python"
# print an empty line.
Show the problem
asdf list all python | wc -l # status code 0. I expected it to print 912, but got 1.
Explore the problem
~/.asdf/plugins/python/pyenv/plugins/python-build/bin/python-build --definitions
# returns status code 127.
# Prints:
# -bash: /Users/mariano/.asdf/plugins/python/pyenv/plugins/python-build/bin/python-build: No such file or directory
find ~/.asdf/plugins/python/pyenv
# Shows that the directory contains a single ".git" directory.
git -C ~/.asdf/plugins/python/pyenv status
# Reveals that all files in the directory were deleted
git -C ~/.asdf/plugins/python/pyenv restore .
# Restores the deleted files
~/.asdf/plugins/python/pyenv/plugins/python-build/bin/python-build --definitions
# returns status code 0
# prints the list of python versions
asdf info
OS:
Darwin MacBookPro.lan 24.3.0 Darwin Kernel Version 24.3.0: Thu Jan 2 20:24:16 PST 2025; root:xnu-11215.81.4~3/RELEASE_ARM64_T6000 arm64
SHELL:
GNU bash, version 3.2.57(1)-release (arm64-apple-darwin24)
Copyright (C) 2007 Free Software Foundation, Inc.
BASH VERSION:
5.2.37(1)-release
ASDF VERSION:
0.16.2
ASDF INTERNAL VARIABLES:
ASDF_DEFAULT_TOOL_VERSIONS_FILENAME=.tool-versions
ASDF_DATA_DIR=/Users/mariano/.asdf
ASDF_CONFIG_FILE=/Users/mariano/.asdfrc
ASDF INSTALLED PLUGINS:
golang https://github.com/kennyp/asdf-golang.git e2527a31714da7bc671a684308579f4ef8863281
java https://github.com/halcyon/asdf-java.git def7bb7354a211cd00de79947bb3e4537418be60
opentofu https://github.com/virtualroot/asdf-opentofu.git fa2e38597e8d26cec5a6bdf3188e20f5cc1fa337
python https://github.com/danhper/asdf-python.git a3a01856098d6d2b9642e382f5b38e70275726d1
terraform https://github.com/asdf-community/asdf-hashicorp.git 22eb1c4a16adcde39aaaf89fbb5d9404a1601fce
yarn https://github.com/twuni/asdf-yarn.git 376c5407ef22c82fa56e4bd9f6a9108354063acb
Thanks @marianopeterson , your workaround fixed the issue for me.
I've corrected the issue reported in https://github.com/asdf-vm/asdf/issues/1948 with PRs https://github.com/asdf-vm/asdf/pull/1995 and https://github.com/asdf-vm/asdf/pull/1998. asdf is back to using the CLI git client for management of plugin repositories. This should no longer be an issue for anyone running asdf plugin update python, however, anyone who did run asdf plugin update python from a version of asdf containing the bug will need to use your workaround @marianopeterson to get the issue fixed, or re-install the plugin completely. I'm going to close https://github.com/asdf-vm/asdf/issues/2016 and refer everyone to this issue for the fix.