Getting Started with Miniconda
A beginner-friendly guide to Conda environments, isolated project setups, and the small workflow that prevents package conflicts from wrecking your Python projects.
Different projects need different Python and package versions.
Create one isolated Conda environment per project.
Never do real project work in the base environment.
The basic Conda workflow
- Create an environment
- Activate it
- Install packages inside it
- Do your work
- Export the environment when you need to share or rebuild it
What is Miniconda?
Miniconda is a minimal Conda installation. It includes Conda, Python, and a small set of core dependencies.
Unlike Anaconda, which installs a much larger collection of packages up front, Miniconda gives you only the basics and lets you install the rest yourself.
What is a Conda Environment?
A Conda environment is an isolated workspace for a project.
Each environment can have:
- its own Python version
- its own packages
- its own dependency graph
Project A
Python 3.10
numpy 1.26
Project B
Python 3.8
numpy 1.21Both environments can live on the same machine without conflicts.
Installing Miniconda
Installation changes slightly by operating system and CPU architecture.
macOS (Intel)
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh
bash Miniconda3-latest-MacOSX-x86_64.shmacOS (Apple Silicon: M1 / M2 / M3 / M4)
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-arm64.sh
bash Miniconda3-latest-MacOSX-arm64.shLinux
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.shWindows
Download the Windows installer and run it.
After installation, open a new terminal and verify Conda is available:
conda --versionA Typical Miniconda Workflow
conda create --name project1 python=3.10
conda activate project1
conda install numpy pandas
conda export --from-history --file environment.ymlThat is the basic pattern you will repeat constantly.
Creating an Environment
Always specify the Python version when you create an environment.
conda create --name myenv python=3.10Example:
conda create --name data-analysis python=3.11Activating and Deactivating Environments
Activate an environment:
conda activate myenvYour shell prompt will usually change to show the active environment:
(base) user@computer % conda activate myenv
(myenv) user@computer %Deactivate it with:
conda deactivateInstalling Packages
Install packages inside the active environment.
conda install numpy pandas matplotlibConda will resolve dependencies for you.
If a package is not available through Conda
You can use pip inside the environment:
pip install somepackageListing and Removing Environments
List environments:
conda env listRemove an environment:
conda env remove --name myenvExporting and Recreating Environments
If you want to share an environment or rebuild it later, export it to a file.
Recommended for new projects
conda export --from-history --file environment.ymlThis keeps the file cleaner by recording the packages you explicitly asked for, instead of every fully resolved package in the environment.
Still supported
conda env export > environment.ymlRecreate the environment
conda env create -f environment.ymlCommon Beginner Mistakes
Installing packages in base
Avoid using base for actual project dependencies. Create a new environment instead.
Forgetting to activate the environment
If the environment is not active, packages may install somewhere you did not intend.
Mixing pip and conda randomly
This is one of the fastest ways to make environments harder to reproduce.
Useful Commands
| Task | Command |
|---|---|
| Check Conda version | conda --version |
| Create environment | conda create --name myenv python=3.10 |
| Activate environment | conda activate myenv |
| Deactivate environment | conda deactivate |
| Install packages | conda install numpy pandas |
| List environments | conda env list |
| Export environment | conda export --from-history --file environment.yml |
| Recreate environment | conda env create -f environment.yml |
| Remove environment | conda env remove --name myenv |
conda create --name myenv python=3.10
conda activate myenv
conda install numpy pandas
conda export --from-history --file environment.yml
conda deactivateFrequently Asked Questions
What is the difference between Conda and Miniconda?
Conda is the package and environment manager. Miniconda is the minimal installer that gives you Conda plus Python and core dependencies.
Is Miniconda better than Anaconda?
Miniconda is usually better if you want a smaller install and tighter control over what gets added to your machine.
Can Conda manage non-Python packages?
Yes. Conda can manage more than Python libraries, including some system-level dependencies and packages from other ecosystems.
Should I use pip or Conda?
Use Conda first. Use pip only when the package is not available through Conda.
Conclusion
The core Miniconda workflow is simple:
Create one environment per project. Pick the Python version explicitly. Install packages inside the environment. Export the environment when you need to share or rebuild it.
Once that habit becomes normal, dependency conflicts become much easier to manage.
Comments