Open lfcgaliz opened 3 days ago
Can you try with another python version (3.11.8
for instance)?
Also, do you have GDAL installed outside of conda? This may create conflict.
Looking further, could you do the following:
mamba activate climada_env2
mamba list | grep climada
And confirm the installed version of climada is actually 3.3.2?
I tried to install climada 5.0.0 within a python 3.9.19 environment and got conflicts. I suggest the following, which work for me:
mamba create -n climada2_env -c conda-forge "python=3.9.*" "climada=5.0.0"
Thanks for the suggestion!
Indeed GDAL outside Conda was creating conflict. I have deleted and I followed your suggestion to install climada 5.0.0 within a python 3.9.* (in this case 3.9.20) environment.
(climada2_env) C:\Users\LuizGALIZIA> mamba list | findstr climada
packages in environment at C:\Users\LuizGALIZIA\miniforge3\envs\climada2_env:
climada 5.0.0 pyhd8ed1ab_0 conda-forge`
But I am still getting an error when testing:
(climada2_env) C:\Users\LuizGALIZIA> python -m unittest climada.engine.test.test_impact
Traceback (most recent call last):
File "C:\Users\LuizGALIZIA\miniforge3\envs\climada2_env\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\LuizGALIZIA\miniforge3\envs\climada2_env\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\Users\LuizGALIZIA\miniforge3\envs\climada2_env\lib\unittest\__main__.py", line 18, in <module>
main(module=None)
File "C:\Users\LuizGALIZIA\miniforge3\envs\climada2_env\lib\unittest\main.py", line 100, in __init__
self.parseArgs(argv)
File "C:\Users\LuizGALIZIA\miniforge3\envs\climada2_env\lib\unittest\main.py", line 147, in parseArgs
self.createTests()
File "C:\Users\LuizGALIZIA\miniforge3\envs\climada2_env\lib\unittest\main.py", line 158, in createTests
self.test = self.testLoader.loadTestsFromNames(self.testNames,
File "C:\Users\LuizGALIZIA\miniforge3\envs\climada2_env\lib\unittest\loader.py", line 220, in loadTestsFromNames
suites = [self.loadTestsFromName(name, module) for name in names]
File "C:\Users\LuizGALIZIA\miniforge3\envs\climada2_env\lib\unittest\loader.py", line 220, in <listcomp>
suites = [self.loadTestsFromName(name, module) for name in names]
File "C:\Users\LuizGALIZIA\miniforge3\envs\climada2_env\lib\unittest\loader.py", line 154, in loadTestsFromName
module = __import__(module_name)
File "C:\Users\LuizGALIZIA\miniforge3\envs\climada2_env\lib\site-packages\climada\engine\test\test_impact.py", line 38, in <module>
from climada.hazard.test.test_base import HAZ_TEST_TC
File "C:\Users\LuizGALIZIA\miniforge3\envs\climada2_env\lib\site-packages\climada\hazard\test\test_base.py", line 44, in <module>
HAZ_TEST_TC :Path = get_test_file('test_tc_florida')
File "C:\Users\LuizGALIZIA\miniforge3\envs\climada2_env\lib\site-packages\climada\test\__init__.py", line 50, in get_test_file
client.list_dataset_infos(name=ds_name, status='test_dataset', version='ANY'),
File "C:\Users\LuizGALIZIA\miniforge3\envs\climada2_env\lib\site-packages\climada\util\api_client.py", line 418, in list_dataset_infos
DatasetInfo.from_json(ds) for ds in self._request_200(url, params=params)
File "C:\Users\LuizGALIZIA\miniforge3\envs\climada2_env\lib\site-packages\climada\util\api_client.py", line 341, in _request_200
raise Client.NoConnection(
climada.util.api_client.Client.NoConnection: there is no internet connection and the client has not found any cached result for this request.
It seems an internet connection problem, but my connection is quite stable. Any guess how I could overcome this error? Also, as a second step my goal is to also use Climada Petals which seems to work in a other Climada 3. Would be a problem to install Climada 5?
However when importing climada in python it seems to work:
from climada.hazard import Hazard
from climada.entity import LitPop, ImpactFuncSet, ImpactFunc
from climada.engine import Impact
But when installing Climada Petals in the environment following the instructions:
mamba install -n climada2_env -c conda-forge climada-petals
And trying to import Pentals in python:
from climada_petals.hazard import WildFire
from climada.hazard import Centroids
I got this error:
{
"name": "RuntimeError",
"message": "Cannot find the ecCodes library",
"stack": "---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
Cell In[1], line 1
----> 1 from climada_petals.hazard import WildFire
2 from climada.hazard import Centroids
File c:\\Users\\LuizGALIZIA\\miniforge3\\envs\\climada2_env\\lib\\site-packages\\climada_petals\\hazard\\__init__.py:21
1 \"\"\"
2 This file is part of CLIMADA.
3
(...)
19 init hazard
20 \"\"\"
---> 21 from .tc_tracks_forecast import *
22 from .tc_rainfield import *
23 from .tc_surge_bathtub import *
File c:\\Users\\LuizGALIZIA\\miniforge3\\envs\\climada2_env\\lib\\site-packages\\climada_petals\\hazard\\tc_tracks_forecast.py:35
32 from pathlib import Path
34 # additional libraries
---> 35 import eccodes as ec
36 import lxml.etree as et
37 import numpy as np
File c:\\Users\\LuizGALIZIA\\miniforge3\\envs\\climada2_env\\lib\\site-packages\\eccodes\\__init__.py:13
1 #
2 # (C) Copyright 2017- ECMWF.
3 #
(...)
10 #
11 #
---> 13 from .eccodes import * # noqa
14 from .highlevel import * # noqa
File c:\\Users\\LuizGALIZIA\\miniforge3\\envs\\climada2_env\\lib\\site-packages\\eccodes\\eccodes.py:12
1 #
2 # (C) Copyright 2017- ECMWF.
3 #
(...)
10 #
11 #
---> 12 from gribapi import (
13 CODES_PRODUCT_ANY,
14 CODES_PRODUCT_BUFR,
15 CODES_PRODUCT_GRIB,
16 CODES_PRODUCT_GTS,
17 CODES_PRODUCT_METAR,
18 )
19 from gribapi import GRIB_CHECK as CODES_CHECK
20 from gribapi import GRIB_MISSING_DOUBLE as CODES_MISSING_DOUBLE
File c:\\Users\\LuizGALIZIA\\miniforge3\\envs\\climada2_env\\lib\\site-packages\\gribapi\\__init__.py:13
1 #
2 # (C) Copyright 2017- ECMWF.
3 #
(...)
10 #
11 #
---> 13 from .gribapi import * # noqa
14 from .gribapi import __version__, lib
16 # The minimum recommended version for the ecCodes package
File c:\\Users\\LuizGALIZIA\\miniforge3\\envs\\climada2_env\\lib\\site-packages\\gribapi\\gribapi.py:34
30 from functools import wraps
32 import numpy as np
---> 34 from gribapi.errors import GribInternalError
36 from . import errors
37 from .bindings import ENC
File c:\\Users\\LuizGALIZIA\\miniforge3\\envs\\climada2_env\\lib\\site-packages\\gribapi\\errors.py:16
1 #
2 # (C) Copyright 2017- ECMWF.
3 #
(...)
9 # does it submit to any jurisdiction.
10 #
12 \"\"\"
13 Exception class hierarchy
14 \"\"\"
---> 16 from .bindings import ENC, ffi, lib
19 class GribInternalError(Exception):
20 \"\"\"
21 @brief Wrap errors coming from the C API in a Python exception object.
22
23 Base class for all exceptions
24 \"\"\"
File c:\\Users\\LuizGALIZIA\\miniforge3\\envs\\climada2_env\\lib\\site-packages\\gribapi\\bindings.py:35
33 library_path = findlibs.find(\"eccodes\")
34 if library_path is None:
---> 35 raise RuntimeError(\"Cannot find the ecCodes library\")
37 # default encoding for ecCodes strings
38 ENC = \"ascii\"
RuntimeError: Cannot find the ecCodes library"
}
The test failings are probably due to some external online resources not being available, I would not worry. (the IBTraCs are currently unavailable due to an ongoing TC, this may be related)
For the compatibility with climada_petals, this is a bit trickier, as it is hard to keep track of the dependencies on both packages.
However, looking at your error and via a rapid search, it seems that the ecCode binaries are required for climada petals, and it appears they are not available on windows:
You might want to look a bit further, as this might be outdated.
and makes windows actually usable...
I managed to install Climada Pentals in windows ;) Both eccodes and ecmwflibs are necessary
conda install -c conda-forge eccodes
pip install ecmwflibs
Update: There is a new build of the climada package on conda-forge that is supposed to fix the recent dependency issue with dask #952. For me this leads to
mamba create -n climada2_env -c conda-forge python=3.9 climada
conda activate climada2_env
python -m unittest climada.engine.test.test_impact
running successfully, i.e., printing
...
----------------------------------------------------------------------
Ran 41 tests in 14.825s
OK
at the end. (albeit with python 3.9.20 not 19)
However, climada-petals=5.0 cannot be installed in such an environment. 👎 So - never mind.
Update: now there is a new build for climada-petals as well. At the moment it should be possible to install python 3.9, climada and climada-petals on Windows.
mamba create -n climada2_env -c conda-forge python=3.9 climada, climada-petals
conda activate climada2_env
python -m unittest climada.engine.test.test_impact
python -m unittest climada_petals.hazard.test.test_wildfire
Describe the bug I followed the simple installation instructions for Windows using miniforge prompt and Python version <3.10. After activating the climada environment, the unittest fails, showing the following error: TypeError: descriptor 'call' for 'type' objects doesn't apply to a 'property' object.
To Reproduce Steps to reproduce the behavior/error:
Code example:
Expected behavior A clear and concise description of what you expected to happen.
Screenshots If applicable, add screenshots to help explain your problem.
Climada Version: 5.0.0
System Information (please complete the following information):
Additional context I tried to reinstall fiona proj and also using anaconda command line but still not working