Skip to content

Commit 83c5767

Browse files
Update setup.py for use as a library
All dependencies are changed to >= dependencies, rather than ==, which make climada suitable for use as a library. In addition, the following changes were made to ensure compatability with lab: - Removed cartopy as a requirement, since it tends to break automation with its requirements on numpy at install time. - Downgrade the version of the following packages to match lab: - cython - geopandas - matplotlib - nbformat - numpy - pillow - xlrd - xlsxwriter - pandas - Change the specified dependence of proj==7.0.0 (which is a c library) to pyproj>=2.6, the python package the exposes proj API bindings in python. - Pin the following dependences (i.e. == instead of >=): - xarray==0.13.0 to stop it from bringing in a pandas>=0.25 dependency - gdal==3.0.4 version, since 3.0.4 is what ships with Ubuntu 20.04. Running higher versions causes compile time problems. - Include explicit dependencies on rtree (optional dep of geopandas) and fsspec (optional dep of dask) This change is not without impact. There are known test failures on the cannoncial lab setup (Ubuntu 20.04, Python 3.8, installed with rebuild-venv.sh), including: - TypeError: visit_Constant() got an unexpected keyword argument 'side' in pandas code. This is a known error with pandas 0.24 when running on python 3.8 which is fixed in 0.25.2. See discussion at: - https://bugzilla.redhat.com/show_bug.cgi?id=1746847 - pandas-dev/pandas#28101 - In pandas, either: AttributeError: 'Series' object has no attribute 'to_numpy' or AttributeError: module 'pandas' has no attribute 'arrays' Both of these refer to pandas functionality introduced in 0.24.0 that is used directly by CLIMADA. - ModuleNotFoundError: No module named 'pyepsg' 'pyepsg' is a wrapper tool that downloads epsg info from the web. This is explicitly excluded in order to prevent production instances from relying on a third party site. - When pandas is reading an excel file, it uses the xlrd library, which references the time.clock() API, which has been long deprecated and was completley removed in Python 3.8. Note that most of these errors could be resolved by bumping the pandas version to 0.25.2, a change which is pending further work in lab.
1 parent df954be commit 83c5767

File tree

1 file changed

+38
-35
lines changed

1 file changed

+38
-35
lines changed

setup.py

Lines changed: 38 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -54,43 +54,46 @@ def package_files(directory):
5454
packages=find_packages(where='.'),
5555

5656
install_requires=[
57-
'bottleneck==1.3.2',
58-
'cartopy==0.18.0',
59-
'cfgrib==0.9.7.7',
60-
'cython==0.29.21',
61-
'dask==2.25.0',
62-
'fiona==1.8.13.post1',
57+
'bottleneck>=1.3.2',
58+
'cfgrib>=0.9.7.7',
59+
'cython>=0.28.2',
60+
'dask>=2.25.0',
61+
'fsspec>=0.3.3', # Needed for dask dataframes
62+
'fiona>=1.8.13.post1',
6363
'gdal==3.0.4',
64-
'geopandas==0.6.1',
65-
'h5py==2.10.0',
66-
'haversine==2.3.0',
67-
'nbconvert==5.6.1',
68-
'nbformat==5.0.7',
69-
'netcdf4==1.5.4',
70-
'numba==0.51.2',
71-
'numpy==1.19.1',
72-
'matplotlib==3.2.2',
73-
'pandas==1.0.5',
74-
'pandas-datareader==0.8.1',
75-
'pillow==7.2.0',
76-
'pint==0.15',
77-
'proj==7.0.0',
78-
'tables==3.6.1',
79-
'rasterio==1.1.5',
80-
'scikit-learn==0.23.2',
81-
'statsmodels==0.11.1',
82-
'tabulate==0.8.7',
83-
'tqdm==4.48.2',
64+
'geopandas>=0.5.0',
65+
'rtree==0.8.3', # Optional geopandas dependency
66+
'h5py>=2.10.0',
67+
'haversine>=2.3.0',
68+
'nbconvert>=5.6.1',
69+
'nbformat>=4.4',
70+
'netcdf4>=1.5.4',
71+
'numba>=0.51.2',
72+
'numpy>=1.18.1',
73+
'matplotlib>=3.1.2',
74+
# Pandas can be a bit of a problem:
75+
#'pandas==1.0.5',
76+
#'pandas-datareader==0.8.1',
77+
'pandas>=0.23.4',
78+
'pandas_datareader>=0.7.0',
79+
'pillow>=7.0.0',
80+
'pint>=0.15',
81+
'pyproj>=2.6.0',
82+
'tables>=3.6.1',
83+
'rasterio>=1.1.5',
84+
'scikit-learn>=0.23.2',
85+
'statsmodels>=0.11.1',
86+
'tabulate>=0.8.7',
87+
'tqdm>=4.48.2',
8488
'xarray==0.13.0',
85-
'xlrd==1.2.0',
86-
'xlsxwriter==1.3.3',
87-
88-
'contextily==1.0.0',
89-
'iso3166==1.0.1',
90-
'overpy==0.4',
91-
'pathos==0.2.6',
92-
'pybufrkit==0.2.17',
93-
'xmlrunner==1.7.7',
89+
'xlrd>=1.1.0',
90+
'xlsxwriter>=1.1.7',
91+
'contextily>=1.0.0',
92+
'iso3166>=1.0.1',
93+
'overpy>=0.4',
94+
'pathos>=0.2.6',
95+
'pybufrkit>=0.2.17',
96+
'xmlrunner>=1.7.7',
9497
],
9598

9699
package_data={'': extra_files},

0 commit comments

Comments
 (0)