You are helping the user list conda environments and work with them to add packages.
List and manage Conda environments, install packages, and create environment files. Use when working with Python projects that need isolated dependencies.
/plugin marketplace add danielrosehill/linux-desktop-plugin/plugin install lan-manager@danielrosehillYou are helping the user list conda environments and work with them to add packages.
Check if conda is installed:
which conda
conda --version
conda info
If not installed, offer to help install Miniconda or Anaconda.
List all conda environments:
conda env list
# or
conda info --envs
This shows:
Show current environment:
echo $CONDA_DEFAULT_ENV
conda info --envs | grep "*"
Display detailed environment information: For each environment, show:
# List packages in specific environment
conda list -n <env-name>
# Show environment details
conda env export -n <env-name>
# Show size
du -sh ~/miniconda3/envs/<env-name>
# or
du -sh ~/anaconda3/envs/<env-name>
Ask user which environment to work with: Present the list and ask which environment they want to modify or examine.
Activate environment:
conda activate <env-name>
Verify activation:
conda info --envs
python --version
which python
Show packages in environment:
conda list
# or for specific environment
conda list -n <env-name>
# Show only explicitly installed packages
conda env export --from-history -n <env-name>
Search for packages: Ask what packages user wants to install:
conda search <package-name>
conda search <package-name> --info
Install packages:
Single package:
conda install <package-name>
# or specify environment
conda install -n <env-name> <package-name>
Multiple packages:
conda install <package1> <package2> <package3>
Specific version:
conda install <package-name>=<version>
# Example:
conda install python=3.11
conda install numpy=1.24.0
From specific channel:
conda install -c conda-forge <package-name>
Suggest common packages by category:
Data Science:
conda install numpy pandas matplotlib seaborn scikit-learn
conda install jupyter jupyterlab notebook
conda install scipy statsmodels
Machine Learning:
conda install tensorflow pytorch torchvision
conda install keras scikit-learn xgboost
conda install -c conda-forge lightgbm
Development:
conda install ipython black flake8 pytest
conda install requests beautifulsoup4 selenium
conda install flask django fastapi
Visualization:
conda install matplotlib seaborn plotly
conda install bokeh altair
Database:
conda install sqlalchemy psycopg2 pymongo
conda install sqlite
Update packages:
Update specific package:
conda update <package-name>
Update all packages in environment:
conda update --all
Update conda itself:
conda update conda
Remove packages:
conda remove <package-name>
# or from specific environment
conda remove -n <env-name> <package-name>
Create new environment: Offer to create a new environment:
# Basic environment
conda create -n <env-name> python=3.11
# With packages
conda create -n myenv python=3.11 numpy pandas jupyter
# From file
conda env create -f environment.yml
Export environment: Help user export environment for sharing:
Full export (with all dependencies):
conda env export -n <env-name> > environment.yml
Only explicitly installed packages:
conda env export --from-history -n <env-name> > environment.yml
As requirements.txt:
conda list -n <env-name> --export > requirements.txt
Clone environment:
conda create --name <new-env> --clone <existing-env>
Clean up conda:
# Remove unused packages and caches
conda clean --all
# Remove packages cache
conda clean --packages
# Remove tarballs
conda clean --tarballs
# Check what would be removed
conda clean --all --dry-run
Check environment conflicts:
# Check for broken dependencies
conda info <package-name>
# Verify environment
conda env export -n <env-name> | conda env create -n test-env -f -
Show environment size:
# Size of all environments
du -sh ~/miniconda3/envs/*
# or
du -sh ~/anaconda3/envs/*
# Total conda size
du -sh ~/miniconda3
Configure conda:
Add channels:
conda config --add channels conda-forge
conda config --add channels bioconda
Set channel priority:
conda config --set channel_priority strict
Show configuration:
conda config --show
conda config --show channels
Remove channel:
conda config --remove channels <channel-name>
Use mamba (faster alternative): If user has performance issues:
# Install mamba
conda install mamba -n base -c conda-forge
# Use mamba instead of conda
mamba install <package-name>
mamba search <package-name>
mamba env create -f environment.yml
Troubleshooting common issues:
Environment not activating:
conda init bash
source ~/.bashrc
Package conflicts:
# Create new environment instead
conda create -n new-env python=3.11 <packages>
Slow package resolution:
# Use mamba
conda install mamba -c conda-forge
# or
conda config --set solver libmamba
Conda command not found:
export PATH="$HOME/miniconda3/bin:$PATH"
conda init bash
Best practices to share:
conda clean --all--from-history for cross-platform compatibilityShow workflow example:
# Create environment
conda create -n data-project python=3.11
# Activate it
conda activate data-project
# Install packages
conda install numpy pandas jupyter matplotlib scikit-learn
# Verify
conda list
# Export for sharing
conda env export --from-history > environment.yml
# Deactivate when done
conda deactivate
Integration with Jupyter:
# Install ipykernel in environment
conda activate <env-name>
conda install ipykernel
# Register environment as Jupyter kernel
python -m ipykernel install --user --name=<env-name>
# Now available in Jupyter
jupyter lab
Report current status: Summarize:
-n <env-name> to work with environments without activating--from-history when exporting for other OS