{ "cells": [ { "cell_type": "markdown", "source": [ "# Anaconda" ], "metadata": { "collapsed": false }, "id": "dcc77f4c10a8ea56" }, { "cell_type": "markdown", "source": [ "\n", "IMPORTANT: In order to have conda environments persisting between sessions, you need to create them under your home folder ( `/home/maia-user/` ).\n", "\n", "To create a new conda environment, you can use the following command:" ], "metadata": { "collapsed": false }, "id": "28d56401ca1796d6" }, { "cell_type": "code", "source": [ "%%bash\n", "\n", "/opt/conda/bin/conda create --prefix ~/.conda/envs/ -y" ], "metadata": { "collapsed": false, "is_executing": true }, "id": "44167bd15429ee0c", "outputs": [], "execution_count": null }, { "cell_type": "markdown", "source": [ "To create a conda environment from a specific `environment.yml` file, you can first upload the file to the JupyterLab environment and then run the following command:" ], "metadata": { "collapsed": false }, "id": "4feb6ae09ffa872e" }, { "cell_type": "code", "source": [ "%%bash\n", "\n", "/opt/conda/bin/conda env create --prefix ~/.conda/envs/ --file -y" ], "metadata": { "collapsed": false }, "id": "ca7a9678660225fd", "outputs": [], "execution_count": null }, { "cell_type": "markdown", "source": [ "In order to be able to use the conda environment on a Jupyter notebook, you will need to create a corresponding Jupyter Kernel. To create a Jupyter kernel from a conda environment, you can use the following command:" ], "metadata": { "collapsed": false }, "id": "3c8aa931767a549a" }, { "cell_type": "code", "source": [ "%%bash\n", "/opt/conda/bin/conda install --prefix ~/.conda/envs/ -c anaconda ipykernel -y\n", "\n", "~/.conda/envs//bin/python -m ipykernel install --user --name=" ], "metadata": { "collapsed": false, "is_executing": true }, "id": "bbce5ea14a2a1a2a", "outputs": [], "execution_count": null }, { "cell_type": "markdown", "source": [ "To install a pip package in the conda environment, you can use the following command:\n" ], "metadata": { "collapsed": false }, "id": "146f993892196b67" }, { "cell_type": "code", "source": [ "import sys\n", "!{sys.executable} -m pip install " ], "metadata": { "collapsed": false }, "id": "e4046a60ff426e9c", "outputs": [], "execution_count": null }, { "cell_type": "markdown", "source": [ "## Mamba\n", "\n", "If you prefer to use `mamba` instead of `conda`, you can install it by running the following command:" ], "metadata": { "collapsed": false }, "id": "6ec39f423cceaf0a" }, { "cell_type": "code", "source": [ "%%bash\n", "\n", "/opt/conda/bin/conda install -c conda-forge mamba -y" ], "metadata": { "collapsed": false, "is_executing": true }, "id": "adf9f056f71f6745", "outputs": [], "execution_count": null }, { "cell_type": "markdown", "source": [ "## Anaconda Navigator\n", "\n", "To install Anaconda Navigator, you can run the following command:" ], "metadata": { "collapsed": false }, "id": "2edcdc2f4267370f" }, { "cell_type": "code", "source": [ "%%bash\n", "\n", "/opt/conda/bin/conda install anaconda-navigator -y" ], "metadata": { "collapsed": false }, "id": "987defd8f6c697d4", "outputs": [], "execution_count": null } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.6" } }, "nbformat": 4, "nbformat_minor": 5 }