locationtech / rasterframes

Geospatial Raster support for Spark DataFrames
http://rasterframes.io
Apache License 2.0
240 stars 46 forks source link

Installation trouble with gdal dependency #492

Closed csong21 closed 4 years ago

csong21 commented 4 years ago

Thank for you making this package available, I am very eager to test it out.

I'm having a bit of trouble installing the package due to the gdal dependency. Below is the error that I'm getting when pip installing within my conda environment

(earth) Juers-MacBook-Pro-2:~ juersong$ python3 -m pip install pyrasterframes
Collecting pyrasterframes
  Using cached pyrasterframes-0.9.0-py3-none-any.whl (73.8 MB)
Requirement already satisfied: numpy<2.0,>=1.17.3 in ./miniconda3/envs/earth/lib/python3.8/site-packages (from pyrasterframes) (1.18.1)
Requirement already satisfied: pandas<1.0,>=0.25.3 in ./miniconda3/envs/earth/lib/python3.8/site-packages (from pyrasterframes) (0.25.3)
Requirement already satisfied: Shapely>=1.6.0 in ./miniconda3/envs/earth/lib/python3.8/site-packages (from pyrasterframes) (1.7.0)
Requirement already satisfied: pytz in ./miniconda3/envs/earth/lib/python3.8/site-packages (from pyrasterframes) (2020.1)
Requirement already satisfied: pyspark==2.4.5 in ./miniconda3/envs/earth/lib/python3.8/site-packages (from pyrasterframes) (2.4.5)
Requirement already satisfied: deprecation in ./miniconda3/envs/earth/lib/python3.8/site-packages (from pyrasterframes) (2.1.0)
Collecting gdal==2.4.4
  Using cached GDAL-2.4.4.tar.gz (564 kB)
