Forums

Running Python 3.13.2 using UV

To my surprise, I found this worked.

  • Opened a bash console
  • installed uv using wget -qO- https://astral.sh/uv/install.sh | sh
  • created a project, uv init myproject
  • changed to that folder cd myproject
  • installed python, uv python install 3.13.2
  • opened REPL session uv run python - slow first time, very fast subsequently
  • returned to bash, and added a package, uv add numpy
  • opened REPL sessions again and imported numpy -slow first time, very fast subsequently, and used it for a bit
  • returned to bash, created a simple programme using vim, which imported numpy, generated some random numbers, and then output them
  • ran the programme using uv run myscript.py

Worth noting that uv created a .venv folder when I added a package. Didn't activate the virtual environment as uv does this automatically when running a script.

So, I wouldn't say this is necessarily legit, but it worked.

Cannot get it to use the correct Python from the RUN button even with a valid shebang line.

I use two tabs in my browser - one to use the "editor" and the other to run the code from the bash command line.

Run button would not work with uv installed python.

Yeh, as I posted in a follow-up comment earlier. Do you know how to fix that?

I was expecting the .venv folder Python binary to be used as referenced in the shebang line. That works from the command line.

Normally, I don't use the Run button anyway, preferring to run from a separate window/tab.

We may do something about it. Next system image will have uv installed by default.

Awesome.

One other thing to look out for: you won't be able to run websites with versions of Python that you've installed with uv. That will change when we roll out the new web infrastructure we've been working on so that we can support FastAPI, however. No timelines yet, but it's coming :-)

I hadn't got that far but had assumed it was the case. I am happy with just console based working, and happy to use tmux with vim in one pane and run code in another. Usually just trying small tasks out or using it to check code I paste to help beginners out.

PythonAnywhere is the only online Python service I've found I can access from my work environment when I want a break. Everything else is blocked (including VPS instances, REPLIT, etc).

I know there has been a long wait for many of us for the next major update and appreciate why you don't give deadlines (we don't where I work either). I am sure the update will be amazing.