Installing Python, Jupyter, etc
Download & install Anaconda
- Download Anaconda Python from https://www.anaconda.com/distribution/ Links to an external site. . The remarks below refer to the command line version of the installer.
- Run the installer, but first read through all of the remarks.
- If on Windows, you might need to run the downloaded installation file as administrator, depending on choice of installation directory (right-click the file, and click "Run as administrator").
- Do not use the default installation path if it contains spaces or other special characters. We do not know exactly when this could turn out to be an issue, but it is discouraged by Anaconda (more info here
Links to an external site.). For instance, if John Doe ran the installer, the default path might be
C:\Users\John Doe\Anaconda3
, which could be an issue since his username has a space in it. An alternative would beC:\anaconda3
, although this would probably require you to run the installation as administrator. - During the installation, make sure to select the option to add Anaconda to your PATH environment variable. As far as we know, this is usually not recommended by Anaconda and thus deselected by default.
- You do not need to "Register Anaconda as the default/system Python"
- After installation, run the command
conda init
(or optionallyconda init <SHELL_OF_YOUR_CHOICE>
), in order to setup conda to work properly with your command-line interpreter (terminal). You may have been asked for theconda init
step to be automatically carried out during installation, but if not it is essential that you do it manually, in order to be able to activate your Conda environment later. - Close all terminal windows currently open (the
conda init
step above will not have any effect on existing terminal windows, only on new ones).
Create a Conda environment and install Python dependencies
- Create a directory (folder) and navigate to it, download the conda-environment-files.zip Download conda-environment-files.zip
- Create the Conda environment for the course by typing
, where you substitute theconda env create -f conda-environment-files/conda-environment-cpu-<x>.yml
<x>
by eitherunix
orwin
, depending if you're following the instructions in a unix machine (Linux, Mac, etc), or a Windows one. - Wait for the installations to complete, and make sure there were no errors.
Activating and testing the Conda environment
- Now, you have created a virtual Conda environment with all Python dependencies installed. Still, in order to get access to this environment, you must activate it. This has to be done every time you start up a new terminal window. Activate it by the command
conda activate dml
. - You should now see
(dml)
printed at the start of every row in the terminal, indicating, that thedml
environment is activated. If this does not happen, most probably theconda init
step was not carried out successfully during installation. - Now you can start using Jupyter notebook. To do so, type
jupyter notebook
. Your web browser should automatically open up and navigate to http://localhost:8888 Links to an external site., letting you access Jupyter. - Please have a look at the two Jupyter notebooks, testing_notebook.ipynb and Getting started with JN.ipynb, available in the folder
python-crash-course Download python-crash-course
material. The first file checks if the installation was successful, whereas the second file gives you initial advice regarding how to use Jupyter notebooks. - To deactivate the conda environment, you simply type
conda deactivate
.
Update the Conda environment
If we, for some reason, need to update the conda environment files, you can update your environment with these steps:
- Make sure that you have the latest version of the environment file.
- Make sure the conda environment is deactivated (see above).
- Run
conda env update -f conda-environment-files/conda-environment-cpu-<x>.yml --prune
. Note that the appropriate environment file to be used varies depending on your system. See section below for more info. - Now you can activate the environment again.
CPU / GPU and Windows / Unix conda environment files
The zip file with the environment files contain several variants:
conda-environment-cpu-win.yml
conda-environment-cpu-unix.yml
conda-environment-gpu-win.yml
conda-environment-gpu-unix.yml
If you have a compatible Nvidia GPU, you can however try to make use of it by simply using the gpu
version of the file, and hopefully this will work well. It can however be quite a hassle to properly install a GPU-enabled deep learning environment. We will try to help you as much as possible, but remote support of GPU issues is not always easy.
If, while working in the cloud, you have reason to update the (pre-installed) conda environment, the conda-environment-gpu-unix.yml
file is always to be used.
You should now be all set to start using Python and Jupyter notebook. Whenever you want to use it, navigate to the directory you created, activate the environment, and start a Jupyter notebook.