Installation¶
Please execute the instructions of the following text boxes in a Terminal or Anaconda Prompt.
Download CLIMADA and CLIMADA_petals¶
cd $[installation directory]
git clone https://github.com/CLIMADA-project/climada_python.git
cd climada_python
git checkout develop
cd ..
git clone https://github.com/CLIMADA-project/climada_petals.git
cd climada_petals
git checkout develop
cd ..
Install environment with Anaconda or Miniconda¶
Conda¶
It’s highly recommanded to use Conda for the installation. Without Conda the installation of the dependencies can be cumbersome. If it is not already installed, download the latest version of Anaconda or Miniconda and execute it.
Install dependencies¶
Open a command prompt (Windows) or shell (Mac, Linux)
cd $[installation directory]
conda env create -n climada_env -f climada_petals/requirements/env_climada.yml
conda activate climada_env
Install climada core and petals¶
cd $[installation directory]
pip install -e climada_python
pip install -e climada_petals
Test installation¶
Before leaving the Environments section of Anaconda, make sure that the CLIMADA environment, climada_env is selected. Go to the Home section of Anaconda and install and launch Spyder (or your preferred editor). Open the file containing all the installation tests, tests_install.py
in climada_python-x.y.z
folder and execute it. If the installation has been successful, an OK will appear at the end (the execution should last less than 2 min).
Run tutorials¶
In the Home section of Anaconda, with CLIMADA_env selected, install and launch jupyter notebook. A browser window will show up. Navigate to your CLIMADA_python-x.y.z
repository and open doc/tutorial/1_main_CLIMADA.ipynb
. This is the tutorial which will guide you through all CLIMADA’s functionalities. Execute each code cell to see the results, you might also edit the code cells before executing. See
tutorials for more information.
Workaround if Spyder installation in Anaconda fails for climada_env.¶
In a terminal window, enter:
conda activate climada_env
conda install spyder-kernels
python -c "import sys; print(sys.executable)"
--> returns a path, like /Users/XXX/opt/anaconda3/envs/climada_env/bin/python
Start Anaconda, create a new python_env environment (just click create and enter the name, then press Create) and install latest Spyder in there (currently 4.1.5), start this Spyder, then, after Spyder has started, navigate to Preferences > Python Interpreter > Use the following interpreter and paste the path from above (e.g. /Users/XXX/opt/anaconda3/envs/CLIMADA_env/bin/python) into the text box. Start a new IPython console and run tests_install.py
.
FAQs¶
ModuleNotFoundError; CLIMADA libraries are not found. Try to include climada_python-x.y.z path in the environment climada_env path as suggested in Section 2 of [Install environment with Anaconda]. If it does not work you can always include the path manually before executing your code:
import sys sys.path.append('path/to/climada_python-x.y.z')
ModuleNotFoundError; some python library is not found. It might happen that the pip dependencies of env_climada.yml (the ones specified after
pip:
) have not been installed in the environment climada_env. You can then install them manually one by one as follows:conda activate climada_env pip install library_name
where
library_name
is the missing library.Another reason may be a recent update of the operating system (macOS). In this case removing and reinstalling Anaconda will be required.
Conda permission error (
operation not permitted
) in macOS Mojave: try the solutions suggested here https://github.com/conda/conda/issues/8440No ‘impf_TC’ column in GeoDataFrame: This may happen when a demo file from CLIMADA was not updated after the change in the impact function naming pattern from ‘if_’ to ‘impf_’ (climada v2.2.0). To solve it, run
python -c 'import climada; climada.setup_climada_data(reload=True)
in a terminal.How to change the log level: By default the logging level is set to
'INFO'
, which is quite verbose. This can be changedprogrammatically, in a script or interactive python environment (Spyder, Jupyter, IPython) by executing e.g.,
from climada.util.config import LOGGER; from logging import WARNING; LOGGER.setLevel(WARNING)
,through configuration, by editing the config file
CLIMADA/conf/defaults.conf
and setting the value of theglobal.log_level
property.