288 lines
7.0 KiB
Markdown
288 lines
7.0 KiB
Markdown
# 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):
|
|
|
|
1. Télécharger [miniconda](https://docs.conda.io/en/latest/miniconda.html) puis
|
|
|
|
```bash
|
|
$ bash Miniconda3-latest-MacOSX-x86_64.sh
|
|
```
|
|
|
|
2. Télécharger [anaconda](https://www.anaconda.com/distribution/) 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:
|
|
|
|
```bash
|
|
$ conda init
|
|
```
|
|
|
|
Ajoute au .bash_profile:
|
|
|
|
```bash
|
|
# >>> 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:
|
|
|
|
```bash
|
|
$ conda init zsh
|
|
```
|
|
|
|
Ajoute au .zshrc
|
|
|
|
```bash
|
|
# >>> 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
|
|
|
|
```bash
|
|
$ conda init --reverse # bash
|
|
```
|
|
|
|
```bash
|
|
$ conda init zsh --reverse # zsh
|
|
```
|
|
|
|
|
|
|
|
Ajouter miniconda3 au $PATH
|
|
|
|
```bash
|
|
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:
|
|
|
|
```bash
|
|
$ 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](https://github.com/deezer/spleeter)
|
|
|
|
```bash
|
|
$ 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:
|
|
|
|
```bash
|
|
$ 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:
|
|
|
|
```bash
|
|
$ 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:
|
|
|
|
```bash
|
|
$ conda update six
|
|
Collecting package metadata (current_repodata.json): done
|
|
Solving environment: done
|
|
|
|
# All requested packages already installed.
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
|
$ conda update -n spleeter-cpu spleeter
|
|
|
|
```
|
|
|
|
|
|
|
|
##### Mettre à jour tous les paquets:
|
|
|
|
```bash
|
|
$ 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
|
|
```
|
|
|
|
|
|
|
|
|
|
|