Department of Engineering

IT Services

Python on CUED's central system

In the Linux system's "Applications" menu, in the Programming submenu there are options to run a python3 environment (with Spyder, etc) and an option to start a terminal window with paths set up ready to use python 3.

Typing /usr/local/apps/anaconda3/bin/python in a terminal window on a CUED Linux machine will run the Python interpreter that Mich term first years use in the cloud. There are many other versions of Python installed, so beware. Typing python3 will give you a similar version, but the choice of packages is different.

You can install private versions of packages. Let's suppose that you want to install a python3 package called ase

  • From a terminal window run
    /usr/local/apps/anaconda3/bin/pip3 install --user ase
    
  • which will install the package in a standard place in your own filespace.
  • python should by default look in this standard place in your own filespace for packages. If not, you'll need to tell it where to look by typing
      export PYTHONPATH=${PYTHONPATH}:${HOME}/.local/lib/python3.4/site-packages
    (the "3.4" may be different on your system) so that python will be able to find your packages. You'll need to do this at the start of each session unless you put the line in a file called .bashrc in your home folder.
  • If from the same terminal window you now run
      /usr/local/apps/anaconda3/bin/python
    you should find that
    import ase
    
    works. Alternatively you can run
      /usr/local/apps/anaconda3/bin/jupyter-notebook
    and the extra package will be available in notebook, spyder, etc.