Requirement already satisfied: python-dateutil>=2.6.1 in ./miniconda3/envs/earth/lib/python3.8/site-packages (from pandas<1.0,>=0.25.3->pyrasterframes) (2.8.1)
Requirement already satisfied: py4j==0.10.7 in ./miniconda3/envs/earth/lib/python3.8/site-packages (from pyspark==2.4.5->pyrasterframes) (0.10.7)
Requirement already satisfied: packaging in ./miniconda3/envs/earth/lib/python3.8/site-packages (from deprecation->pyrasterframes) (20.4)
Requirement already satisfied: six>=1.5 in ./miniconda3/envs/earth/lib/python3.8/site-packages (from python-dateutil>=2.6.1->pandas<1.0,>=0.25.3->pyrasterframes) (1.15.0)
Requirement already satisfied: pyparsing>=2.0.2 in ./miniconda3/envs/earth/lib/python3.8/site-packages (from packaging->deprecation->pyrasterframes) (2.4.7)
Building wheels for collected packages: gdal
  Building wheel for gdal (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /Users/juersong/miniconda3/envs/earth/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/tl/z916kdqd34x4f0q5nsh8409h0000gn/T/pip-install-m6coj9u4/gdal/setup.py'"'"'; __file__='"'"'/private/var/folders/tl/z916kdqd34x4f0q5nsh8409h0000gn/T/pip-install-m6coj9u4/gdal/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/tl/z916kdqd34x4f0q5nsh8409h0000gn/T/pip-wheel-5aryh916
       cwd: /private/var/folders/tl/z916kdqd34x4f0q5nsh8409h0000gn/T/pip-install-m6coj9u4/gdal/
  Complete output (37 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-10.9-x86_64-3.8
  copying gdal.py -> build/lib.macosx-10.9-x86_64-3.8
  copying ogr.py -> build/lib.macosx-10.9-x86_64-3.8
  copying osr.py -> build/lib.macosx-10.9-x86_64-3.8
  copying gdalconst.py -> build/lib.macosx-10.9-x86_64-3.8
  copying gdalnumeric.py -> build/lib.macosx-10.9-x86_64-3.8
  creating build/lib.macosx-10.9-x86_64-3.8/osgeo
  copying osgeo/gnm.py -> build/lib.macosx-10.9-x86_64-3.8/osgeo
  copying osgeo/__init__.py -> build/lib.macosx-10.9-x86_64-3.8/osgeo
  copying osgeo/gdalnumeric.py -> build/lib.macosx-10.9-x86_64-3.8/osgeo
  copying osgeo/osr.py -> build/lib.macosx-10.9-x86_64-3.8/osgeo
  copying osgeo/gdal.py -> build/lib.macosx-10.9-x86_64-3.8/osgeo
  copying osgeo/ogr.py -> build/lib.macosx-10.9-x86_64-3.8/osgeo
  copying osgeo/gdal_array.py -> build/lib.macosx-10.9-x86_64-3.8/osgeo
  copying osgeo/gdalconst.py -> build/lib.macosx-10.9-x86_64-3.8/osgeo
  /Users/juersong/miniconda3/envs/earth/lib/python3.8/site-packages/setuptools/lib2to3_ex.py:39: SetuptoolsDeprecationWarning: 2to3 support is deprecated. If the project still requires Python 2 support, please migrate to a single-codebase solution or employ an independent conversion process.
    warnings.warn(
  Fixing build/lib.macosx-10.9-x86_64-3.8/gdal.py build/lib.macosx-10.9-x86_64-3.8/ogr.py build/lib.macosx-10.9-x86_64-3.8/osr.py build/lib.macosx-10.9-x86_64-3.8/gdalconst.py build/lib.macosx-10.9-x86_64-3.8/gdalnumeric.py build/lib.macosx-10.9-x86_64-3.8/osgeo/gnm.py build/lib.macosx-10.9-x86_64-3.8/osgeo/__init__.py build/lib.macosx-10.9-x86_64-3.8/osgeo/gdalnumeric.py build/lib.macosx-10.9-x86_64-3.8/osgeo/osr.py build/lib.macosx-10.9-x86_64-3.8/osgeo/gdal.py build/lib.macosx-10.9-x86_64-3.8/osgeo/ogr.py build/lib.macosx-10.9-x86_64-3.8/osgeo/gdal_array.py build/lib.macosx-10.9-x86_64-3.8/osgeo/gdalconst.py
  Skipping optional fixer: ws_comma
  Fixing build/lib.macosx-10.9-x86_64-3.8/gdal.py build/lib.macosx-10.9-x86_64-3.8/ogr.py build/lib.macosx-10.9-x86_64-3.8/osr.py build/lib.macosx-10.9-x86_64-3.8/gdalconst.py build/lib.macosx-10.9-x86_64-3.8/gdalnumeric.py build/lib.macosx-10.9-x86_64-3.8/osgeo/gnm.py build/lib.macosx-10.9-x86_64-3.8/osgeo/__init__.py build/lib.macosx-10.9-x86_64-3.8/osgeo/gdalnumeric.py build/lib.macosx-10.9-x86_64-3.8/osgeo/osr.py build/lib.macosx-10.9-x86_64-3.8/osgeo/gdal.py build/lib.macosx-10.9-x86_64-3.8/osgeo/ogr.py build/lib.macosx-10.9-x86_64-3.8/osgeo/gdal_array.py build/lib.macosx-10.9-x86_64-3.8/osgeo/gdalconst.py
  Skipping optional fixer: ws_comma
  running build_ext
  gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/juersong/miniconda3/envs/earth/include -I/Users/juersong/miniconda3/envs/earth/include -Wno-error=unused-command-line-argument-hard-error-in-future -Wno-error=unused-command-line-argument-hard-error-in-future -Wno-error=unused-command-line-argument-hard-error-in-future -I../../port -I../../gcore -I../../alg -I../../ogr/ -I../../ogr/ogrsf_frmts -I../../gnm -I../../apps -I/Users/juersong/miniconda3/envs/earth/include/python3.8 -I/Users/juersong/miniconda3/envs/earth/lib/python3.8/site-packages/numpy/core/include -I/usr/local/Cellar/gdal/2.4.4_7/include -c gdal_python_cxx11_test.cpp -o gdal_python_cxx11_test.o
  gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/juersong/miniconda3/envs/earth/include -I/Users/juersong/miniconda3/envs/earth/include -Wno-error=unused-command-line-argument-hard-error-in-future -Wno-error=unused-command-line-argument-hard-error-in-future -Wno-error=unused-command-line-argument-hard-error-in-future -I../../port -I../../gcore -I../../alg -I../../ogr/ -I../../ogr/ogrsf_frmts -I../../gnm -I../../apps -I/Users/juersong/miniconda3/envs/earth/include/python3.8 -I/Users/juersong/miniconda3/envs/earth/lib/python3.8/site-packages/numpy/core/include -I/usr/local/Cellar/gdal/2.4.4_7/include -c gdal_python_cxx11_test.cpp -o gdal_python_cxx11_test.o -std=c++11
  building 'osgeo._gdal' extension
  creating build/temp.macosx-10.9-x86_64-3.8
  creating build/temp.macosx-10.9-x86_64-3.8/extensions
  gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/juersong/miniconda3/envs/earth/include -I/Users/juersong/miniconda3/envs/earth/include -Wno-error=unused-command-line-argument-hard-error-in-future -Wno-error=unused-command-line-argument-hard-error-in-future -Wno-error=unused-command-line-argument-hard-error-in-future -I../../port -I../../gcore -I../../alg -I../../ogr/ -I../../ogr/ogrsf_frmts -I../../gnm -I../../apps -I/Users/juersong/miniconda3/envs/earth/include/python3.8 -I/Users/juersong/miniconda3/envs/earth/lib/python3.8/site-packages/numpy/core/include -I/usr/local/Cellar/gdal/2.4.4_7/include -c extensions/gdal_wrap.cpp -o build/temp.macosx-10.9-x86_64-3.8/extensions/gdal_wrap.o -I/usr/local/Cellar/gdal/2.4.4_7/include
  cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
  cc1plus: error: -Werror=unused-command-line-argument-hard-error-in-future: no option -Wunused-command-line-argument-hard-error-in-future
  cc1plus: error: -Werror=unused-command-line-argument-hard-error-in-future: no option -Wunused-command-line-argument-hard-error-in-future
  cc1plus: error: -Werror=unused-command-line-argument-hard-error-in-future: no option -Wunused-command-line-argument-hard-error-in-future
  error: command 'gcc' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for gdal
  Running setup.py clean for gdal
Failed to build gdal
Installing collected packages: gdal, pyrasterframes
    Running setup.py install for gdal ... error
    ERROR: Command errored out with exit status 1:
     command: /Users/juersong/miniconda3/envs/earth/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/tl/z916kdqd34x4f0q5nsh8409h0000gn/T/pip-install-m6coj9u4/gdal/setup.py'"'"'; __file__='"'"'/private/var/folders/tl/z916kdqd34x4f0q5nsh8409h0000gn/T/pip-install-m6coj9u4/gdal/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/tl/z916kdqd34x4f0q5nsh8409h0000gn/T/pip-record-j1wjnxfv/install-record.txt --single-version-externally-managed --compile --install-headers /Users/juersong/miniconda3/envs/earth/include/python3.8/gdal
         cwd: /private/var/folders/tl/z916kdqd34x4f0q5nsh8409h0000gn/T/pip-install-m6coj9u4/gdal/
    Complete output (37 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.9-x86_64-3.8
    copying gdal.py -> build/lib.macosx-10.9-x86_64-3.8
    copying ogr.py -> build/lib.macosx-10.9-x86_64-3.8
    copying osr.py -> build/lib.macosx-10.9-x86_64-3.8
    copying gdalconst.py -> build/lib.macosx-10.9-x86_64-3.8
    copying gdalnumeric.py -> build/lib.macosx-10.9-x86_64-3.8
    creating build/lib.macosx-10.9-x86_64-3.8/osgeo
    copying osgeo/gnm.py -> build/lib.macosx-10.9-x86_64-3.8/osgeo
    copying osgeo/__init__.py -> build/lib.macosx-10.9-x86_64-3.8/osgeo
    copying osgeo/gdalnumeric.py -> build/lib.macosx-10.9-x86_64-3.8/osgeo
    copying osgeo/osr.py -> build/lib.macosx-10.9-x86_64-3.8/osgeo
    copying osgeo/gdal.py -> build/lib.macosx-10.9-x86_64-3.8/osgeo
    copying osgeo/ogr.py -> build/lib.macosx-10.9-x86_64-3.8/osgeo
    copying osgeo/gdal_array.py -> build/lib.macosx-10.9-x86_64-3.8/osgeo
    copying osgeo/gdalconst.py -> build/lib.macosx-10.9-x86_64-3.8/osgeo
    /Users/juersong/miniconda3/envs/earth/lib/python3.8/site-packages/setuptools/lib2to3_ex.py:39: SetuptoolsDeprecationWarning: 2to3 support is deprecated. If the project still requires Python 2 support, please migrate to a single-codebase solution or employ an independent conversion process.
      warnings.warn(
    Fixing build/lib.macosx-10.9-x86_64-3.8/gdal.py build/lib.macosx-10.9-x86_64-3.8/ogr.py build/lib.macosx-10.9-x86_64-3.8/osr.py build/lib.macosx-10.9-x86_64-3.8/gdalconst.py build/lib.macosx-10.9-x86_64-3.8/gdalnumeric.py build/lib.macosx-10.9-x86_64-3.8/osgeo/gnm.py build/lib.macosx-10.9-x86_64-3.8/osgeo/__init__.py build/lib.macosx-10.9-x86_64-3.8/osgeo/gdalnumeric.py build/lib.macosx-10.9-x86_64-3.8/osgeo/osr.py build/lib.macosx-10.9-x86_64-3.8/osgeo/gdal.py build/lib.macosx-10.9-x86_64-3.8/osgeo/ogr.py build/lib.macosx-10.9-x86_64-3.8/osgeo/gdal_array.py build/lib.macosx-10.9-x86_64-3.8/osgeo/gdalconst.py
    Skipping optional fixer: ws_comma
    Fixing build/lib.macosx-10.9-x86_64-3.8/gdal.py build/lib.macosx-10.9-x86_64-3.8/ogr.py build/lib.macosx-10.9-x86_64-3.8/osr.py build/lib.macosx-10.9-x86_64-3.8/gdalconst.py build/lib.macosx-10.9-x86_64-3.8/gdalnumeric.py build/lib.macosx-10.9-x86_64-3.8/osgeo/gnm.py build/lib.macosx-10.9-x86_64-3.8/osgeo/__init__.py build/lib.macosx-10.9-x86_64-3.8/osgeo/gdalnumeric.py build/lib.macosx-10.9-x86_64-3.8/osgeo/osr.py build/lib.macosx-10.9-x86_64-3.8/osgeo/gdal.py build/lib.macosx-10.9-x86_64-3.8/osgeo/ogr.py build/lib.macosx-10.9-x86_64-3.8/osgeo/gdal_array.py build/lib.macosx-10.9-x86_64-3.8/osgeo/gdalconst.py
    Skipping optional fixer: ws_comma
    running build_ext
    gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/juersong/miniconda3/envs/earth/include -I/Users/juersong/miniconda3/envs/earth/include -Wno-error=unused-command-line-argument-hard-error-in-future -Wno-error=unused-command-line-argument-hard-error-in-future -Wno-error=unused-command-line-argument-hard-error-in-future -I../../port -I../../gcore -I../../alg -I../../ogr/ -I../../ogr/ogrsf_frmts -I../../gnm -I../../apps -I/Users/juersong/miniconda3/envs/earth/include/python3.8 -I/Users/juersong/miniconda3/envs/earth/lib/python3.8/site-packages/numpy/core/include -I/usr/local/Cellar/gdal/2.4.4_7/include -c gdal_python_cxx11_test.cpp -o gdal_python_cxx11_test.o
    gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/juersong/miniconda3/envs/earth/include -I/Users/juersong/miniconda3/envs/earth/include -Wno-error=unused-command-line-argument-hard-error-in-future -Wno-error=unused-command-line-argument-hard-error-in-future -Wno-error=unused-command-line-argument-hard-error-in-future -I../../port -I../../gcore -I../../alg -I../../ogr/ -I../../ogr/ogrsf_frmts -I../../gnm -I../../apps -I/Users/juersong/miniconda3/envs/earth/include/python3.8 -I/Users/juersong/miniconda3/envs/earth/lib/python3.8/site-packages/numpy/core/include -I/usr/local/Cellar/gdal/2.4.4_7/include -c gdal_python_cxx11_test.cpp -o gdal_python_cxx11_test.o -std=c++11
    building 'osgeo._gdal' extension
    creating build/temp.macosx-10.9-x86_64-3.8
    creating build/temp.macosx-10.9-x86_64-3.8/extensions
    gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/juersong/miniconda3/envs/earth/include -I/Users/juersong/miniconda3/envs/earth/include -Wno-error=unused-command-line-argument-hard-error-in-future -Wno-error=unused-command-line-argument-hard-error-in-future -Wno-error=unused-command-line-argument-hard-error-in-future -I../../port -I../../gcore -I../../alg -I../../ogr/ -I../../ogr/ogrsf_frmts -I../../gnm -I../../apps -I/Users/juersong/miniconda3/envs/earth/include/python3.8 -I/Users/juersong/miniconda3/envs/earth/lib/python3.8/site-packages/numpy/core/include -I/usr/local/Cellar/gdal/2.4.4_7/include -c extensions/gdal_wrap.cpp -o build/temp.macosx-10.9-x86_64-3.8/extensions/gdal_wrap.o -I/usr/local/Cellar/gdal/2.4.4_7/include
    cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
    cc1plus: error: -Werror=unused-command-line-argument-hard-error-in-future: no option -Wunused-command-line-argument-hard-error-in-future
    cc1plus: error: -Werror=unused-command-line-argument-hard-error-in-future: no option -Wunused-command-line-argument-hard-error-in-future
    cc1plus: error: -Werror=unused-command-line-argument-hard-error-in-future: no option -Wunused-command-line-argument-hard-error-in-future
    error: command 'gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /Users/juersong/miniconda3/envs/earth/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/tl/z916kdqd34x4f0q5nsh8409h0000gn/T/pip-install-m6coj9u4/gdal/setup.py'"'"'; __file__='"'"'/private/var/folders/tl/z916kdqd34x4f0q5nsh8409h0000gn/T/pip-install-m6coj9u4/gdal/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/tl/z916kdqd34x4f0q5nsh8409h0000gn/T/pip-record-j1wjnxfv/install-record.txt --single-version-externally-managed --compile --install-headers /Users/juersong/miniconda3/envs/earth/include/python3.8/gdal Check the logs for full command output.

Not sure why there is an error with cc1plus: error: -Werror=unused-command-line-argument-hard-error-in-future: no option -Wunused-command-line-argument-hard-error-in-future. I already have gdal 2.4.4_7 installed with homebrew, but I'm a bit confused why gdal is being rebuilt in this install. Is there any way to just skip the gdal build step? Thanks!

vpipkt commented 4 years ago

Interesting. I suspect that this may be some problem with conda not recognizing the existing GDAL installation. I suspect a simple path for you may be to install pyrasterframes in a virtual environment. Would that meet your need?

vpipkt commented 4 years ago

If you need to proceed with Conda, I would recommend trying to install gdal first with conda install --channel conda-forge gdal, then try to python3 -m pip install pyrasterframes.

yurigba commented 4 years ago

Gdal has to be version 2.4.4 so it may be necessary to run conda install -c conda-forge gdal==2.4.4. This solved my issue here.

vpipkt commented 4 years ago

Thank you so much @yurigba. That is correct. Can you confirm if you did this on Mac OS X?

vpipkt commented 4 years ago

@csong21 if these steps help you resolve your issue, please let us know here so we can close issue if applicable. Let us know if you continue to have trouble and we'll do our best to help you get it resolved. Thanks!

yurigba commented 4 years ago

@vpipkt This was done on Fedora 32.

csong21 commented 4 years ago

@vpipkt I did what you said and it worked. Thanks!

I also used Docker yesterday instead and that worked too.

vpipkt commented 4 years ago

Great, glad you got it up and going!

On Tue, Jun 9, 2020 at 7:39 PM Cecelia (Juer) Song notifications@github.com wrote:

@vpipkt https://github.com/vpipkt I did what you said and it worked. Thanks!

I also used Docker yesterday instead and that worked too.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/locationtech/rasterframes/issues/492#issuecomment-641635974, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB3P4L6JQID7MHGOMIGTMTDRV3B3XANCNFSM4NY4JOUQ .