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

install order should follow the order in .tool-versions #929

Open
joshlartz opened this issue Apr 29, 2021 · 14 comments
Open

install order should follow the order in .tool-versions #929

joshlartz opened this issue Apr 29, 2021 · 14 comments
Labels
bug priority asdf core intend to resolve soon

Comments

@joshlartz
Copy link

Describe the bug

Some plugins depend on others to be installed first. Despite being expressed that way in the .tool-versions file, asdf alphabetizes the install regardless.

This feels like it should be the default behavior, but at the very least there should be a flag for it.

To Reproduce

# .tool-versions
python 3.9.4
awscli 2.2.0

asdf install

Expected behavior

The .tool-versions file is installed top to bottom.

Actual behavior

The installation happens in alphabetical order.

asdf install

  • Downloading awscli release 2.2.0...
    ~/.asdf/installs/awscli/2.2.0 ~
    .asdf/plugins/awscli/bin/../lib/utils.bash: line 86: python: command not found
    .asdf/plugins/awscli/bin/../lib/utils.bash: line 87: ./venv/bin/activate: No such file or directory
    .asdf/plugins/awscli/bin/../lib/utils.bash: line 88: pip: command not found
    .asdf/plugins/awscli/bin/../lib/utils.bash: line 89: pip: command not found
    .asdf/plugins/awscli/bin/../lib/utils.bash: line 90: pip: command not found
    .asdf/plugins/awscli/bin/../lib/utils.bash: line 91: deactivate: command not found
    ~
    awscli 2.2.0 installation was successful!
    Downloading python-build...

Environment

OS:
Darwin C02WQ018HTDD 20.4.0 Darwin Kernel Version 20.4.0: Fri Mar  5 01:14:14 PST 2021; root:xnu-7195.101.1~3/RELEASE_X86_64 x86_64

SHELL:
zsh 5.8 (x86_64-apple-darwin20.0)

ASDF VERSION:
v0.8.0
@jthegedus jthegedus added the bug label May 4, 2021
@lifeiscontent
Copy link

@jthegedus not sure if this should be another issue, but in the regards of awscli plugin, it uses a global version of python instead of a local version, is there a way to use a locally defined tool inside a plugin?

@jthegedus
Copy link
Contributor

jthegedus commented May 8, 2021

@jthegedus not sure if this should be another issue, but in the regards of awscli plugin, it uses a global version of python instead of a local version, is there a way to use a locally defined tool inside a plugin?

Good question. It depends on the plugin implementation. Ideally, each tool installed is a standalone, pre-packaged binary. If it's not, the plugin may build the tool from source (tools with git-ref installation support likely do this).

As I understand, AWS CLI v2+ ships it's own version of python in pre-built packages. So either the plugin needs to handle installation of v2+ different to v1 and no longer rely on the system python to build (which in this case is probably in the global .tool-versions).

As for

is there a way to use a locally defined tool inside a plugin?

What version is the "local" version and who is defining it? Is this defined by the plugin, by the tool being installed or by you the installer of the tool? What is it local to?

@jthegedus
Copy link
Contributor

jthegedus commented May 8, 2021

To clarify, the reason I marked this as a bug is because elsewhere in asdf we resolve items in .tool-versions line by line, top to bottom. We should be consistent and alphabetical resolution goes against that.

The solve for this is to ensure

  • asdf install resolves .tool-versions line by line

@lifeiscontent
Copy link

@jthegedus Makes sense. At the time of writing I was thinking local to the folder you execute in. E.g. I'm in project-a and I've defined a python version in .tool-versions so I'd expect that one to be used if no python executable is found. Resolution could be recursive. Shell -> Local -> Global -> System

@jthegedus
Copy link
Contributor

jthegedus commented May 9, 2021

Resolution could be recursive. Shell -> Local -> Global -> System

The resolution order is (from memory) Shell > .tool-versions in current dir and each dir up to the global .tool-versions file. system can be set in .tool-versions for a tool to fallback to the System installed version, or if no tool is found in .tool-versions, it fallsback to System.

@lifeiscontent this GitHub Discussion topic is relevant - https://github.com/asdf-vm/asdf/discussions/845

@lifeiscontent
Copy link

lifeiscontent commented May 13, 2021

@jthegedus thats awesome, so if that is the case, that is not what is happening when installing awscli ~ Major version 1 which I believe is due to running some commands in a sub directory.

@lifeiscontent
Copy link

@jthegedus
Copy link
Contributor

@lifeiscontent you should look at this interesting plugin someone has made - https://github.com/asdf-vm/asdf/discussions/980

@Stratus3D Stratus3D added this to the v0.9.1 milestone Dec 3, 2021
@tony
Copy link

tony commented Jul 12, 2022

@lifeiscontent you should look at this interesting plugin someone has made - https://github.com/asdf-vm/asdf/discussions/980

Any idea why this is a 404?

An area where I got snagged just now: asdf-poetry installing before asdf-python

tony added a commit to tony/.dot-config that referenced this issue Jul 12, 2022
This may have no point to it if they run randomly / the behavior isn't
defined.

See also: asdf-vm/asdf#929
@jthegedus jthegedus removed this from the v0.10.0 milestone Jul 12, 2022
@jthegedus jthegedus added the priority asdf core intend to resolve soon label Jul 12, 2022
@jthegedus
Copy link
Contributor

Any idea why this is a 404?

It's a 404 because we turned off GitHub Discussions

On area where this got me: asdf-poetry installing before asdf-python

That is unfortunate. Sorry about this. I have marked this as a priority to be fixed, though, as always, PRs are welcome!

@1oglop1
Copy link

1oglop1 commented Aug 8, 2022

I also build a plugin for another package manager PDM https://github.com/1oglop1/asdf-pdm and the installation is the same as poetry -> pipe .py into python and the same as others the installation order breaks it.

I'm happy to contribute PR if you can give me some pointers on where to start reading the code to save me some time.

@jthegedus
Copy link
Contributor

Related #1127

hdkshingala added a commit to fluxninja/aperture that referenced this issue Jun 27, 2023
### Description of change

Due to asdf-vm/asdf#929, `go-jsonnet` fails as
it is installed before `golang`.

**Bug fix:**
- Fixed an ordering issue with `go-jsonnet` installation
- Updated `gcloud` version from `429.0.0` to `436.0.0`
- Modified the order of dependencies in `.tool-versions`
- Changed the `install_plugins` function in
`scripts/install_asdf_tools.sh` to install plugins in the specified
order

> 🎉 A bug we did chase, now fixed in place,
> Dependencies aligned, their order refined,
> With gcloud updated, and plugins awaited,
> Our code stands strong, as we march along! 🚀
oguzhanmeteozturk added a commit to oguzhanmeteozturk/asdf that referenced this issue Aug 17, 2023
Modified the install_local_tool_versions function to prioritize the order of tools as specified in the .tool-versions file. Previously, the order of installed plugins was used.

Closes asdf-vm#929.
@dchenbecker
Copy link

Just to add another data point: the markdownlint-cli2 plugin requires a nodejs install. If you haven't installed nodejs, the command asdf install markdownlint-cli32 latest happily runs and does nothing.

@chrisjpalmer
Copy link

Made a PR here to address this. #1723 If interested, let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug priority asdf core intend to resolve soon
Projects
None yet
Development

No branches or pull requests

8 participants