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

Flag for --system-site-packages when initializing venv #260

Open
foges opened this issue Jan 29, 2025 · 2 comments
Open

Flag for --system-site-packages when initializing venv #260

foges opened this issue Jan 29, 2025 · 2 comments

Comments

@foges
Copy link

foges commented Jan 29, 2025

We need to initialize our virtual environment with --system-site-packages (for torch). I can't seem to find a way to do it with this setup-uv github action. Am I missing something? If not it would be great to add this.

@eifinger
Copy link
Collaborator

eifinger commented Jan 29, 2025

Hi. I need to rehaul the whole venv activation stuff because it is currently not covering all usecases and a bit tricky to get right. Can you please provide more information on your usecase? A full example of your current workaround would be quite helpful. I am imagining that you can initialize the venv manually in a way like #124 (comment)

@foges
Copy link
Author

foges commented Jan 29, 2025

Hey @eifinger. Yes, I do a similar thing. The use-case is that many machine learning libraries (eg. torch, flash-attn, triton, etc..) need to be installed in system site packages (and are often part of pre-built Nvidia docker images).

The GHA looks like this:

      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with:
          python-version: 3.11
      - name: Install PyTorch
        run: pip install torch
      - name: Install uv
        uses: astral-sh/setup-uv@v5
      - name: Set up uv venv and sync packages
        run: |
          uv venv --system-site-packages --python 3.11
          uv sync --all-packages

The top-level pyproject.toml then looks like this

[tool.uv]
package = false
override-dependencies = [
    "torch; sys_platform == 'never'",
    ...
]

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