What this guide covers
When you finish, each project has its own Python version and virtual environment, and the system Python is untouched. You need: the command line tools, plus Homebrew if you install that way.
Steps
Look at the system Python, but do not use it
/usr/bin/python3belongs to the system and the command line tools. System updates replace it, so installing packages into it is unstable and hard to clean up. This matters even more on a rented machine: keep the system as close as you can to the state the platform delivered it in, and put your whole environment inside your own user directory. At the end of the rental, deleting one directory leaves it clean.Option 1: install uv
Following the official uv installation docs, choose one of two ways:
curl -LsSf https://astral.sh/uv/install.sh | shor
brew install uv. The standalone install script puts the program in your user directory, and you upgrade it later withuv self update. A Homebrew install followsbrew upgradeinstead; the docs state thatuv self updateonly works for the standalone install. Neither way needs an administrator password.Install an interpreter and create a virtual environment with uv
uv python installinstalls the latest Python, anduv python listshows available and installed versions. Inside the project directory,uv venvcreates a virtual environment (and downloads an interpreter first if there is none). To see where interpreters and the cache are stored, runuv python diranduv cache dir. You will need these later when freeing disk space.Option 2: install pyenv
Following the official pyenv README: run
brew update, thenbrew install pyenv, then write these three lines into~/.zshrc:echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.zshrc echo '[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.zshrc echo 'eval "$(pyenv init - zsh)"' >> ~/.zshrcpyenv compiles Python on the machine, and the project requires the build dependencies to be installed first. The list is under "Suggested build environment" in its wiki. After that,
pyenv install <version>installs a version,pyenv global <version>sets the default, andpyenv local <version>inside a project directory sets the project version.Run builds and downloads in a session that survives a disconnect
Compiling a version with pyenv, or installing a large set of dependencies for a model project, takes a while. Disconnecting the remote desktop does not stop it, but closing the terminal window does. Run these commands inside a tmux session and reattach later to see the result. See keeping long tasks running.
Give unattended scripts the interpreter path inside the virtual environment
Scheduled jobs and jobs that start at login will not activate a virtual environment for you. The most reliable approach is to use the full path of the interpreter in the job config, for example
.venv/bin/python script.pyunder the project directory. That does not depend onsource activateor on the initialization in~/.zshrc.Lock dependencies into the repository; the environment itself needs no backup
Virtual environments and interpreters can be rebuilt at any time and are not worth backing up. What is worth taking with you is the dependency list (
pyproject.toml, a lock file orrequirements.txt) and.python-version. Once those are committed to your own repository, switching machines or ending the rental only means installing again. When disk space is tight,uv cache cleanclears the uv cache.
FAQ
Should I install both uv and pyenv?
No need. uv can download and manage interpreters by itself. Choose pyenv when an existing project depends on a pyenv workflow. If you do install both, watch the PATH order and confirm which one is in use with which python3.
What about Python libraries that have a graphical interface or need system permissions?
Libraries that involve permissions such as Screen & System Audio Recording or Accessibility need you to open System Settings in the remote desktop and grant access to the terminal or the relevant app when prompted. See screen control permissions.
The Python dependencies for running models are large and the disk is full. What can I do?
Clear caches and unused virtual environments first. Built-in storage cannot be increased during the rental term. If you need external storage, check with support first to arrange it. For configuration choices, see the plans page.
Related
- How to install Homebrew on a rented remote Mac mini and keep it maintained
- How to schedule and auto-start jobs with user-level LaunchAgents on a remote Mac mini
- How to check logs and disk space on a remote Mac mini
- iMessage, AppleScript and Shortcuts on a rented Mac mini: it runs, but Apple decides about your account
- How much RAM do I need for local LLMs on a Mac? Rent a Mac mini for a month before buying
Pricing and availability: see the plans page · Help center (中文) · Refund policy (中文) · Telegram Contact support