1

As I tried to install rioxarray by:

pip install rioxarray

I got the following error:

RuntimeError: The current Numpy installation (...) fails to pass a sanity check due to a bug in the windows runtime.

A bit of search ended me up here which suggests downgrading numpy to 1.19.3.

But it didn't work for me.

Are there any further suggestions?

OS: window 10, python:3.8.5

Thank you in advance.

Sajad.sni
  • 187
  • 4
  • 15
  • Does this answer your question? [How do you fix "runtimeError: package fails to pass a sanity check" for numpy and pandas?](https://stackoverflow.com/questions/64654805/how-do-you-fix-runtimeerror-package-fails-to-pass-a-sanity-check-for-numpy-an) – David Buck Apr 10 '21 at 06:05
  • @DavidBuck As I mentioned above unfortunately no it doesn't! – Sajad.sni Apr 30 '21 at 09:32
  • I mention it as the error message "RuntimeError: The current Numpy installation (...) fails to pass a sanity check due to a bug in the windows runtime." is ONLY produced by Numpy 1.19.4, so you may have had two separate issues. That error message must have been related to the Numpy version. – David Buck Apr 30 '21 at 10:18
  • Yes. You are right. After downgrading numpy to 1.19.3 I don't remember if the error message was the same as before. However since the title is about an issue in installing rioxarray and not numpy fail to pass sanity check , the process I went through to solve it can be useful for anybody who face with the same issue. – Sajad.sni Apr 30 '21 at 18:21

4 Answers4

1

Yes, using numpy==1.19.3 will not help in this case. rioxarray can be installed, if you don't mind using anaconda. The installation works without any warnings, conda takes care of all dependencies.

> conda create -n myproj
> conda activate myproj
> conda install -c conda-forge rioxarray

> python 
Python 3.9.1 | packaged by conda-forge | (default, Dec  9 2020, 01:07:06) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>import rioxarray
>>>print(rioxarray.__version__)
0.1.1
lww
  • 624
  • 1
  • 7
  • 14
  • Thank you. It works well using conda. But there should be a reason why this error occurs. – Sajad.sni Dec 10 '20 at 20:33
  • Looks like the fault lies with people who develop these libraries. End users like us can't do much about it. – lww Dec 10 '20 at 22:23
0

By reading over the error message I figured out that the problem actually returns to one of rioxarray's dependencies called rasterio which can not be installed by pip. It is even mentioned in its document that it should be installed by .whl file.

By the way I did all of the following steps to solve this problem. I don't know which one is crucial but doing them as a whole solved mine.

  1. Although I had GDAL installed, I upgrade it to 3.1.4 by its wheel file here.
  2. I installed fiona 1.8.18
  3. I installed rasterio 1.1.8
  4. Then pip install rioxarray

Note 1: For those who don't know how to install .whl file, this link might be helpful. All you need to do is just run pip install <filename>.whl in the file directory.

Note 2: Thanks to lww there is no need of doing so in anaconda environment and installing rioxarray works just fine.

Sajad.sni
  • 187
  • 4
  • 15
0

It works for me (I use python3 and pip3):

  • pip3 install virtualenv
  • python3 -m virtualenv myproj
  • source myproj/bin/activate
  • pip3 install rioxarray
Javad
  • 2,033
  • 3
  • 13
  • 23
0

You can install rioxarray in an isolated context directly in runtime using the instld library.

Install it:

pip install instld

And use like here:

import installed

with installed('rioxarray'):
    from rioxarray import something  # Substitute the correct import.

In this case, rioxarray will be installed in an isolated context, which will be automatically destroyed after exiting the context manager. This is a universal remedy against various incompatibilities of different libraries.

Evgeniy Blinov
  • 351
  • 3
  • 3