-
Notifications
You must be signed in to change notification settings - Fork 16
Package installs update #341
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -38,27 +38,33 @@ | |
| "\n", | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @wildintellect I agree with bold or italicize libmamba, but how would you suggest I change the line:
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the callout box should be after the sentence explaining what libmamba is and how you can use classic if you want/need
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @wildintellect Just following up on the above comment |
||
| "### Package manager\n", | ||
| "\n", | ||
| "We use `mamba` (a fast `conda` drop-in replacement) as a package manager to install, update or remove packages (libraries). `mamba` works with 'environments' that are directories in your local file system containing a set of packages. When you work 'in a given environment', it means that your programs will look for dependencies in that environment's `mamba` directory. All workspaces launch with an environment called `base`, which is a `mamba` environment that has all the pre-installed libraries. If you open a terminal launcher after creating a `Basic Stable` workspace : \n", | ||
| "We use `conda` with the libmamba solver as a package manager to install, update or remove packages (libraries). `conda` works with 'environments' that are directories in your local file system containing a set of packages. When you work 'in a given environment', it means that your programs will look for dependencies in that environment's `conda` directory. All workspaces launch with an environment called `base`, which is a `conda` environment that has all the pre-installed libraries. If you open a terminal launcher after creating a `Basic Stable` workspace : \n", | ||
| "\n", | ||
| "\n", | ||
| "\n", | ||
| "\n", | ||
| "You can notice that a `base` `mamba` environment is activated, and its libraries are located in `/opt/conda`. \n", | ||
| "You can notice that a `base` `conda` environment is activated, and its libraries are located in `/opt/conda`. \n", | ||
| "\n", | ||
| "### Extending the `base` environment in a given workspace session.\n", | ||
| "\n", | ||
| "**Note : any modification to the `base` environment does not survive a workspace restart. In other words, modifications to `/opt/conda` disappear after a workspace restart**. \n", | ||
| "\n", | ||
| "Extending an existing `mamba` environment means adding packages on top of what it contains, which works provided there are no dependency conflicts. You can install libraries using the `mamba install` command to install additional packages in your current environment (run `mamba --help` to learn more about how to use `mamba` commands). For example :\n", | ||
| "Extending an existing `conda` environment means adding packages on top of what it contains, which works provided there are no dependency conflicts. You can install libraries using the `conda install` command to install additional packages in your current environment (run `conda --help` to learn more about how to use `conda` commands). All `conda` install commands should use `-c conda-forge` otherwise it's unlikely to work, since many/most of the packages installed already are from conda-forge. For example :\n", | ||
| "\n", | ||
| "```\n", | ||
| "mamba install xarray\n", | ||
| "conda install -c conda-forge xarray\n", | ||
| "```\n", | ||
| "\n", | ||
| "libmamba is the default solver, but users are welcome to set the solver to \"classic\" with: \n", | ||
| "\n", | ||
| "```\n", | ||
| "conda install --solver=classic -c conda-forge xarray\n", | ||
| "```\n", | ||
| "\n", | ||
| "However, it is recommended to use configuration files for reproducibility and shareability. With this approach, assuming your configuration file is named `config.yml`, the command to use is : \n", | ||
| "\n", | ||
| "```\n", | ||
| "mamba env update -f config.yml\n", | ||
| "conda env update -f config.yml\n", | ||
| "```\n", | ||
| "\n", | ||
| "For more details on configuration files, see the [Custom environments section](#Custom-environments) and for an example of this command, refer to the [subsection about updating an environment with a configuration file](#Updating-an-existing-environment-with-a-configuration-file).\n" | ||
|
|
@@ -73,7 +79,7 @@ | |
| "\n", | ||
| "*For the rest of this README, in each section we provide a link to download an example YAML configuration file.*\n", | ||
| "\n", | ||
| "You can use the `mamba` CLI to create a new, custom environment. The parameters (the list of libraries, the location where to search for them, etc...) can be passed either from a configuration YAML file or directly on the console. We recommend using the first option (a YAML file is easier to share and modify). \n", | ||
| "You can use the `conda` CLI to create a new, custom environment. The parameters (the list of libraries, the location where to search for them, etc...) can be passed either from a configuration YAML file or directly on the console. We recommend using the first option (a YAML file is easier to share and modify). \n", | ||
| "\n", | ||
| "### Basic custom environment\n", | ||
| "\n", | ||
|
|
@@ -82,39 +88,39 @@ | |
| "This configuration installs specific versions `python`, `pandas` and `geopandas` from `conda-forge`. If versions aren't specified, the latest is installed. We recommend to always specify the version for reproducibility. The basic command to create this environment would be :\n", | ||
| "\n", | ||
| "```\n", | ||
| "mamba env create -f env-example.yml\n", | ||
| "conda env create -f env-example.yml\n", | ||
| "```\n", | ||
| "\n", | ||
| "However, this stores this environment files in `/opt/conda`, which is a directory that is recreated when the workspace restarts, and so custom environments are lost. Therefore, you want to specify a storage location in your user directory with the `--prefix` parameter\n", | ||
| "\n", | ||
| "```\n", | ||
| "mamba env create -f env-example.yml --prefix /projects/env\n", | ||
| "conda env create -f env-example.yml --prefix /projects/env/env-example\n", | ||
| "```\n", | ||
| "\n", | ||
| "and to activate it : \n", | ||
| "\n", | ||
| "```\n", | ||
| "mamba activate env-example\n", | ||
| "conda activate /projects/env/env-example\n", | ||
| "```\n", | ||
| "\n", | ||
| "### Updating an existing environment with a configuration file\n", | ||
| "\n", | ||
| "*Example config file for this section [here](./example_conda_configuration_files/env-extend.yml).*\n", | ||
| "\n", | ||
| "You can *update* an existing environment with a configuration file as well. For example, let's assume you have a `mamba` environment with a set of packages already installed in it (for example the `base` environment), but it doesn't have `xarray` and `geopandas`. Using the linked example config : \n", | ||
| "You can *update* an existing environment with a configuration file as well. For example, let's assume you have a `conda` environment with a set of packages already installed in it (for example the `base` environment), but it doesn't have `xarray` and `geopandas`. Using the linked example config : \n", | ||
| "\n", | ||
| "```\n", | ||
| "mamba env update -f env-extend.yml\n", | ||
| "conda env update -f env-extend.yml\n", | ||
| "```\n", | ||
| "\n", | ||
| "This command will update `base` by adding `xarray` and `geopandas`, provided it does not cause conflicts with the existing libraries. \n", | ||
| "This command will update the active environment by adding `xarray` and `geopandas`, provided it does not cause conflicts with the existing libraries. \n", | ||
| "\n", | ||
| "\n", | ||
| "### Using `pip` for python packages\n", | ||
| "\n", | ||
| "*Example config file for this section [here](./example_conda_configuration_files/env-with-pip.yml).*\n", | ||
| "\n", | ||
| "Some python packages might not be availabe in the channel you are using, or in any `mamba` channel. If that package however is in `PyPI` (the official python package repository), one can use `pip` within a `mamba` environment to download packages. The recommended way is to specify this in the configuration file. In the linked example, we add `stackstac` as a dependency to install from `PyPI` because it is not available in the `conda-forge` channel. \n", | ||
| "Some python packages might not be availabe in the channel you are using, or in any `conda` channel. If that package however is in `PyPI` (the official python package repository), one can use `pip` within a `conda` environment to download packages. The recommended way is to specify this in the configuration file. In the linked example, we add `stackstac` as a dependency to install from `PyPI` because it is not available in the `conda-forge` channel. \n", | ||
| "\n", | ||
| "### Using custom environments in jupyter notebooks\n", | ||
| "\n", | ||
|
|
@@ -126,23 +132,24 @@ | |
| "- Create your environment using the linked configuration file.\n", | ||
| "- Install the environment as a kernel by running the following command (parameter values follow the example mentioned):\n", | ||
| " ```\n", | ||
| " python -m ipykernel install --user --name env-with-ipykernel --display-name \"Python env-with-ipykernel\".\n", | ||
| " python -m ipykernel install --user --name env-with-ipykernel --display-name \"Python env-with-ipykernel\"\n", | ||
| " ```\n", | ||
| " The above command installs the environment as a kernel in Jupyter, making it accessible in the notebook with a display name of \"Python env-with-ipykernel\".\n", | ||
| "- Wait around 30 seconds and launch a new notebook. Among the kernel options, you should see \"Python env-with-ipykernel\" listed. Below you can see a screenshot that shows what this step looks like:\n", | ||
| "\n", | ||
| "\n", | ||
| "- Remove by listing kernelspecs `jupyter kernelspec list` to find name, then `jupyter kernelspec remove <env>`\n", | ||
| "\n", | ||
| "### Suggested packages for custom environment\n", | ||
| "\n", | ||
| "*Example config file for this section [here](./example_conda_configuration_files/env-with-maap-py.yml)*\n", | ||
| "\n", | ||
| "MAAP users typically use the python `maap-py`. It's pre-installed in all workspaces, in the `base` mamba environment, but any custom environment should specify it, otherwise it is not going to be accessible from that environment. However, `maap-py` is not packaged in a public package repository, like `PyPI` or `conda-forge`. It is possible to install it directly from its github repository with `pip` though. See the configuration example linked. You can note that in the example, `maap-py` is 'versioned' using a commit hash (at the end of the github URL). " | ||
| "MAAP users typically use the python `maap-py`. It's pre-installed in all workspaces, in the `base` conda environment, but any custom environment should specify it, otherwise it is not going to be accessible from that environment. However, `maap-py` is not packaged in a public package repository, like `PyPI` or `conda-forge`. It is possible to install it directly from its github repository with `pip` though. See the configuration example linked. You can note that in the example, `maap-py` is 'versioned' using a commit hash (at the end of the github URL). " | ||
| ] | ||
| } | ||
| ], | ||
| "metadata": { | ||
| "kernelspec": { | ||
| "display_name": "Python 3", | ||
| "display_name": "Python 3.11.1 64-bit", | ||
| "language": "python", | ||
| "name": "python3" | ||
| }, | ||
|
|
@@ -156,7 +163,7 @@ | |
| "name": "python", | ||
| "nbconvert_exporter": "python", | ||
| "pygments_lexer": "ipython3", | ||
| "version": "3.10.10" | ||
| "version": "3.11.1" | ||
| }, | ||
| "metadata": { | ||
| "interpreter": { | ||
|
|
@@ -165,7 +172,7 @@ | |
| }, | ||
| "vscode": { | ||
| "interpreter": { | ||
| "hash": "8a5edab282632443219e051e4ade2d1d5bbc671c781051bf1437897cbdfea0f1" | ||
| "hash": "5c7b89af1651d0b8571dde13640ecdccf7d5a6204171d6ab33e7c296e100e08a" | ||
| } | ||
| } | ||
| }, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.