Skip to content

Latest commit

 

History

History
52 lines (31 loc) · 2.27 KB

python_setup_instructions.md

File metadata and controls

52 lines (31 loc) · 2.27 KB

Python Setup Instructions (Local)

Setup

Installing Miniconda: We recommend using Miniconda which provides an easy way for you to handle package dependencies. Please be sure to download the Python 3 version.

Miniconda Virtual environment: Once you have Miniconda installed, it makes sense to create a virtual environment for the course. If you choose not to use a virtual environment, it is up to you to make sure that all dependencies for the code are installed globally on your machine. To set up a virtual environment, run (in a terminal)

conda conda env create --file environment.yml

to create a environment called tdt4265, where all the dependencies are described in environment.yml

Then, to activate and enter the environment, run

conda activate tdt4265

To exit, you can simply close the window, or run

conda deactivate tdt4265

Note that every time you want to work on the assignment, you should run conda activate tdt4265 (change to the name of your virtual env).

You may refer to this page for more detailed instructions on managing virtual environments with Anaconda.

Installing additional packages

Use pip to install additional packages as needed

pip install some_package

Note, By default, pytorch is installed with cpu only version. If you have a PC with NVIDIA GPU (Linux or windows) then you need to install pytorch and torchvision with cuda support. To do that, follow tutorial on the pytorch website https://pytorch.org/get-started/locally/.

Launching jupyter notebook

Once you have finished the environment setup, and installed the required packages, you can launch jupyter notebook with the command:

jupyter notebook

Then, if you open a jupyter notebook file (.ipynb), you will see the active environment in the top right corner. To change the kernel to the right environment select kernel -> change kernel -> Python tdt4265.

If your environment is not showing up in the list of kernels, you can take a quick look on this stackoverflow post.