Notes for myself. Updated 6/25/2025.
Tools we’ll set up are, in order:
- uv
- python
- (optional) pipx
- (optional) poetry & poetry-auto-export
- nox
- Github CLI tool (see this post)
Assumptions:
- Your are on a linux cluster and you home directory has limited space. If not, then you may skip the
.bashrc
modifications. - Your system’s default Python version is out of date, or is unavailable.
- The projects you work on are configured to work with Poetry
- You need to keep
requirements.txt
synced with yourpyproject.toml
due to various reasons (e.g., for production)
Set up your home directory
If you ever see “disk quota exceeded” issues, run du -h --max-depth=1 ~
to inspect your home directory for large, space-hogging folders. One common offender is the .cache
directory. Before we get started, set up a symlink for your home .cache
directory in case of space restrictions:
# First, make a copy of your original .cache folder
cp -r ~/.cache <my_unrestricted_dir>/.cache
# Then remove the original
rm -r ~/.cache
# Create a symlink
ln -s <my_unrestricted_dir>/.cache ~/.cache
Check to make sure this worked:
ls -la ~/.cache
You should see something like .cache -> <my_unrestricted_dir>/.cache
Installing the tools
Important: in each of the following steps, run source ~/.bashrc
to load in any changes you have made to the .bashrc
file.
1. Install uv using the standalone installer.
We’ll use uv
as our Python version manager. First, add this to your .bashrc
file
# modify MY_HOME as you see fit
MY_HOME="/usr/<my_username>"
export UV_PYTHON_INSTALL_DIR="$MY_HOME/uv/python"
Make sure you have write permission to MY_HOME
Then install using the standalone installer.
curl -LsSf https://astral.sh/uv/install.sh | sh
For advance options, see the docs.
Verify the installation with
uv --version
If you run into invalid peer certificate: UnknownIssuer solution
issues, run
export SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt
in console then try again.
2. Install python 3.10
Scenario 1: You do not have admin access – use uv
I’m specifying the python version here due to the Poetry-auto-export dependecy requirements. It will work with Python versions 3.10 or higher.
The --preview
option installs Python executables into your PATH:
uv python install 3.10 --preview
This will install a Python executable for the requested version into ~/.local/bin
, e.g., as python3.10
Lets verify the installation. Open a new terminal. Type
which python3.10
and this should return something like:
.local/bin/python3.10
Scenario 2: You do have full admin access – use apt
Or if you’re setting up a new system, and your system does not have any python versions installed.
Add the following repository
sudo add-apt-repository ppa:deadsnakes/ppa
Update apt
sudo apt update
Install your desired python version
sudo apt install python3.12
Scenario 3: You have multiple versions of python installed
And you want to manage the default python version (source).
Let’s say you have both python3.10 and python3.12 installed. First, create symbolic links:
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.10 1
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.12 2
Then choose the default using
sudo update-alternatives --config python
3. (Optional) Install pipx
Modify pipx installation directory and where pipx installs packages by adding the following to your .bashrc
:
export PIPX_BIN_DIR="$MY_HOME/pipx/bin"
export PIPX_HOME="$MY_HOME/pipx"
export PATH="$PIPX_BIN_DIR:$PATH"
Then install using Python 3.10. All actions made via pipx
will use this Python version.
python3.10 -m pip install --user pipx
python3.10 -m pipx ensurepath # adds pipx to your path
sudo pipx ensurepath --global # optional to allow pipx actions with --global argument
Very the installation with
pipx --version
4. (Optional) Install Poetry with the offical installer.
We want to use python 3.10 or higher due to the Poetry plugins we want to use.
Add to your .bashrc
:
export POETRY_HOME=$MY_HOME/pypoetry
Then install Poetry, (optionally) specifying the Poetry version and Python version:
curl -sSL https://install.python-poetry.org | POETRY_VERSION=1.8.4 python3.10 -
or if you want to use pipx
pipx install poetry==1.8.4 --python python3.10
verify with
poetry --version
Optional Poetry Configs
By default, Poetry creates virtual environments in a cache directory (e.g., ~/.cache/pypoetry/virtualenvs
on Linux/macOS or C:\Users\<username>\AppData\Local\pypoetry\Cache\virtualenvs
on Windows). To gain creater control and keep track of my virtual enviromnents, I prefer them to be created within my project directory:
poetry config virtualenvs.in-project true
5. Install poetry-auto-export
poetry self add poetry-auto-export
or if you use pipx
pipx inject poetry poetry-auto-export
verify with:
poetry self show plugins
you should see the above plugins listed.
(Optional) 6. Install nox
Nox helps with testing and scripting
pipx install nox
verify with:
nox --version
Bashrc changes
Your .bashrc
should have the additional lines:
export MY_HOME="/<username>"
export POETRY_HOME=$MY_HOME/pypoetry
export PATH="$MY_HOME/pypoetry/bin:$PATH"
export PIPX_BIN_DIR="$MY_HOME/pipx/bin"
export PIPX_HOME="$MY_HOME/pipx"
export PATH="$PIPX_BIN_DIR:$PATH"
export UV_PYTHON_INSTALL_DIR="$MY_HOME/uv/python"
# add bin directory to path
. "$HOME/.local/bin/env"
Hope these notes helped you set up your dev machine! I suppose the alternative is to publish a docker image with all these tools pre-installed, but is that really necessary?
Changelog: 2025-06-26: Made Poetry optional; added link to GH CLI tool.