Using Python on TSD workstations

How to use Python with your TSD project - commands, shortcuts, and package management.

Python is a popular programming language and computing environment that is broadly used for all manner of things, including scientific computing and as an application platform.

We can install Python for your project (one or multiple project workstations) on request.

We routinely install and maintain installations of both Python 2 and 3.

How do I use Python?

Using Python normally means using the Python interpreter and/or installing Python packages. Provided Python is installed on the project workstation, you should be able to:

  • Invoke the interpreter:
    • By typing python in the Command Prompt (Windows), PowerShell, or the shell in Linux
    • By using some appropriate "Python" shortcut as found in the Start Menu (Windows)
  • Install Python packages (from our mirror of the Python Package index)

How to install packages?

Pip, the most common package system for python, should be available on all systems where Python is installed. The command is pip3 for python 3.

The pip package repository (pypi) is mirrored in tsd and you may use pip as per their documentation. You can thus type pip in the Command Prompt on Windows or the shell on Linux, to install packages as otherwise instructed by some application's user guide, e.g:

pip3 install --user <package-name>

Use of --user above is required to instruct pip to install the package for your user account only, as opposed to installing it for all members of the project. Project members are not automatically (without our involvement) permitted to install packages or software for other users. If you absolutely need some packages installed for everyone, we will have to install these at your request.

How to upgrade packages?

This can be done by adding an extra flag to the installation command:

pip3 install --user --upgrade <package-name>

How to list available package versions?

By adding two equal signs at the end of a package's name (pip's syntax for requesting a specific version), but then not specifying anything there, pip will list all the available versions of this package:

pip3 install <package-name>==

Why do packages fail to install?

Statistically, most of our users may encounter that pip can't install a package because it cannot download something from the Internet.

Our installation of Python should normally configure pip to use our own mirror (a copy) of the Python package index (PyPi) that pip otherwise accesses directly. This makes it possible for you to use the entire Python package repository with pip even though project workstations are deliberately cut off from the Internet. This configuration, however, may occasionally be missing for a given project or a workstation, as we are developing TSD. In those cases, you may configure pip yourself to use the aforementioned mirror, or contact us for assistance.

How to fix the problem yourself

A way to have pip use our mirror and thus be able to install packages from PyPi, is to instruct it so with each invocation of pip, by using --index-url and the URL of the mirror:

pip3 install --user --index-url https://pypi.tsd.usit.no/simple <package-name>
 
Search the user manual
Contact support

Call us

Opening hours are weekdays from 08:30 to 17:00 and Saturdays from 10:00 to 15:00.

Phone number: 22 84 00 04

Register case

Your request can be sent to it-support@uio.no.

Send email

Book a Zoom meeting

Students and employees can book a Zoom meeting with UiO Helpdesk. Available hours are Tuesday to Thursday between 11:00 and 13:00.

Book a video call

Chat with us

Our chat is open every weekday between 09:00 and 16:00.

Start chat
Did you find what you were looking for?
By Armen Michaeli
Published June 21, 2021 10:57 AM - Last modified Feb. 14, 2023 9:31 AM