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

global pip (--system ...) doesn't work in GitHub Codespaces #3417

Closed
Malix-Labs opened this issue May 7, 2024 · 11 comments
Closed

global pip (--system ...) doesn't work in GitHub Codespaces #3417

Malix-Labs opened this issue May 7, 2024 · 11 comments
Labels
question Asking for clarification or support

Comments

@Malix-Labs
Copy link

Malix-Labs commented May 7, 2024

Bug

global pip (--system ...) doesn't work in GitHub Codespaces

System

  • VSCode:
    Version: 1.89.0
    Commit: b58957e67ee1e712cebf466b995adf4c5307b2bd
    Date: 2024-05-01T02:15:54.732Z
    Browser: Mozilla/5.0 (X11; CrOS x86_64 14541.0.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36
  • uv 0.1.39

Reproduce

  1. Open a GitHub Codespace
    • .devcontainer/devconainer.json:
       {
       	"name": "Python 3 on Debian 12",
       	"image": "mcr.microsoft.com/devcontainers/python:1-3-bookworm",
       	"features": {
       		"ghcr.io/va-h/devcontainers-features/uv:1": {}
       	}
       }
  2. Terminal input: uv pip install prettytable --system
    Note: prettytable is just an exemple

Logs

@Malix-off ➜ /workspaces/Fork (master) $ uv pip install prettytable --system
Resolved 2 packages in 2ms
error: Failed to install: prettytable-3.10.0-py3-none-any.http.whl (prettytable==3.10.0)
  Caused by: failed to create directory `/usr/local/lib/python3.12/site-packages/prettytable-3.10.0.dist-info`
  Caused by: Permission denied (os error 13)

Note: prettytable is just an exemple

@zanieb
Copy link
Member

zanieb commented May 7, 2024

Hi! It looks you don't have the necessary permissions to write to the system packages?

@zanieb zanieb added the question Asking for clarification or support label May 7, 2024
@charliermarsh
Copy link
Member

Probably works in pip because pip falls back to installing with --user if the site-packages directory isn't writeable.

@Malix-Labs
Copy link
Author

Hi! It looks you don't have the necessary permissions to write to the system packages?

Indeed, probably like that in GitHub Codespaces, you're right.

--user

Is that an equivalent for sync?

@Malix-off ➜ /workspaces/Fork (master) $ uv pip sync requirements.txt --user
error: pip-sync's `--user` is unsupported.

@charliermarsh
Copy link
Member

No, we don't support --user right now, since it can generally be replaced by a virtual environment. There are some open issues tracking it but we haven't committed to adding it.

@Malix-Labs
Copy link
Author

So what would be the workaround to pip sync without virtual environment (devcontainer is a good example)

@charliermarsh
Copy link
Member

I think you basically need to use a virtualenv in that case with uv right now. I believe you can use virtual environments in devcontainers? Like it is possible, right?

@blueraft
Copy link
Contributor

blueraft commented May 7, 2024

Running the devcontainer as the root user works for me.

 {
 	"name": "Python 3 on Debian 12",
 	"image": "mcr.microsoft.com/devcontainers/python:1-3-bookworm",
 	"features": {
 		"ghcr.io/va-h/devcontainers-features/uv:1": {}
        },
       	"remoteUser": "root"
 }

@Malix-Labs
Copy link
Author

I think you basically need to use a virtualenv in that case with uv right now. I believe you can use virtual environments in devcontainers? Like it is possible, right?

Yep, currently you need a venv to do that, and yep, it is definitely possible, but adds an unnecessary virtual environment bloat (since we're already in a containerized environment)

@Malix-Labs
Copy link
Author

No, we don't support --user right now, since it can generally be replaced by a virtual environment. There are some open issues tracking it but we haven't committed to adding it.

I didn't find any issue about it containing "user" "-u" "--user", do you know if it has been deleted?

@charliermarsh
Copy link
Member

#2077

@Malix-Labs
Copy link
Author

GitHub Codespaces probably doesn't let you access to the devcontainer system (immutability)

In the case of devcontainers, you probably indeed would want to use the --user flag (#2077)

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

No branches or pull requests

4 participants