Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

conda recipe fails for windows 11 / WSL2 ubuntu 24.04 #91

Open
joemcglinchy opened this issue Jan 7, 2025 · 9 comments
Open

conda recipe fails for windows 11 / WSL2 ubuntu 24.04 #91

joemcglinchy opened this issue Jan 7, 2025 · 9 comments
Labels
bug Something isn't working

Comments

@joemcglinchy
Copy link

joemcglinchy commented Jan 7, 2025

Environment Information

  • geospatial version: 0.11.2
  • Python version: > 3.9
  • Operating System: Windows 11 / WSL2 ubuntu 24.04

Description

I tried following the conda+mamba recipe to install geospatial, but for python > 3.9 gdal fails to install correctly. I was only able to achieve a successful gdal install with:

conda create -n geo python=3.9
conda activate geo
conda install -c conda-forge mamba
mamba install -c conda-forge geospatial

What I Did

>>> from osgeo import gdal
Traceback (most recent call last):
  File "/home/jmcglinchy/miniconda3/envs/geo/lib/python3.11/site-packages/osgeo/__init__.py", line 50, in swig_import_helper
    return importlib.import_module(mname)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jmcglinchy/miniconda3/envs/geo/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 676, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 573, in module_from_spec
  File "<frozen importlib._bootstrap_external>", line 1233, in create_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
ImportError: /home/jmcglinchy/miniconda3/envs/geo/lib/python3.11/site-packages/osgeo/../../../libgdal.so.35: undefined symbol: sqlite3_total_changes64

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/jmcglinchy/miniconda3/envs/geo/lib/python3.11/site-packages/osgeo/__init__.py", line 55, in <module>
    _gdal = swig_import_helper()
            ^^^^^^^^^^^^^^^^^^^^
  File "/home/jmcglinchy/miniconda3/envs/geo/lib/python3.11/site-packages/osgeo/__init__.py", line 52, in swig_import_helper
    return importlib.import_module('_gdal')
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jmcglinchy/miniconda3/envs/geo/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named '_gdal'

lastly, even with the successful gdal python install, the CLI is broken, as every tool (gdalinfo, gdalwarp, etc.) produce a Segmentation Fault

@joemcglinchy joemcglinchy added the bug Something isn't working label Jan 7, 2025
@giswqs
Copy link
Member

giswqs commented Jan 7, 2025

Thank you for reporting! Can you try installing gdal without geospatial to see if the problem persists?

@joemcglinchy
Copy link
Author

hi, yes I was able to get it to work with something like the following:

conda create -n geo python=3.10 gdal libgdal scikit-image scikit-learn rasterio geopandas rioxarray xarray dask matplotlib seaborn ipyleaflet ipykernel pillow rasterstats shapely

@giswqs
Copy link
Member

giswqs commented Jan 8, 2025

Can you share the gdal versions that were installed with and without the geospatial package?

@joemcglinchy
Copy link
Author

Can you share the gdal versions that were installed with and without the geospatial package?

gdal 3.6.4 with python 3.9, gdal 3.9.3 with python >=3.10 IIRC

@giswqs
Copy link
Member

giswqs commented Jan 8, 2025

What is the gdal version with Python 3.11 that you initially reported?

@joemcglinchy
Copy link
Author

ok i just double checked. with the command i pasted above using python=3.10:

Python 3.10.16
conda list | grep gdal

gdal                      3.6.2           py310h0daa840_9  
libgdal                   3.6.2                he9acc32_9

with python 3.11 using the recipe:

Python 3.11.8
conda list | grep gdal

gdal                      3.9.3           py311h5159542_2    conda-forge
libgdal                   3.9.3               hea5fcb0_14    conda-forge
libgdal-arrow-parquet     3.9.3                h706f8e0_6    conda-forge
libgdal-core              3.9.3                hd5b9bfb_2    conda-forge
libgdal-fits              3.9.3                h2db7d5a_6    conda-forge
libgdal-grib              3.9.3                hba94bef_6    conda-forge
libgdal-hdf4              3.9.3                hbbee16a_6    conda-forge
libgdal-hdf5              3.9.3                hd75530a_6    conda-forge
libgdal-jp2openjpeg       3.9.3                h4d17120_6    conda-forge
libgdal-kea               3.9.3                h5afcd41_6    conda-forge
libgdal-netcdf            3.9.3                h2b12c9b_6    conda-forge
libgdal-pdf               3.9.3                h10c30d1_6    conda-forge
libgdal-pg                3.9.3                h5cc4e75_3    conda-forge
libgdal-postgisraster     3.9.3                h5cc4e75_3    conda-forge
libgdal-tiledb            3.9.3                h24303b0_6    conda-forge
libgdal-xls               3.9.3                h9ae506c_6    conda-forge

@giswqs
Copy link
Member

giswqs commented Jan 8, 2025

So gdal 3.6.x is working and 3.9.3 is not working?

@joemcglinchy
Copy link
Author

it seems a factor of the recipe. If i install gdal directly with the conda environment creation, i'm seeing no issues. If it's not repeatable though, may be a "me" issue :)

@giswqs
Copy link
Member

giswqs commented Jan 8, 2025

gdal is always a bit tricky to install. Certainly not your issue only. I ran into similar issues myself from time to time. Certain gdal version sometime may not work properly on some operating systems. Sometimes I have to pin a specific gdal version, sometimes I have to install gdal from the offical conda channel instead of the conda-forge channel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants