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

GDAL 'not available' #507

Closed
ajinkya933 opened this issue Sep 16, 2020 · 9 comments
Closed

GDAL 'not available' #507

ajinkya933 opened this issue Sep 16, 2020 · 9 comments
Labels
question Further information is requested

Comments

@ajinkya933
Copy link

I have installed GDAL through conda:

$ conda install -c conda-forge gdal==2.4.4

I get :

Collecting package metadata (current_repodata.json): done
Solving environment: done

# All requested packages already installed.

After that I installed:

python3 -m pip install pyrasterframes

But, when I run :

from pyrasterframes.utils import gdal_version
print(gdal_version())

I get response:

not available

Why do I get this error. I actually have gdal installed and also import gdal works . Is there a way I can fix tis error ?

@vpipkt
Copy link
Member

vpipkt commented Sep 16, 2020 via email

@ajinkya933
Copy link
Author

ajinkya933 commented Sep 17, 2020

@vpipkt I do:

$ conda info --envs

# conda environments:
#
base                     /opt/conda
some_conda            *  /opt/conda/envs/some_conda

Then I install GDAL

conda install -n some_conda -c conda-forge gdal==2.4.4

After that I activated :

conda activate some_conda
$ python3
Python 3.6.11 | packaged by conda-forge | (default, Jul 23 2020, 22:18:32)
>>> from pyrasterframes.utils import gdal_version
>>> print(gdal_version())

I get this error :

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/conda/envs/some_conda/lib/python3.6/site-packages/pyrasterframes/utils.py", line 106, in gdal_version
    fcn = RFContext.active().lookup("buildInfo")
  File "/opt/conda/envs/some_conda/lib/python3.6/site-packages/pyrasterframes/rf_context.py", line 84, in active
    "RasterFrames have not been enabled for the active session. Call 'SparkSession.withRasterFrames()'.")
AttributeError: RasterFrames have not been enabled for the active session. Call 'SparkSession.withRasterFrames()'.

In order to resolve this error I did:

>>> from pyrasterframes.utils import create_rf_spark_session
>>> from pyrasterframes.utils import gdal_version
>>> spark = create_rf_spark_session()

20/09/17 07:04:40 WARN NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Using Spark's default log4j profile: org/apache/spark/log4j-defaults.properties
Setting default log level to "WARN".
To adjust logging level use sc.setLogLevel(newLevel). For SparkR, use setLogLevel(newLevel).

>>> print(gdal_version())
20/09/17 07:04:54 WARN GDALRasterSource$: GDAL native bindings are not available. Falling back to JVM-based reader for GeoTIFF format.

not available

But still I get the error:

GDAL not available. Why is this ?

@vpipkt vpipkt added the question Further information is requested label Sep 17, 2020
@vpipkt
Copy link
Member

vpipkt commented Sep 17, 2020 via email

@vpipkt
Copy link
Member

vpipkt commented Sep 17, 2020

marking as question until we can show there is some unexpected behavior going on

@vpipkt
Copy link
Member

vpipkt commented Sep 21, 2020

@ajinkya933 did the above resolve your issue/question?

@ajinkya933
Copy link
Author

No

@vpipkt
Copy link
Member

vpipkt commented Sep 23, 2020

Happy to engage on our gitter chat, we can try to work through the details. Feel free to update the issue here with more details about your environment etc. Which OS are you using? And for reference what pyrasterframes version?

My next guess here is that perhaps providing the gdal library path as a JVM option may help. Refer to this thread: #356 (comment)

@tosen1990
Copy link

Why @ajinkya933 closed this issue? Did you fix your problem?
I've got the same error.
Install GDAL 2.4.4 through conda 4.9.2 and macos Catalina version 10.15.6.

@pomadchin
Copy link
Member

pomadchin commented Jan 9, 2021

@tosen1990 since you're using MacOS your issue can not be that easily resolved. We fixed that only in gdal-warp bindings 3.1.1 that is only compatible with GDAL 3.1.x.

Try to depend on GDAL 3.1.x and gdal-warp-bindings 1.1.1, it should resolve your issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants