mamba
introduction guide¶mamba
environment manually¶All snippets of this tutorial were created using Python 3.8. To make sure, that the provided code will run on your computer system, you should create a mamba
environment with Python version 3.8. A new mamba
environment with Python 3.8 is manually created over the command line by:
mamba create -n soga_intro -c conda-forge python=3.8
To install a new package to an environment or simply to use it for this tutorial, it must be activated. This is done by the following command line:
mamba activate
A listing of all of your local available mamba
environments can be displayed by:
mamba env list
If you created a mamba
environment for this tutorial as shown above, the environment soga_intro
is now displayed in your command line. The output should look like this:
SOGA_Intro C:\Users\example_user\miniconda3\envs\SOGA_Intro
The activation of the environment SOGA_intro
is done by:
mamba activate soga_intro
You should see, that you switched from your base environment to your activated environment. In this example the environment soga_intro
:
To install a new packages to an existing environment, you have to activate it at first. Afterwards you can install a desired package with:
mabma install
Please note that <package_name>
is only a place marker. You have to replace it with your package of choice. How an additional package is installed manually in an existing environment will be shown in the IDE chapter.
If you are done with your work or if you want to change the environment, you must deactivate your environment properly. This is done by the command:
mamba deactivate
You will get back to your base environment:
One of the most powerful feature of mamba is the automatic creation of an environment. You just need a specification file that someone shares with you. You do not have to install all the packages at your own. You can restore the environment of someone else easily at your own local machine. This is also the most important mechanism for you to make use of the provided mamba environment files for this tutorial.
You create a new environment based on the specification of an environment file as follows:
mamba env create -f environment.yml
For an example, see the summary below.
A summary of the most important mamba
commands is given below.
Command | Example | Meaning |
---|---|---|
mamba activate <environment> |
mamba activate myenv |
Activates an existing mamba environment on your local system. The environment is specified via \ |
mamba deactivate <environment> |
mamba deactivate myenv |
Deactivates an existing mamba environment on your local system. You will get back to your base environment. |
mamba create -n <environment_name> <packages> |
mamba create -n soga_intro python=3.8 |
Creates a new mamba environment on your local computer system with the given name and the specified packages. |
mamba install <package_name> |
mamba install spyder |
Installs a the specified package in the activated mamba environment. Make sure to activate the desired environment before! |
mamba create -f <mamba_environmentfile.yml> |
mamba env create -f environment.yml |
Creates a new mamba environment based on the specifications given in the mamba environment file. |
Citation
The E-Learning project SOGA-Py was developed at the Department of Earth Sciences by Annette Rudolph, Joachim Krois and Kai Hartmann. You can reach us via mail by soga[at]zedat.fu-berlin.de.
Please cite as follow: Rudolph, A., Krois, J., Hartmann, K. (2023): Statistics and Geodata Analysis using Python (SOGA-Py). Department of Earth Sciences, Freie Universitaet Berlin.