Wiki
Kursus 10302

OPTIONAL: Install Python and IPython on your laptop.
Page last edited by Jakob Schiøtz (jasc) 05/02-2019

YOU DO NOT NEED TO INSTALL THIS - YOU CAN RUN EVERYTHING IN THE DATABAR.

INSTALLING PYTHON / JUPYTER ON YOUR LAPTOP IS OPTIONAL.

FOLLOW THESE INSTRUCTIONS AT YOUR OWN RISK

Python is a very flexible, easy-to-learn and widely used programming language.

IPython is a very convenient interactive interface to the Python programming language.  It is very similar to Mathematica and Maple notebooks, but runs in your browser.  It works by running a local web server (only accessible from your own computer) and then opening a browser window to that page.

Installing Linux on a Windows laptop so you can run Python and Jupyter notebook

1. Windows bash

2. Virtual Box (and install lubuntu lubuntu image )

Installing Python and Jupyter notebook on Linux

All Linux distributions that we are aware of already have Python installed.  

You will need to install scipy, matplotlib and ipython-notebook.  On most linux distributions this will pull in all other packages you will need.

On Ubuntu or other Debian based Linuxes, you can install the required packages by running these commands in a terminal:

sudo apt-get update

pip install jupyter --user --upgrade

pip install ase --user --upgrade

On other Linux distributions, you should search for packages with similar names.  Sometimes ipython-notebook is not a separate package, but part of the ipython package.

Installing Python and IPython on a Mac

Mac OS X is coming with Python pre-installed.  However, you will need to install a number of Python packages, and installing those into the system Python could potentially cause trouble.  At the very least, it makes uninstalling them exceedingly difficult.  For that reason, we recommend installing a secondary Python installation.

There are pre-packaged Pythons for Mac available (Anaconda, Enthought), they install everything you need for almost all used. However, if you are already using Homebrew to install stuff on your mac, then Anaconda will interfere with it.

Using Anaconda Python on a Mac

Get it from https://www.anaconda.com/distribution/

Then you can install ASE and GPAW with the command

         pip install ase gpaw

Using Homebrew on a Mac.

Installing Python and all packages is relatively easy using the package manager called Homebrew.  We recommend this method.

0. You need Apple's C compiler, if you do not already have it installed.  Try typing

gcc --version

and see what happens.  If you get a version number, you are fine to proceed.  If it offers to install "Xcode Command Line Tools", just do that.  If nothing happes (gcc not found) you will need to either install Apple's full, huge developper package (Xcode, many gigabytes, available in the app store), or just the command line tools.  The command line tools can be installed by typing

xcode-select --install

Note that this sometimes fails (not available).  This can be because xcode is already installed.  You may need to register as a developper with Apple to get access to these tools (I am not sure if that is still a requirement); it is free (if they try to charge 100$ it is because you somehow asked for permission to publish apps on the app store).

1. Make sure that /usr/local/bin is on the beginning of your path, by inserting this line into your .bash_profile file (create it if it is not there).

# Homebrew needs this:
export PATH=/usr/local/bin:$PATH

Open a new terminal window after doing this.

2. Install Homebrew.  

Go to http://brew.sh and copy the cryptic install command near the top of the page into a Terminal window.  Follow the instructions.

3. Install Homebrew's own version of Python.  This will prevent that you mess up the system Python installation.

brew install python

4. Check that you get the right version of Python - if not, you have done something wrong in step one. 

which python

This should give you /usr/local/bin/python, if it gives /usr/bin/python you MUST fix your path in your .bash_profile file before proceeding!

5. Install numpy, scipy, and matplotlib using Python's own package manager

            pip install numpy scipy matplotlib

 
6.  Install IPython.
 
The prerequisites are not installed as they should, so you have to install those manually.
pip install pyzmq
pip install jinja2
pip install tornado
pip install pygments
pip install ipython
pip install jupyter
 
 
Support: +45 45 25 74 43