-
Notifications
You must be signed in to change notification settings - Fork 900
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 and manage Python interpreters #2607
Comments
This is on our roadmap :) |
Also looking forward to this! |
Consider the possibility to specify the required python version via a |
I just want to chime in to say that I'm evaluating Whenever somebody tells me I have to use a specific version of Python, it sucks the life right out of me. I know there are tools for this. I know I use pip or poetry. I know I'm going to lose an hour figuring it all out, just like last time.... So, from my perspective, as a long-time Python dev, but an occasional installer of Python, I'd love to see this! Thank you for the great tool. Impressive stuff. |
We agree it's awfully painful to install and manage multiple Python versions across platforms. We'll be tackling this problem soon. |
In terms of roadmap, is there any particular release that should have it or is it still the indeterminate future? I'd love to get rid of pyenv and need to set appropriate expectations 👀 |
@zanieb It's been another half month, how's the progress going, is there a preview version? |
…4138) Extends #4121 Part of #2607 Adds support for managed toolchain fetching to `uv venv`, e.g. ``` ❯ cargo run -q -- venv --python 3.9.18 --preview -v DEBUG Searching for Python 3.9.18 in search path or managed toolchains DEBUG Searching for managed toolchains at `/Users/zb/Library/Application Support/uv/toolchains` DEBUG Found CPython 3.12.3 at `/opt/homebrew/bin/python3` (search path) DEBUG Found CPython 3.9.6 at `/usr/bin/python3` (search path) DEBUG Found CPython 3.12.3 at `/opt/homebrew/bin/python3` (search path) DEBUG Requested Python not found, checking for available download... DEBUG Using registry request timeout of 30s INFO Fetching requested toolchain... DEBUG Downloading https://github.com/indygreg/python-build-standalone/releases/download/20240224/cpython-3.9.18%2B20240224-aarch64-apple-darwin-pgo%2Blto-full.tar.zst to temporary location /Users/zb/Library/Application Support/uv/toolchains/.tmpgohKwp DEBUG Extracting cpython-3.9.18%2B20240224-aarch64-apple-darwin-pgo%2Blto-full.tar.zst DEBUG Moving /Users/zb/Library/Application Support/uv/toolchains/.tmpgohKwp/python to /Users/zb/Library/Application Support/uv/toolchains/cpython-3.9.18-macos-aarch64-none Using Python 3.9.18 interpreter at: /Users/zb/Library/Application Support/uv/toolchains/cpython-3.9.18-macos-aarch64-none/install/bin/python3 Creating virtualenv at: .venv INFO Removing existing directory Activate with: source .venv/bin/activate ``` The preview flag is required. The fetch is performed if we can't find an interpreter that satisfies the request. Once fetched, the toolchain will be available for later invocations that include the `--preview` flag. There will be follow-ups to improve toolchain management in general, there is still outstanding work from the initial implementation.
Hi! There's now "preview" support for fetching and managing Python toolchains for you. I'll be working on documentation for the feature this week and there's quite a bit of work to be done before it's production-ready, but |
Awesome @zanieb, excited to try it out! |
You say "preview", I read "already in prod 😎". Jk, but I'm gonna use it on my personal box and see how it goes ❤️ |
@zanieb It's awesome, I tried it out, and everything works fine.
Is it possible to use a |
Is there a way to put the |
|
We basically do this now, so I'm going to close this issue. We plan to add |
This is super nice! One small point, the help is missing / incomplete for the venv part. I had to read here and try my best guess that I can actually do this line:
I think this line is the best thing which has happened to the Python ecosystem in the last 10 years, please advertise it and put it in huge texts, it's amazing! |
Thanks! There's https://docs.astral.sh/uv/guides/install-python/#viewing-python-installations maybe we could include it there. Ideally you just use |
I'm always setting up a venv for every single one of my projects, and I think it's a best practice among Python devs. It's great to hear that I can get rid of pyenv + .python-version files with the new uv versions. |
@hyperknot uv creates venvs automatically. I don't think any of the higher-level commands (the stuff released in 0.3.0, i.e. everything except You can make a venv manually before running Example: > uv init
Initialized project `uv-test`
> uv add cowsay
Using Python 3.12.4
Creating virtualenv at: .venv
Resolved 2 packages in 213ms
Prepared 1 package in 25ms
Installed 1 package in 5ms
+ cowsay==6.1
> uv run python -m cowsay -t hello
_____
| hello |
=====
\
\
^__^
(oo)\_______
(__)\ )\/\
||----w |
|| || |
But I'm not getting something. I don't want to init and add, that's the easy part. I want a reproducible dev environment, which cleans up and sets everything up for me. Here is the file I'm using in all my projects, I call this file with
+ I pair it with direnv so that it auto-activates when I'm inside the directory. How would alternative |
uv venv
accepts a--python
flag that allows the user to specify a path to a particular Python interpreter or version if it is already installed on the machine. I would like foruv
to install and manage Python for me, similar toconda create --name env-name python=3.9
.I am really enjoying using
uv
so far. Keep up the good work!The text was updated successfully, but these errors were encountered: