Setting Up A Python Environment
with Miniconda
Setting Up A Python Environment
with Miniconda
Miniconda is an alternative to the full Anaconda distribution. It is a smaller version of Anaconda that includes conda, Python, and the packages they need to run. You can use the conda install command to get additional conda packages from the Anaconda repository. Some find the leaner Miniconda easier to work with than the full Anaconda package.
Install Miniconda
First, download and install the appropriate installation package of Miniconda based on your operating system. Consider Python v3.6 to match the ArcGIS Pro python distribution. However, later versions, specifically v3.9 are known to work with with the Diversion-Runoff Calculator (DRC). Install the downloaded file locally.
Setup the Python Environment
After installation, open the Anaconda Prompt. Do this by searching for it in the Start menu and then click on “Anaconda Prompt (miniconda3). Commands are typed into this Anaconda Prompt window.
First verify that conda is installed and running on your system by typing: conda –version. Conda should display the number of the version that you have installed. You do not need to navigate to the Anaconda directory. If you get an error message, close and re-open the terminal window.
It is recommended to keep conda up-to-date. To update conda to the current version type: conda update conda. Conda compares versions and then displays what is available to install. If a newer version of conda is available, type y to update when asked: Proceed ([y]/n)? y.
Conda creates independent environments that contain packages, files, and dependencies, without any interaction with other environments. You start with a default environment called base. However, it is generally best not to put tailored configurations in the base environment. Create separate environments to keep your programs isolated.
Create a new environment and install a package in it. We will name the eenvironment pygdal_39 and install the package GDAL. At the Anaconda Prompt or in your terminal window, type the following: conda create --pygdal_39 gdal. Conda checks to see what additional packages ("dependencies") GDAL will need, and asks if you want to proceed: Proceed ([y]/n)? y. Type "y" and press Enter to proceed.
To use, or "activate" the new environment, type the following:
○ Windows: conda activate pygdal_39
○ macOS and Linux: conda activate pygdal_39
○ Now that you are in your pygdal_39 environment, any conda commands you type will go to that environment until you deactivate it.
To see a list of all your environments, type: conda info --envs. A list of environments appears, similar to the following:
conda environments:
base /home/username/Anaconda3
pygdal_39 * /home/username/Anaconda3/envs/pygdal_39
The active environment is the one with the asterisk.
You will need the following libraries in order to run the Diversion-Runoff Calculator.
Pandas
matplotlib
openpyxl
Type: conda install pandas. Conda compiles a list of required packages and asks if you want to proceed: Proceed ([y]/n)? y. Type "y" and press Enter to proceed.
Type: conda install matplotlib. Conda compiles a list of required packages and asks if you want to proceed: Proceed ([y]/n)? y. Type "y" and press Enter to proceed.
Type: conda install openpyxl. Conda compiles a list of required packages and asks if you want to proceed: Proceed ([y]/n)? y. Type "y" and press Enter to proceed.
Once all libraries are installed, you are ready to begin running the DRC.