1. Installing Python 3.9 using Anaconda/Miniconda3
If you don't have Python installed on your PC, you can choose either of the following solutions to get one. If you do have Python 3.9, please navigate to the second part to install and verify the required packages.
Anaconda / Miniconda
Both Anaconda and Miniconda use conda syntax, while the first one has many scientific packages pre-installed (requires >3GB disk space) and the second one only installs conda, Python and few necessary packages.
For MacOS users:
Choose either Anaconda or Miniconda3:
Anaconda
1) Open this official link. Do not click the "Download " at the first glance! Navigate to the bottom of the webpage, you will see "Anaconda Installers" section. In "MacOS" column, choose and download the installer fits your CPU architecture.
2) Open the graphic installer to install Anaconda if you chose the graphical installer. Otherwise, open the terminal where you downloaded the installer, and run: bash Anaconda3-ver-MacOSX-arc.sh
(change the file name to the installer file you've downloaded).
Detailed guidelines for installing is available here.
3) Restart your shell exec $SHELL
or just fully restart your terminal. You should see "(bash)" in the front of your shell prompt, which indicates "conda" is active.
Miniconda (Recommended)
1) Open this official link. Navigate to "MacOS installers" section, then choose Python3.9 and download the installer fits your CPU architecture. "pkg" files are the graphical installers, while "bash" files are the command line installers.
2) Open the graphical installer if you downloaded "pkg" file, otherwise, open the terminal where you downloaded the installer, and run: bash Miniconda3-ver-MacOSX-arc.sh
(change the file name to the installer file you've downloaded).
Detailed guidelines for installing is available here.
3) Restart your shell exec $SHELL
or just fully restart your terminal. You should see "(bash)" in the front of your shell prompt, which indicates "conda" is active.
Verifying the base environment
- Make sure the Conda environment is correct by checking the "(base)" indicator in front of the terminal prompt if you use a separate environment.
- Run:
conda info
to see the environment details
For Windows users:
Choose either Anaconda or Miniconda3:
Anaconda
Check the following link and download the Anaconda Windows installer.
Miniconda (Recommended)
Check the following link and download the Miniconda3 Windows installer.
After installation if finished there must be shortcuts available in Windows Start Menu, depending on what package have you chosen, one of the following will be available:
- Anaconda prompt
- Miniconda3 prompt
Verifying the base environment
- Open either Anaconda or Miniconda3 prompt
- Make sure the Conda environment is correct by checking the "(base)" indicator in front of the terminal prompt if you use a separate environment.
- Run:
conda info
to see the environment details
Linux users:
Choose either Anaconda or Miniconda3:
Anaconda
Check the following link and download the Anaconda Linux installation script. NB! Pay attention to system architecture! (in addition to x86 and amd64, Linux can run on arm64, powerpc and etc.)
Miniconda (Recommended)
Check the following link and download the Miniconda3 Linux installation script. NB! Pay attention to system architecture! (in addition to x86 and amd64, Linux can run on arm64, powerpc and etc.)
After downloading the installer script, execute it and install the package.
- It is OK to install in user space (no root or sudo permissions required).
- Open the terminal application in Linux
- In terminal window type
bash chosen-conda-linux.sh
, here chosen-conda-linux.sh is the location of the corresponding conda installer you have downloaded.
- Proceed with installation
- Agree on license
- Use default target directory
- Make conda environment activate by default
Verifying the base environment
- Open the terminal application in Linux
- Make sure the Conda environment is correct by checking the "(base)" indicator in front of the terminal prompt if you use a separate environment.
- Run:
conda info
to see the environment details
All OS:
2. Setting up conda environment
Assuming Anaconda or Miniconda3 is installed
- Open conda command prompt
- Update conda libraries in a base environment
conda update -n base conda
- Create a new conda environment for our course labs:
- call it dsum2023
- make python3.9 a default interpretor
conda create -n dsum2023 python==3.9
- Proceed to installing Packages
- Numpy
- Pandas
- Matplotlib
- Ipython
- Jupyter
3. Installing packages into conda evnironment
Assuming conda environment is setup and activated
- Install Numpy, Pandas, Matplotlib, Ipython and Jupyter
conda install numpy pandas matplotlib ipython jupyter
4. Package Testing
- Test it: run Ipython
python -m IPython
- Type commands:
import numpy as np np.__version__
- Should report at least 1.21.2
import pandas as pd pd.__version__
- Should report at least 1.5.0
import matplotlib matplotlib.__version__
- Should report at least 3.4.3
- Now try generating some data
X = np.arange(10)
- Plot it:
from matplotlib import pylab as plt plt.plot(X,X) plt.show()
- You should see the plot of f(x) = x
- if so close the window and
- quit Ipython
- Now you can proceed to lab manual
PyCharm option
Windows:
- After creating a project
- Go to Settings under File then select Project interpreter
- Click on add a new library "Plus symbol"
- Search for numpy, pandas and matplotlib and Install
- You are ready to go
MacOS: There is a small different
- After creating a project
- Go to Preferences under PyCharm then select Project interpreter
- Click on add a new library "Plus symbol"
- Search for numpy, pandas and matplotlib and Install
- You are ready to go