Skip to content
Snippets Groups Projects
Commit 936ea1fe authored by Wigal, Jacob (CIV)'s avatar Wigal, Jacob (CIV) :sparkles:
Browse files

Update py-packages_installation.rst

parent d7982f85
No related branches found
No related tags found
No related merge requests found
......@@ -18,15 +18,6 @@ Install it to **all users** and use default settings.
Test that the Anaconda package manager called ``conda`` works by opening the newly downloaded **Anaconda Prompt** and running the command ``conda --version``.
Install GIS related packages with conda (and pip) by running the following commands in your terminal / command prompt /anaconda prompt.
As you can see below, many of the GIS packages are available from specific ``channel`` from conda called ``conda-forge``.
We recommend that you first install only geopandas, and add the other packages once you need them.
Installing geopandas will automatically install several fundamental GIS packages (such as Shapely and fiona) on your computer, so you will have a nice setup already using one installation command!
.. code:: bash
conda install geopandas -c conda-forge
Install Anaconda on Mac / Linux
-----------------------------------
......@@ -40,7 +31,7 @@ Test that the Anaconda package manager called ``conda`` works by opening Termina
.. code:: bash
# Add Anaconda installation permanently to PATH variable
nano ~/.bashrc
nano .bash_profile
# Add following line at the end of the file and save (EDIT ACCORDING YOUR INSTALLATION PATH)
export PATH=$PATH:/PATH_TO_ANACONDA/anaconda3/bin:/PATH_TO_ANACONDA/anaconda3/lib/python3.7/site-packages
......@@ -63,8 +54,9 @@ After installation is completed, you can start a Jupyter Notebook instance by ru
jupyter notebook
Jupyter Notebook should open up in a browser window.
Jupyter Notebooks save with the file extension .ipynb, short for IPython Notebook. (Note: to open one of these files, you will need to first make sure jupyter notebook has been launched from either Anaconda Prompt(Windows) or Terminal(Mac).)
Your current Anaconda Prompt/Terminal shell will then run a command to launch Jupyter Notebook in a new browser window.
Jupyter Notebook will be relying on the Anaconda Prompt/Terminal shell that launched it, so if you need to enter additional bash/conda commands just open another Anaconda Prompt/Terminal shell, or you can press CTRL+C on the current shell to interrupt the kernel, shutdown Jupyter Notebook, and enter commands again.
Jupyter Notebooks save with the file extension .ipynb, short for IPython Notebook. (Note: to open one of these files, you will need to first make sure jupyter notebook has been launched from either Anaconda Prompt(Windows) or Terminal(Mac), and then navigate to it in the browser window.)
Install Python Packages
----------------------
......@@ -88,29 +80,47 @@ You can test that the installations have worked by running following commands in
.. code:: python
import geopandas as gpd
import pysal
import cartopy
import matplotlib
import geojson
import folium
import dash
import ipyleaflet
import rasterio
If you don't receive any errors, everything should be working!
How to find out which conda -command to use when installing a package?
--------------------------------------------------------------------
The first thing to try when installing a new module ``X`` is to run in a command prompt (as admin) following command (here we try to install a hypothetical
module called X)
.. code::
conda install X
or downloading from a specific channel:
.. code::
conda install X -c conda-forge
In most cases this approach works but sometimes you may need to google the package name + 'anaconda cloud' to find the correct command to run. Here is an example `anaconda cloud page <https://anaconda.org/conda-forge/geopandas>`_ with more information on how to install GeoPandas.
Creating a new environment using conda
----------------------
Conda allows us to create different `Python environments <https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html>`__ .
Python packages have often many dependencies, and some packages might, for example,
only work with an older version of Python.
Run this codes in order to get started with a GIS Python environment (tested to work on Windows 10 in November 2019):
Run this codes in order to get started with a new Python environment (tested to work on Windows 10 in November 2019):
.. code:: bash
# Create a new environment with python 3.7
conda create -n gis python=3.7
# Create a new environment with python 3.7 (feel free to change 'new_env' to whatever name you like!)
conda create -n new_env python=3.7
# Activate the environment
conda activate gis
conda activate new_env
# Install jupyter notebook again, because there are no packages on this new environmennt
conda install -c conda-forge notebook
......@@ -122,25 +132,7 @@ Run this codes in order to get started with a GIS Python environment (tested to
# Shut down jupyter notebook using CTRL+C once done working
How to find out which conda -command to use when installing a package?
--------------------------------------------------------------------
The first thing to try when installing a new module ``X`` is to run in a command prompt (as admin) following command (here we try to install a hypothetical
module called X)
.. code::
conda install X
or downloading from a specific channel:
.. code::
conda install X -c conda-forge
In most cases this approach works but sometimes you may need to google the package name + 'anaconda cloud' to find the correct command to run. Here is an example `anaconda cloud page <https://anaconda.org/conda-forge/geopandas>`_ with more information on how to install GeoPandas.
Here is a `"cheat sheet" <https://docs.conda.io/projects/conda/en/4.6.0/_downloads/52a95608c49671267e40c689e0bc00ca/conda-cheatsheet.pdf>`__ of Anaconda commands for your reference.
Instructions on this page have been adapted from `Automating GIS processes -course @ Department of Geosciences & Geography, University of Helsinki <https://github.com/Automating-GIS-processes>`_
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment