Setting Up Conda in Windows: A Complete Guide#
Author: Bo Yuan (boy6@illinois.edu)
Course: STAT 530, Spring 2025
This tutorial will walk you through setting up Conda, Miniconda, or Miniforge in Windows, including installation, environment setup, and common troubleshooting steps.
Installation Options#
Miniforge (Recommended)#
Download Miniforge from: https://conda-forge.org/download/
Run the installer
Installation directory will typically be:
C:\Users\YourUsername\miniforge3
Miniconda (Alternative)#
Anaconda installation is in the same page with Miniconda , don’t install the wrong one.
Download Miniconda from: https://www.anaconda.com/download/success
Run the installer
Installation directory will typically be:
C:\Users\YourUsername\miniconda3
Anaconda (Full Distribution)#
Download Anaconda from: https://www.anaconda.com/download/success
Run the installer
Installation directory will typically be:
C:\Users\YourUsername\anaconda3
Setting Up PowerShell/CMD Integration#
Basic Setup#
Open PowerShell and run:
conda init powershell
conda init cmd.exe
Close and reopen PowerShell/CMD
You should see
(base)
at the start of your prompt
Common Errors and Solutions#
Error 1: “conda not recognized”#
If you see this error:
conda : The term 'conda' is not recognized as the name of a cmdlet, function, script file, or operable program. Check
the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ conda init powershell
+ ~~~~~
+ CategoryInfo : ObjectNotFound: (conda:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Solution:
Locate your installation directory (installation_name: miniforge3, miniconda3, or anaconda3)
Add these paths to your system environment variables:
C:\Users\YourUsername\[installation_name] C:\Users\YourUsername\[installation_name]\Scripts C:\Users\YourUsername\[installation_name]\Library\bin
To add environment variables:
Got to “Settings” → “System” → “About”
Click “Advanced system settings”
Click “Environment Variables”
Under “System variables”, find “Path”
Click “Edit” → “New”
Add each path
Click “OK” to save
Error 2: “Running Scripts is Disabled”#
If you see this error:
. : File C:\Users\YourUsername\Documents\WindowsPowerShell\profile.ps1 cannot be loaded because running scripts is disabled
on this system. For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:3
+ . 'C:\Users\YourUsername\Documents\WindowsPowerShell\profile.ps1'
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : SecurityError: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
Solution:
Open PowerShell as Administrator
Check current policy:
Get-ExecutionPolicy
Set new policy:
Set-ExecutionPolicy RemoteSigned
Type “Y” when prompted
Close and reopen PowerShell
Error 3: “mamba not recognized” after Miniforge Installation#
Run:
mamba --version
If you see this error after installing Miniforge:
mamba : The term 'mamba' is not recognized as the name of a cmdlet, function, script file, or operable program. Check
the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ mamba create -n stat530 python=3.10
+ CategoryInfo : ObjectNotFound: (mamba:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Solution:
First, check your current conda environments:
conda env list
If you see multiple base environments like this:
conda environments:
base * C:\Users\YourUsername\anaconda3
C:\Users\YourUsername\miniforge3
This means you have conflicting conda installations. To fix:
Deactivate current conda initialization:
conda init --reverse
Update your system environment variables:
Open System Properties → Advanced → Environment Variables
Under “System Variables”, find “Path”
Remove any paths containing “anaconda3”
Add or ensure these paths exist:
C:\Users\YourUsername\miniforge3 C:\Users\YourUsername\miniforge3\Scripts C:\Users\YourUsername\miniforge3\Library\bin
Close and reopen PowerShell
Reinitialize conda for Miniforge:
conda init powershell
Close and reopen PowerShell again
Verify the correct base environment:
conda env list
You should now see the Miniforge environment is activated now:
conda environments:
base * C:\Users\YourUsername\miniforge3
C:\Users\YourUsername\anaconda3
Now you can use mamba commands:
mamba create -n stat530 python=3.10
Managing Multiple Conda Installations#
If you have multiple conda installations (e.g., both Anaconda and Miniforge), you might see something like this:
# conda environments:
#
base * C:\Users\YourUsername\AppData\Local\anaconda3
env1 C:\Users\YourUsername\AppData\Local\anaconda3\envs\env1
C:\Users\YourUsername\AppData\Local\miniconda3
C:\Users\YourUsername\AppData\Local\miniconda3\envs\env2
To switch between installations:
Deactivate current conda initialization:
conda init --reverse powershell
Remove unwanted installation:
Open Windows Settings → Apps & Features
Search for the unwanted installation (e.g., “Anaconda”)
Uninstall
Remove remaining directory:
Remove-Item -Recurse -Force "C:\Users\YourUsername\AppData\Local\anaconda3"
Initialize desired conda:
C:\Users\YourUsername\[installation_name]\Scripts\conda.exe init powershell
Managing Auto-Activation#
To disable auto-activation of base environment:
conda config --set auto_activate_base false
To enable auto-activation:
conda config --set auto_activate_base true
Best Practices#
Choose one conda distribution and stick with it:
Miniforge: If you want conda-forge as default channel + mamba
Miniconda: If you want minimal installation
Anaconda: If you want full scientific distribution
Always check your environment before creating new ones:
conda env list
where conda
Close and reopen terminals after making environment changes
Use
RemoteSigned
execution policy for balance of security and usabilityKeep track of your environment locations
Regularly check
conda env list
to understand your setup
Setup Environment for the Class#
Create new environments for different projects:
conda create -n stat530 python=3.10
Activate environments:
conda activate stat530
Install Jupyter (make sure you are under stat530 environment before you do this):
pip install jupyter
Additional Resources#
Conda documentation: https://docs.conda.io/
Miniforge GitHub repository: conda-forge/miniforge
Miniconda documentation: https://docs.conda.io/en/latest/miniconda.html
Support#
If you encounter issues not covered in this guide:
Check the conda documentation
Run
conda info
for system informationLook for error messages in the conda output
Consult with TA (Bo Yuan: boy6@illinois.edu)