Skip to main content
To KTH's start page 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 dot). To see it, use ls -a or View > Show Hidden Files in the file manager.

You may need to make sure your local $PATH contains $HOME/.local/bin, and the equivalent for $LIBRARY_PATH, $C_INCLUDE_PATH and other environment variables. This is usually done in $HOME/.bashrc or $HOME/.cshrc, depending on your shell. Unfortunately, many different templates have been used to create AFS home directories, and not all have checked for personal bin directories.

Example (.bashrc)

[[ -d "$HOME/bin" ]] && PATH="$HOME/bin:$PATH"
[[ -d "$HOME/.local/bin" ]] && PATH="$HOME/.local/bin:$PATH"

If pip/pip3 crashes with ImportError

Later versions of pip/pi3 are not compatible with Ubuntu's default version. This applies both to 16.04  and to 18.04 . 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

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.

Anaconda – conda package manager for personal installations

The default installation will use at least 3.5GiB, so make sure your AFS quota is sufficient for this or use Miniconda (below). See instructions at

but briefly (modify for your desired version):

wget 'https://repo.continuum.io/archive/Anaconda3-5.1.0-Linux-x86_64.sh'
## For SHA256 checksum, see https://docs.anaconda.com/anaconda/install/hashes/all
sha256sum -c <(echo "7e6785caad25e33930bc03fac4994a434a21bc8401817b7efa28f53619fa9c29 *Anaconda3-5.1.0-Linux-x86_64.sh")
bash Anaconda3-4.4.0-Linux-x86_64.sh -b -p "$HOME/anaconda3"

In order to run applications in the conda environment, you need to add it to $PATH, see docs.anaconda.com/anaconda/faq#distribution-faq-linux-path

Miniconda – minimal conda environment

The default installation will use approx. 400MiB.

wget 'https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh'
## For MD5 checksum, see https://repo.continuum.io/miniconda/
## but the checksum **may be for the wrong file**. In this case, it's for
##     Miniconda3-4.4.10-Linux-x86_64.sh
## which is the file pointed to by -latest-Linux-x86_64.sh (Feb 2018)
md5sum -c <(echo "bec6203dbb2f53011e974e9bf4d46e93 *Miniconda3-latest-Linux-x86_64.sh")
bash Miniconda3-latest-Linux-x86_64.sh -b -p "$HOME/miniconda3"

In order to run applications in the conda environment, you need to add it to $PATH, see conda.io/docs/user-guide/install/macos.html#install-macos-silent

Tensorflow – machine learning library

The default installation will use approx. 300MiB.

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

python3 -m pip install --user --upgrade pip
## URL from https://www.tensorflow.org/install/install_linux#the_url_of_the_tensorflow_python_package
## for Python 3.5, CPU only.
python3 -m pip install --user --upgrade "https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.5.0-cp35-cp35m-linux_x86_64.whl"