vascobnunes / fetchLandsatSentinelFromGoogleCloud

Find and download Landsat and Sentinel-2 data from the public Google Cloud
https://vascobnunes.github.io/fetchLandsatSentinelFromGoogleCloud/
MIT License
52 stars 22 forks source link

Problem installing geopandas (fiona package) #56

Open vascobnunes opened 3 years ago

vascobnunes commented 3 years ago

When I upgrade fels with pip (pip install fels --upgrade), I'm getting an error with the instalation of geopandas:

Collecting fiona>=1.8 (from geopandas->fels)
  Using cached https://files.pythonhosted.org/packages/a0/d9/6042aeb073d11341f7726de0586ff71c13117c34959dcf07bd4ee6d4b93e/Fiona-1.8.19.tar.gz
    ERROR: Complete output from command python setup.py egg_info:
    ERROR: A GDAL API version must be specified. Provide a path to gdal-config using a GDAL_CONFIG environment variable or use a GDAL_VERSION environment variable.
    ----------------------------------------
ERROR: Command "python setup.py egg_info" failed with error code 1 in C:\Users\vbnunes\AppData\Local\Temp\pip-install-m3kb10cx\fiona\
vascobnunes commented 3 years ago

@matt-bernstein did you have this at any point? This issue seems something we could prevent with some tests in tox, as you refered in #49.

matt-bernstein commented 3 years ago

I don't think so... the following tests work for me.

Installing in new env:

matthew.bernstein@lud:~$ conda create -n fels_test python=3.7
matthew.bernstein@lud:~$ conda activate fels_test
(fels_test) matthew.bernstein@lud:~$ conda config --add channels conda-forge
(fels_test) matthew.bernstein@lud:~$ conda install gdal
(fels_test) matthew.bernstein@lud:~$ pip install fels
(fels_test) matthew.bernstein@lud:~$ conda deactivate  # sometimes required to set pythonpath correctly in new envs... run `type -a python` to see if you need this
matthew.bernstein@lud:~$ conda deactivate
matthew.bernstein@lud:~$ conda activate fels_test
(fels_test) matthew.bernstein@lud:~$ python
Python 3.7.10 (default, Feb 26 2021, 18:47:35) 
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import fels
>>> fels.safedir_to_datetime('S2A_MSIL1C_20161221T085352_N0204_R107_T33KWP_20161221T091140.SAFE')
datetime.datetime(2016, 12, 21, 8, 53, 52)
>>> 
(fels_test) matthew.bernstein@lud:~$ 

Upgrading in new env:

matthew.bernstein@lud:~$ conda remove --name fels_test --all
matthew.bernstein@lud:~$ conda create -n fels_test python=3.7
matthew.bernstein@lud:~$ conda activate fels_test
(fels_test) matthew.bernstein@lud:~$ conda config --add channels conda-forge
(fels_test) matthew.bernstein@lud:~$ conda install gdal
(fels_test) matthew.bernstein@lud:~$ pip install fels==1.3.7
(fels_test) matthew.bernstein@lud:~$ pip install --upgrade fels
(fels_test) matthew.bernstein@lud:~$ python
Python 3.7.10 | packaged by conda-forge | (default, Feb 19 2021, 16:07:37) 
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import fels
>>> fels.safedir_to_datetime('S2A_MSIL1C_20161221T085352_N0204_R107_T33KWP_20161221T091140.SAFE')
datetime.datetime(2016, 12, 21, 8, 53, 52)
>>> 
(fels_test) matthew.bernstein@lud:~$ 

You're right though, this is what tests are for. Especially when gdal is involved.

vascobnunes commented 3 years ago

Have you tried it on windows? I only managed to install in windows with fiona 1.7.13

matt-bernstein commented 3 years ago

No, I don't have access to a windows machine. You can try adding fiona==1.7 to setup.py's install_requires. If that doesn't work, we may have to add geopandas as an external conda dependency like gdal is.

Here is what looks like the same issue

Erotemic commented 2 years ago

62 somewhat closes this issue. It adds a section to the README that informs the user they need to use conda to install fiona/gdal/geopandas/shapely before they pip install fels.

It also adds a windows CI step to the dashboard, which verifies that this does fix the issue.

As I previously mentioned, the underlying problem is that pip is pretty loose with its handling of binaries. Either the wheel provides them, or pip assumes you have a development environment setup that can compile the package from a source tarball. For gdal/fiona this is usually not the case. On the other hand, conda servers maintain binary packages, so you can install from their servers directly (although then you are pigeonholed into conda, which comes with it's own issues, but for win32 it's a reasonable solution).