Problem with sentinelhub python api

Hello!

I following this tutorial https://sentinelhub-py.readthedocs.io/en/latest/examples/ogc_request.html#Web-Map-Service-(WMS)-and-Web-Coverage-Service-(WCS) but when I get to step 9 (wms_true_color_img = wms_true_color_request.get_data()) the get_data function gets an error within “dowload.py”,

"

~/.virtualenvs/sentinel/lib/python3.7/site-packages/sentinelhub/download.py in decode_image(data, image_type)
447 else:
448 image = np.asarray(Image.open(bytes_data))
–> 449 image.setflags(write=1) ###Flag Changed
450
451 if image_type is MimeType.JP2:

ValueError: cannot set WRITEABLE flag to True of this array

"

I manage a workarroung setting in line 449 write=0. But I guess there must be something else.

Any help?

I am running Mac OS 10.13.6
Python 3.7.0
sentinelhub 2.4.7

Hi @misael,

the problem is in the latest version of numpy 1.16.0. They have changed something with flag handling and now this is causing problems in sentinelhub-py.

For now a solution would also be to downgrade numpy to e.g. version 1.15.4. We will make the changes in sentinelhub-py and release a new version soon.

Thanks for reporting the problem.

1 Like

Thank you very much for the answer.

I will be waiting the new release.

Is there a bounty for this?

To solve the problem of WRITEABLE flag ,do we have to downgrade only numpy package or any other package also?

Hi @mansimittal06,

Version 2.5.0 of sentinelhub-py has been released last week. In this version the problem with newest numpy version has been solved. Therefore upgrading sentinelhub-py should be the solution.

By the way, lately new versions of multiple other commonly used Python packages were released. Some of them as a response to the changes in numpy. Therefore upgrading all dependency packages might be a good idea.

Let us know if you will still have any problems.

1 Like