====== Anaconda ====== * Distribution python libre et multiplateforme (Windows, GNU/Linux, Mac OS), avec le système de Notebook web Jupyter en prime… Si les conditions sont limitées (matériel, réseau,…), il peut être plus intéressant d'installer la version [[https://docs.conda.io/en/latest/miniconda.html|miniconda]] qui permet de compléter par la suite et à la demande l'installation de librairies * Site officiel global [[https://www.anaconda.com/|Anaconda | The World’s Most Popular Data Science Platform]] * Version opensource individuelle [[https://www.anaconda.com/products/individual|Anaconda - Individual Edition]] * Documentation [[https://docs.continuum.io/anaconda/|Anaconda Individual Edition — Anaconda documentation]] * Cheat Sheet : [[https://kapeli.com/cheat_sheets/Conda.docset/Contents/Resources/Documents/index]] ===== Installation ===== * Windows * [[https://docs.anaconda.com/anaconda/install/windows/]] * [[https://datascientest.com/environnement-python-installer-anaconda-pour-bien-demarrer|Environnement Python : Installer Anaconda pour bien démarrer]] * [[https://perso.limsi.fr/pointal/python:installation:accueil|python:installation:accueil (L.Pointal)]] * [[https://problemsolvingwithpython.com/01-Orientation/01.03-Installing-Anaconda-on-Windows/|Installing Anaconda on Windows - Problem Solving with Python]] * [[https://medium.com/@GalarnykMichael/install-python-anaconda-on-windows-2020-f8e188f9a63d|Install Python (Anaconda) on Windows - by Michael Galarnyk - Medium]] * [[https://realpython.com/python-windows-machine-learning-setup/|Setting Up Python for Machine Learning on Windows]], Renato Candido, Real Python, 2021 * Mac OS * [[https://docs.anaconda.com/anaconda/install/mac-os/]] * [[https://towardsdatascience.com/how-to-successfully-install-anaconda-on-a-mac-and-actually-get-it-to-work-53ce18025f97|How to Successfully Install Anaconda on a Mac]] * [[https://towardsdatascience.com/install-anaconda-on-macos-big-sur-9fbd7c4b6c24|Install Anaconda on MacOS Big Sur]] * GNU/Linux * [[https://docs.anaconda.com/anaconda/install/linux/]] * [[https://phoenixnap.com/kb/how-to-install-anaconda-ubuntu-18-04-or-20-04|https://phoenixnap.com/kb/how-to-install-anaconda-ubuntu-18-04-or-20-04]] * [[https://www.digitalocean.com/community/tutorials/how-to-install-anaconda-on-ubuntu-18-04-quickstart-fr|Comment installer Anaconda sur Ubuntu 18.04]] * [[http://askubuntu.com/questions/505919/installing-anaconda-python-on-ubuntu]] (concerne installation sous Ubuntu GNU/Linux) ==== Sous GNU/Linux Ubuntu 20.04 : ==== * mars 2022 : sudo apt-get update sudo apt-get upgrade sudo apt-get install curl curl -O https://repo.anaconda.com/archive/Anaconda3-2021.11-Linux-x86_64.sh * vérifier sur [[https://docs.anaconda.com/anaconda/install/hashes/Anaconda3-2021.11-Linux-x86_64.sh-hash/]] * bash Anaconda3-2021.11-Linux-x86_64.sh * création d'un lanceur pour Anaconda Navigator : [[https://askubuntu.com/questions/1017284/cant-create-anaconda-shortcut-to-launch-from-desktop-on-ubuntu-17-10|Can't create anaconda shortcut to launch from desktop on ubuntu 17.10?]] * dans ~/bin, créer le fichier anaconda.sh export CONDA_PYTHON_EXE=/home/username/anaconda3/bin/python export PATH=/home/username/anaconda3/bin:$PATH python /home/username/anaconda3/bin/anaconda-navigator * créer un fichier anaconda.desktop [Desktop Entry] Version=1.0 Type=Application Name=Anaconda-Navigator GenericName=Anaconda Exec=/bin/bash "/home/username/bin/anaconda.sh" Icon=/home/username/anaconda3/lib/python3.8/site-packages/anaconda_navigator/static/images/anaconda-icon-256x256.png Terminal=false StartupNotify=true * exécuter la commande : sudo desktop-file-install anaconda.desktop ===== Préférences, réglages ===== * Anaconda-Navigator * enable_high_dpi_scaling = False (pour évitre de trop gros lanceurs) * "channels" → ajouter à "default" le canal "conda-forge" * Spyder * thème clair : Idle,... * menu Outils - option Préférences - rubrique Console Ipython - onglet Graphiques - la sortie “Automatique” permet d'obtenir les graphes dans une fenêtre interactive, sinon, choisir “En ligne”. L'option sera prise en compte après avoir quitté Spyder et l'avoir relancé ===== Mises à jour, update ===== * conda update conda * conda update anaconda * mieux que conda update --all --yes : see [[https://github.com/conda/conda/issues/1414]] * ref : [[https://stackoverflow.com/questions/45197777/how-do-i-update-anaconda]] ==== Désinstallation ==== * Windows * ... * Mac OS * ... * GNU/Linux : * conda install anaconda-clean * rm -rf ~/anaconda3 * nano ~/.bashrc → effacer ou commenter la ligne export PATH="/home/username/anaconda3/bin:$PATH" ===== Environnements virtuels ===== * [[https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html]] * conda create -n foo * source activate foo * source deactivate * conda remove -n foo --all * [[https://towardsdatascience.com/a-guide-to-python-environment-dependency-and-package-management-conda-poetry-f5a6c48d795|A Guide to Python Environment, Dependency and Package Management: Conda + Poetry - How to add packages to your environment files automatically without ever worrying about the dependencies]] Esmaeil Alizadeh, Medium, 29/01/2021 ===== Alternatives à conda ===== * [[https://mamba.readthedocs.io/en/latest/|Mamba]] : fast, robust, and cross-platform package manager, running on Windows, OS X and Linux (ARM64 and PPC64LE included) and fully compatible with conda packages. Mamba supports most of conda’s commands.