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

uv self update command cannot be used inside the devcontainer #54

Open
gbaian10 opened this issue Feb 6, 2025 · 4 comments
Open

uv self update command cannot be used inside the devcontainer #54

gbaian10 opened this issue Feb 6, 2025 · 4 comments

Comments

@gbaian10
Copy link

gbaian10 commented Feb 6, 2025

I recently started learning to use devcontainer, and this repo has taught me a lot.


The UV built and copied into the container in multiple stages cannot execute the uv self update command.

If continue with the current approach, rebuilding the entire devcontainer might be the only way to upgrade the UV version?

I ultimately chose to use onCreateCommand to install UV, so I can use uv self update to upgrade the UV version.

"onCreateCommand": "curl -LsSf https://astral.sh/uv/install.sh | sh",
"updateContentCommand": "uv self update",
"postCreateCommand": "uv sync --frozen",

Also, I'm not quite sure about the trigger timing for updateContentCommand, so I'm not sure if writing it this way is correct.


I wonder if you think the approach mentioned above is appropriate?

@a5chin
Copy link
Owner

a5chin commented Feb 7, 2025

Thank you for your issue!

If the following settings are made, uv self update command can be executed, but this time it is not recommended because it will cause a bug that prevents the installation of certain libraries.

"onCreateCommand": "curl -LsSf https://astral.sh/uv/install.sh | sh",
"updateContentCommand": "uv self update",
"postCreateCommand": "uv sync --frozen",

As you point out, uv self update command is not expected in this repository.
I used ghcr.io/astral-sh/uv image, so I'm waiting for the image side to be supported.

Therefore, I recommend upgrading uv by restarting the devcontainer as is.

@gbaian10
Copy link
Author

gbaian10 commented Feb 7, 2025

It will cause a bug that prevents the installation of certain libraries.

Is there an example that package can be built using image copy, but cannot be built using command install?

@a5chin
Copy link
Owner

a5chin commented Feb 8, 2025

For example, an error occurred when executing the following command (I have the impression that there are many ML-related library installations) was executed.
As I recall, the error message was something along the lines of “Cargo is not installed”.

uv add transformers[ja,sentencepiece,torch]

@gbaian10
Copy link
Author

gbaian10 commented Feb 8, 2025

I've recently encountered a similar issue, but copying from the Dockerfile still didn't resolve it.

uv add py-rust-stemmers

The error message indicates that cargo cannot be found.

  × Failed to build `py-rust-stemmers==0.1.3`
  ├─▶ The build backend returned an error
  ╰─▶ Call to `maturin.build_wheel` failed (exit status: 1)

      [stdout]
      Running `maturin pep517 build-wheel -i /home/vscode/.cache/uv/builds-v0/.tmpZrZr2G/bin/python --compatibility off`

      [stderr]
      💥 maturin failed
        Caused by: Cargo metadata failed. Do you have cargo in your PATH?
        Caused by: No such file or directory (os error 2)
      Error: command ['maturin', 'pep517', 'build-wheel', '-i', '/home/vscode/.cache/uv/builds-v0/.tmpZrZr2G/bin/python', '--compatibility', 'off'] returned non-zero exit status 1

      hint: This usually indicates a problem with the package or the build environment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants