Skip to main content
To KTH's start page

KTH Ubuntu - Personal software installation

Some software can be installed in your personal home directory. This allows you to configure and manage applications independently of the global system settings.

For example, many Python packages can be installed with pip or pip3:

pip3 install --user --upgrade pip
pip3 install --user sklearn

Other applications may be compiled and installed manually, but you may need to specify a prefix. You can use whatever path you want, but using the directory $HOME/.local/share (as specified in the XDG Base Directory Specification ) is recommended.

configure --prefix=${HOME}/.local/share
make
make install

Note that .local is a hidden directory  (leading period / full stop). To see it, use ls -a or View > Show Hidden Files in the file manager.

Warnings about PATH

If you get warnings that "... /.local/bin is not on PATH", see "Old init files" below.

If pip/pip3 crashes with ImportError

Later versions of pip/pi3 are not compatible with Ubuntu's default version. If you get the error

Traceback (most recent call last):
  File "/usr/bin/pip3", line 9, in <module>
    from pip import main
ImportError: cannot import name 'main'

try calling the pip module from python (or python3) instead:

python -m pip install --user ...  ## instead of pip
python3 -m pip install --user ... ## instead of pip3

Applications that should use personal installation

Later Python version installed with pip and uv

Ubuntu's LTS releases rarely use the latest Python version. Replacing the default version may be possible, but could in the standard KTH environment cause problem with installed applications.

However, you can use the pip and uv package managers to install a later Python in your personal environment.

First, upgrade pip (but see the note on ImportError above) and use it to install uv.

python3 -m pip install --user --upgrade pip
python3 -m pip install --user uv
python3 -m uv python list

Then select a non-beta, non release candidate version of Python. At time of writing, 3.13 is the latest version.

python3 -m uv python install 3.13
# ln -s python3.13 ~/.local/bin/python3 ## Optional. See below!

To call this, use python3.13 – see which python3; which python3.13. In other words, "python3" will still call the system default version. You can override this by using the experimental flag --preview (or --preview-features python-install-default). But this may also make "python" call python3.13 – not python2 as some applications expect. Manually creating a symlink is recommended.

Also, note that many scripts are launched by the full path /usr/bin/python3 and will ignore all your local Python binaries. Others are launched with /usr/bin/env python3 which will use your local binaries.

Jupyter Notebook – web application to create and share documents

Installed with pip (for Python 2) or pip3 (Python 3). The application will use around 60MiB.

python3 -m pip install --user --upgrade pip
python3 -m pip install --user jupyter

The application will be placed in $HOME/.local/bin.

Miniforge – community-driven conda package manager.

The Anaconda Distribution from Anaconda, Inc. is (since 2020) commercial software, governed by the Anaconda terms of service . While this is free for individual use and academic resarch, there are situations where a KTH user would to purchase a commercial license in order. For this reason, we recommend only using the conda-forge channel on anaconda.org, not the defaults channel provided by Anaconda, Inc. / anaconda.com. (Other channels are available, but may use their own license.)

Miniforge is a minimal installer for conda maintained by the conda-forge community. The default installation (version 25.x) will use nearly 700MiB. It uses mamba, a reimplementation of the conda package manager.

Note: Downloads are unsigned. No checksums are provided by conda-forge, so you must trust the HTTPS download from GitHub. (Or build your own miniforge from source, which is not trivial.)

Before installing in your AFS home directory, use fs lq -human to make sure your AFS quota has enough space!

This installes the current (at time of writing) 25.3.x version. Modify to use your desired version.

wget -S "https://github.com/conda-forge/miniforge/releases/download/25.3.1-0/Miniforge3-$(uname)-$(uname -m).sh"
bash Miniforge3-Linux-x86_64.sh -b -p "$HOME/miniforge3"

To lauch the environment,

source ~/miniforge3/etc/profile.d/conda.sh
conda activate

This does not modify your personal shell settings to automatically initialize conda when you log in. You can thus activate different conda environments, e.g. for different courses. But more importantly, conda won't replace standard system tools such as kinit. (Miniforge will likely install the krb5 conda package, i.e. an MIT Kerberos-based Kerberos toolset.)

If you prefer to initialize the conda environment automatically, run the commands conda init and mamba shell init inside the environment.

Tensorflow – machine learning library

The default installation will use approx. 1500MiB.

Note: Documentation at www.tensorflow.org/install/pip  does not use the pip flag --user.

python3 -m pip install --user --upgrade pip
python3 -m pip install --user tensorflow  ## tensorflow[and-cuda] requires Python ≥ 3.9

Old init files / My ~/.local/bin is not on PATH

Either the access rights on your ~/.local are wrong (more below), or you have old init files.

When you log in, configuration files in your home directory will set up the environment. These files are often called "init files" or "dot files"; the latter since their names often start with a leading period (full stop) to make them hidden files .

The init files in your AFS home were created from templates when the account was created, sometimes decades ago. As AFS does not use standard permissions  (see AFS-README ), they are in a public subdirectory (readable by anyone), and symlinked from the home directory (where anyone can list a.k.a. lookup files but not read file contents).

In particular, some old templates did not include $HOME/.local/bin in the $PATH variable.

TL;DR – update your init files, by doing

cp /afs/kth.se/admin/accounts/prototype/.dotfiles.new/.bash_profile ~/.dotfiles/.bash_profile

You can also copy .bashrc but that is more often modified with personal settings. So make sure you don't have changes that you want to keep.

In addition, AFS access rights must allow system:anyuser to list (not read) files, in order to detect the bin directory. So also do

fs setacl ~/.local system:anyuser l

On next login, your ~/.local/bin should be in $PATH.