Conda/Mamba tips and tricks: Difference between revisions
		
		
		
		
		
		Jump to navigation
		Jump to search
		
				
		
		
	
| No edit summary | |||
| (10 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
| == Searching available package == | |||
| <syntaxhighlight lang="bash"> | |||
| # Search available package inside conda env | |||
| $conda search <package_name>    # this command shows all avalable version of package | |||
| </syntaxhighlight> | |||
| == Install Mamba on Conda == | |||
| <syntaxhighlight lang="bash"> | |||
| # prioritize 'conda-forge' channel | |||
| conda config --add channels conda-forge | |||
| # update existing packages to use 'conda-forge' channel | |||
| conda update -n base --all | |||
| # install 'mamba' | |||
| conda install -n base mamba | |||
| </syntaxhighlight> | |||
| == The environment is inconsistent, please check the package plan carefully. The following packages are causing the inconsistency == | |||
| <syntaxhighlight lang="bash"> | |||
| $conda install anaconda   # this command may take over an hour | |||
| # after then | |||
| $conda update --all        | |||
| </syntaxhighlight> | |||
| == Unable to activate environment - even after ‘conda init’ and re-login to the shell == | |||
| <syntaxhighlight lang="bash"> | |||
| $ source activate base | |||
| $ conda deactivate | |||
| </syntaxhighlight> | |||
| == Update Python version for the conda env using mamba and yaml file == | |||
| <syntaxhighlight lang="bash"> | |||
| # environment.yml to update package inside of your environment | |||
| channels: | |||
|   - conda-forge | |||
|   - nodefaults | |||
| dependencies: | |||
|   - python >=3.10,<3.11 | |||
|   - jupyterlab | |||
|   - numpy | |||
|   - scikit-learn | |||
|   - matplotlib-base # avoid qt if you can, if having trouble | |||
| $mamba env update -n <your env> --file environment.yml | |||
| </syntaxhighlight> | |||
| == Basic conda/mamba env setup in [[Manual:DLSSystem|DLS framework]] <ref>https://docs.conda.io/projects/conda/en/stable/commands/config.html</ref> == | |||
| <syntaxhighlight lang="bash"> | |||
| conda config --set auto_activate_base false | |||
| conda config --add channels r | |||
| conda config --add channels defaults | |||
| conda config --add channels bioconda | |||
| conda config --add channels conda-forge | |||
| </syntaxhighlight> | |||
| == How to fix InsecureRequestWarning: Unverified HTTPS request is being made to host == | |||
| conda config --set ssl_verify false | |||
| == conda: error: argument COMMAND: invalid choice: 'actiate' == | |||
| <syntaxhighlight lang="bash"> | |||
| # Try activate base  | |||
| $ source activate base | |||
| # Then deactivate it | |||
| (base) $ conda deactivate | |||
| # after then you can use activate command | |||
| $ conda activate base | |||
| </syntaxhighlight> | |||
| == Downgrading Conda Version == | == Downgrading Conda Version == | ||
Latest revision as of 07:32, 27 May 2025
Searching available package
# Search available package inside conda env
$conda search <package_name>    # this command shows all avalable version of package
Install Mamba on Conda
# prioritize 'conda-forge' channel
conda config --add channels conda-forge
# update existing packages to use 'conda-forge' channel
conda update -n base --all
# install 'mamba'
conda install -n base mamba
The environment is inconsistent, please check the package plan carefully. The following packages are causing the inconsistency
$conda install anaconda   # this command may take over an hour
# after then
$conda update --all
Unable to activate environment - even after ‘conda init’ and re-login to the shell
$ source activate base
$ conda deactivate
Update Python version for the conda env using mamba and yaml file
# environment.yml to update package inside of your environment
channels:
  - conda-forge
  - nodefaults
dependencies:
  - python >=3.10,<3.11
  - jupyterlab
  - numpy
  - scikit-learn
  - matplotlib-base # avoid qt if you can, if having trouble
$mamba env update -n <your env> --file environment.yml
Basic conda/mamba env setup in DLS framework [1]
conda config --set auto_activate_base false
conda config --add channels r
conda config --add channels defaults
conda config --add channels bioconda
conda config --add channels conda-forge
How to fix InsecureRequestWarning: Unverified HTTPS request is being made to host
conda config --set ssl_verify false
conda: error: argument COMMAND: invalid choice: 'actiate'
# Try activate base 
$ source activate base
# Then deactivate it
(base) $ conda deactivate
# after then you can use activate command
$ conda activate base
Downgrading Conda Version
conda config --set allow_conda_downgrades true
conda install conda=a.b.c   # version you want to install
Speedup Conda
This page describes how to speed up conda operation
some examples are,
conda config --add channels bioconda
conda config --set channel_priority strict
conda config --set safety_checks disabled
Conda commands
| Commands | Description | Options | Notes | 
|---|---|---|---|
| conda update conda | update the conda package manager to the latest version | ||
| conda update anaconda | use conda to update Anaconda to the latest version | ||
| conda install anaconda=VERSION-NUMBER | use conda to install a specific version of Anaconda | ||
| conda config --add channels conda-forge | Add conda channel | Update channels section of ~/.condarc file | |
| conda config --set channel_priority strict | Set channel priority policy | ||
| conda config --show-sources | Show config status | ||
| conda update --all --verbose | Update all conda with printout | ||
| conda list --show-channel-urls | Listup conda channels | ||
| conda search -f python | search available python version | Search can be extened with channels$ cat ~/.condarcchannels:- conda-forge- bioconda- defaults | Conda only has support for Python 3.8+ on the osx-arm64[2] To search alternative platforms, can use the  
  |