Historically: Miniconda
In the University computer lab you DO NOT have to and also you CANNOT install Anaconda or Miniconda distribution.
If you are attending the course in the University computer lab, please consider installing Micromamba and then jump to Creating environments and install packages to create the working environment. This section explains an alternative way to install Python with Miniconda, and can still be useful as an alternative.
Miniconda is an encapsulated versatile virtual python environment installer, that works under the hood of the big Anaconda python distribution. Miniconda is basically a mini version of Anaconda that includes only the conda package manager and its dependencies!
https://conda.io/miniconda.html
Following steps have been tested to work on Windows 7 and 10 with Anaconda/Miniconda 64 bit.
Download Miniconda installer (64 bit) a Python 3.8/3.9, 64-bit (exe installer) for Windows.
BEWARE:
- To install miniconda SYSTEM-WIDE for ALL users, this does require administrator permissions; every users can then create their own environments with the conda tool.
- Please do NOT make Conda the default python for the system if you don't want it to interfere with other Python installations you might have, eg. Pythons of ArcGIS and QGis etc
Install Miniconda on your computer by double clicking the installer and install it into a directory you want.
Install it to all users and use default settings.
Additional install information: https://conda.io/projects/conda/en/latest/user-guide/index.html
Verifying the Miniconda installation
As a convention, whenever I demonstrate Python codes or using commands on the the shell/cmd commandline, using the #
symbol implies a comment
. This line, respectively everything after that symbol is NOT to be executed.
In order to test that the conda
package manager works we have to go through a few more steps: After successful installation you should have a menu entry in the Windows Start Menu:
Anaconda Prompt
This is a Windows CMD (Commandline window, that "knows" about, where your Miniconda/Anaconda installation lies, and where to find the conda
tool (without interfering other Python installations on your computer). After it opens it should display somehow like so:
(base) C:\Users\Alexander>
or
(C:\dev\conda3) C:\Users\Alexander>
On the command line type command conda --version
in order to see if the command is successful, it should show the version of the conda tool.
(base) C:\Users\Alexander> conda --version
conda 4.10.3
Now we have the base conda/Anaconda installation available. The next step is Creating environments and install packages to create a flexible Python working environment.
Alternative installation methods for Conda environments
In the previous section we installed our specific conda Python environment with a pre-defined environment configuration file. In this section we show an alternative variant how you can install conda environments in a more flexible way if you need to.
BEWARE:
Please DO NOT follow these steps, if you already have the environment installed via the environment.yml
configuration above.
The other variant is typically more widely used in exploratory setups. It is a step-by-step procedure. Here we are making sure that Python in version 3.8 will be installed and that we want to explicitly use the additional package channel conda-forge. And we give the environment a name (-n).
If you would create your environment manually, it would go like that: Open the Anaconda prompt
from the Start Menu and type the command below.
(C:\dev\conda3) conda create -n geopython2022alt python=3.9 -c conda-forge
Ok, now that we have installed a Python working environment with the name geopython2022alt
with our desired library packages, we can check installed environments just to be sure. In order to show all environments that have already been created you can ask conda to list these:
(C:\dev\conda3) conda env list
Now we want to activate that environment, install additional packages and start working with it:
(C:\dev\conda3) activate geopython2022alt
(geopython2022alt)
Install GIS related packages with conda by running in command prompt following commands (in the same order as they are listed). Make sure you are in the correct environment (don't install into base
, install new packages ideally only into your designated created environments)
(geopython2022alt) conda install -c conda-forge numpy pandas gdal fiona shapely geopandas
# Install matplotlib and Jupyter Lab/Notebook
(geopython2022alt) conda install -c conda-forge matplotlib jupyter jupyterlab
# Install seaborn
(geopython2022alt) conda install -c conda-forge seaborn
# Install geoplot and cartopy
(geopython2022alt) conda install -c conda-forge cartopy geoviews
# Install mapclassify
(geopython2022alt) conda install -c conda-forge mapclassify
# Install rasterio and rasterstats
(geopython2022alt) conda install -c conda-forge rasterio rasterstats
In the next step we will verify the installation of our conda Python environment and configure Jupyter Notebooks.
From here you can use micromamba or conda, especially for installing additional packages or creating environments with an environment.yml file.