installation_win - tsuchiya-lab/Pytutorials GitHub Wiki

Python Installation for Windows 10/11

In this tutorial, we describe the installation of conda, a Python package and virtual environment manager and Visual studio code(VScode) for IDE.

Contents

Conda Installation

Conda is a defacto python package/environment manager for data science projects. It is usual to install Conda on a home directory, not on a system directory, because in principle, a virtual environment is a personalized space for a specific purpose to work with. So, basic guideline is to create a specific virtual environment for a project and install required packages onto it, and switch to that environment.

Installation of Conda

To Install conda, go to https://github.com/conda-forge/miniforge and download miniforge3 according to your hardware profiles:

Then double-click Miniforge3-Windows-x86_64.exe and install it. This is installed at the home directory.

Then reopen the command prompt and type

conda activate

If (base) appears on a head of shell prompt, which means the user is in a base environment, then the installation is successful.

To finish using conda, type

conda deactivate

Creation of Environment and Installation of packages

To demonstrate, we create an environment work0 and install the following packages

  • python=3.10 Python version 3.10 because many packages won't support the latest!
  • numpy Multi-dimensional array
  • scipy Scientific computing
  • pandas Data Analysis
  • matplotlib Visualization
  • seaborn Statistical Visualization
  • ipykernel With VSCode
  • jupyter With VSCode
  • rope

To create the environment work0 and install the above packages, type

conda create -n work0 python=3.10 numpy scipy pandas matplotlib ipykernel jupyter rope seaborn

After installation, type

conda env list

which shows something like:

# conda environments:
#
base                  *  C:\Users\someone\miniforge3
work0                    C:\/Users\someone\miniforge3\envs\work0

The environment with asterisk in this case base is a current active environment. To switch to work0 environment, type

conda activate work0

After activating work0 environment, you can additionally install other packages to this environment.

The user can add other packages later. For more information, check out Cheatsheet.

VSCode Installation

To install VSCode, type

winget install vscode

or manually download it from VSCode home and install it.

Then, open VSCode from a finder and install extensions Jupyter, Pylance, and Python.

Extension

Now you can launch vscode and then type Ctrl + Shift + P , choose Create: New Jupyter Notebook and select the kernel work0.

Spyder Installation(Optional)

spyder is a Matlab-like IDE, and sometimes useful. spyder is usually installed as a python package, so to install it on work0 environment, from a work0 activated terminal, type:

conda install spyder

To invoke spyder after installation, type:

spyder &

Spyder