Anaconda to Create a Clean Python Environment

Courvoisier Balthazar ยท September 20, 2025

Setting up a clean and stable Python environment is essential for learning and working on projects. This guide will show you how to use Anaconda to do just that.

๐Ÿ What is Anaconda?

Anaconda is a free Python distribution that includes:

  • Python interpreter
  • Popular libraries like NumPy, pandas, matplotlib
  • Jupyter Notebook
  • conda environment manager

Itโ€™s ideal for students and beginners because it simplifies installation and avoids conflicts between projects. It is compatible with VS CODE ide. An official tutorial exist here.

๐Ÿ”ง Step 1: Install Anaconda

  1. Download Anaconda:
    ๐Ÿ‘‰ https://www.anaconda.com/download

  2. Choose your OS and download the Python 3.x (64-bit) version.

  3. Run the installer and follow the prompts:

    • (Optional) On Windows, check โ€œAdd Anaconda to my PATHโ€
    • Select โ€œJust Meโ€ and complete installation.

๐Ÿงช Step 2: Create a New Conda Environment

Open Anaconda Prompt (Windows) or Terminal (macOS/Linux):

conda create -n myproject python=3.10

๐Ÿ“‚ Step 3: Activate Your Environment

After creating the environment, you need to activate it:

conda activate myproject

๐Ÿ“š Step 4: Install Packages

Use conda install to install packages:

conda install numpy pandas matplotlib jupyter

If a package isnโ€™t available in the default conda channel, you can try conda-forge:

conda install -c conda-forge scikit-learn

Or even use pip inside the environment:

pip install seaborn

Now any Python packages you install will be isolated from your base installation.

๐Ÿ’ป Step 5: Use the Environment in VS Code

Anaconda integrates smoothly with VS Code. Once your environment is created, you can use it for both Jupyter notebooks and Python scripts.

๐Ÿ“ For Notebooks (.ipynb)

  1. Open VS Code.
  2. Install the extensions:
  3. Python (by Microsoft)
  4. Jupyter (by Microsoft)
  5. Open a .ipynb file or create a new notebook.
  6. In the top-right corner, select the kernel โ†’ choose your conda environment (myproject).

Now, your notebook cells will run inside the clean conda environment.

๐Ÿ“„ For Python Scripts (.py)

  1. Open a .py file in VS Code.
  2. Look at the bottom-right corner of VS Code โ†’ click on the interpreter selector.
  3. Choose the interpreter from your environment (it should appear as something like Python 3.10 (โ€˜myprojectโ€™)).

Once selected, running scripts (Run โ†’ Run Without Debugging or the green button) will execute in your conda environment.