conda¶
conda est le gestionnaire de paquet et d'environnement fourni avec Anaconda.
miniconda est l'installateur de conda. Il installe conda, Python et les paquets de base.
Installer conda:¶
2 façons (miniconda ou anaconda):
- Télécharger miniconda puis
$ bash Miniconda3-latest-MacOSX-x86_64.sh
- Télécharger anaconda puis double-cliquer sur le .pkg
conda init¶
Initialize conda for shell interaction. (nécessaire pour les commandes conda activate
et conda deactivate
)
Shell bash:
$ conda init
Ajoute au .bash_profile:
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/Users/bruno/miniconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/Users/bruno/miniconda3/etc/profile.d/conda.sh" ]; then
. "/Users/bruno/miniconda3/etc/profile.d/conda.sh"
else
export PATH="/Users/bruno/miniconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
Shell zsh:
$ conda init zsh
Ajoute au .zshrc
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/Users/bruno/miniconda3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/Users/bruno/miniconda3/etc/profile.d/conda.sh" ]; then
. "/Users/bruno/miniconda3/etc/profile.d/conda.sh"
else
export PATH="/Users/bruno/miniconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
conda init --reverse¶
Dé-initialise conda
$ conda init --reverse # bash
$ conda init zsh --reverse # zsh
Ajouter miniconda3 au $PATH
export PATH="$HOME/miniconda3/bin:$PATH"
$ which python
/Users/bruno/miniconda3/bin/python
# export PATH="$HOME/miniconda3/bin:$PATH"
$ which python
/usr/local/bin/python
Mettre à jour conda:¶
$ conda update conda
Collecting package metadata (current_repodata.json): done
Solving environment: done
## Package Plan ##
environment location: /Users/bruno/miniconda3
added / updated specs:
- conda
The following packages will be downloaded:
package | build
---------------------------|-----------------
cffi-1.13.2 | py37hb5b8e2f_0 218 KB
setuptools-41.6.0 | py37_0 641 KB
six-1.13.0 | py37_0 26 KB
sqlite-3.30.1 | ha441bb4_0 2.4 MB
tqdm-4.38.0 | py_0 51 KB
------------------------------------------------------------
Total: 3.3 MB
The following packages will be UPDATED:
cffi 1.13.0-py37hb5b8e2f_0 --> 1.13.2-py37hb5b8e2f_0
setuptools 41.4.0-py37_0 --> 41.6.0-py37_0
six 1.12.0-py37_0 --> 1.13.0-py37_0
sqlite 3.30.0-ha441bb4_0 --> 3.30.1-ha441bb4_0
tqdm 4.36.1-py_0 --> 4.38.0-py_0
Proceed ([y]/n)? y
Downloading and Extracting Packages
six-1.13.0 | 26 KB | ##################################################################################################### | 100%
sqlite-3.30.1 | 2.4 MB | ##################################################################################################### | 100%
cffi-1.13.2 | 218 KB | ##################################################################################################### | 100%
tqdm-4.38.0 | 51 KB | ##################################################################################################### | 100%
setuptools-41.6.0 | 641 KB | ##################################################################################################### | 100%
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
Installer une application:¶
Par exemple, Spleeter
$ git clone https://github.com/Deezer/spleeter
$ conda env create -f spleeter/conda/spleeter-cpu.yaml
$ conda activate spleeter-cpu
$ spleeter separate -i spleeter/audio_example.mp3 -p spleeter:2stems -o output
$ conda deactivate
Lister les paquets installés:¶
$ conda list
# packages in environment at /Users/bruno/miniconda3:
#
# Name Version Build Channel
asn1crypto 1.2.0 py37_0
ca-certificates 2019.10.16 0
certifi 2019.9.11 py37_0
cffi 1.13.2 py37hb5b8e2f_0
chardet 3.0.4 py37_1003
conda 4.7.12 py37_0
...
six 1.13.0 py37_0
sqlite 3.30.1 ha441bb4_0
Dans l'environnement spleeter-cpu:
$ conda list -n spleeter-cpu
# packages in environment at /Users/bruno/miniconda3/envs/spleeter-cpu:
#
# Name Version Build Channel
_tflow_select 2.3.0 mkl anaconda
absl-py 0.8.1 py37_0 conda-forge
...
setuptools 41.6.0 py37_1 conda-forge
simplejson 3.17.0 pypi_0 pypi
six 1.13.0 py37_0 conda-forge
soundfile 0.10.2 pypi_0 pypi
spleeter 1.4.3 pypi_0 pypi
sqlite 3.30.1 h93121df_0 conda-forge
Mettre à jour un paquet:¶
$ conda update six
Collecting package metadata (current_repodata.json): done
Solving environment: done
# All requested packages already installed.
$ conda update -n spleeter-cpu spleeter
Mettre à jour tous les paquets:¶
$ conda update --all
Collecting package metadata (current_repodata.json): done
Solving environment: done
==> WARNING: A newer version of conda exists. <==
current version: 4.7.12
latest version: 4.8.0rc0
Please update conda by running
$ conda update -n base -c defaults conda
## Package Plan ##
environment location: /Users/bruno/miniconda3
The following packages will be downloaded:
package | build
---------------------------|-----------------
python-3.7.5 | h359304d_0 18.1 MB
------------------------------------------------------------
Total: 18.1 MB
The following packages will be UPDATED:
python 3.7.4-h359304d_1 --> 3.7.5-h359304d_0
Proceed ([y]/n)? n
Dernière mise à jour:
November 9, 2023