Setting up Anaconda & virtual environment#
Installing Anaconda#
Anaconda is a Python and R distribution. It aims to provide everything you need for data science “out of the box”.
Practice 5#
Make sure you are inside yourname
folder. Download the Anaconda installer by copying the following link and pasting it into your terminal.
Tip
wget
: download file
Expected output
Practice 6#
To see if you downloaded it correctly, try to list the contents of your folder now using ls.
Expected output
If you see Anaconda3-2022.05-Linux-x86_64.sh, this means you downloaded the file correctly.
Practice 7#
Using your mouse, you can select the installer file name and then copy it using Ctrl+C
. Then, use sh filename
to run the Anaconda installer.
Tip
sh *filename*
: execute/run file
Expected output
Practice 8#
Don’t install Anaconda in /home/*groupname*/anaconda3
. Set the installation folder to be /home/*groupname*/*yourname*/local/anaconda3
.
Expected output
Practice 9#
Start by typing source .bashrc
from the home folder to launch the shell instance. Then, use conda -V
and conda update conda
to update the current version.
Tip
source .bashrc
: launch an interactive shell instanceconda -V
: checkconda
is installed and in yourPATH
conda update conda
: checkconda
is up to date
Expected output
Setting up a virtual environment#
The main purpose of Python virtual environments is to create an isolated environment for Python projects. This means that each project can have its own dependencies, regardless of what dependencies every other project has.
Warning
Before you proceed, make sure all your teammates have finished Practice 5-9.
Practice 10#
Using conda
, make a new virtual environment (yournameenv
) and activate it.
Tip
conda create -n *yourenvname* python=3.x anaconda
: create new virtual environment with Python 3.x.conda activate *yourenvname*
: activate your virtual environment
Expected output
Practice 11#
Try to exit
the current server to go back to your computer. Try to enter again with up arrow, and re-activate your virtual environment. Finally, exit one more time.
Tip
exit
: exit the current active server
Expected output