简体   繁体   中英

Numpy 1.22.2 Sanity Check error on running Python via reticulate in RMarkdown

I'm trying to run python in RStudio in a RMarkdown file using the reticulate package. I have attached a python conda environment to work in. When I'm trying to import pandas or numpy, I'm getting the following error -

RuntimeError: The current Numpy installation ('/opt/anaconda3/envs/env1/lib/python3.8/site-packages/numpy/__init__.py') fails to pass simple sanity checks. This can be caused for example by incorrect BLAS library being linked in, or by mixing package managers (pip, conda, apt, ...). Search closed numpy issues for similar problems.

I searched far and wide online and could not find an existing solution. I found solutions where it is mentioned that this issue occurs in Numpy=1.19.3, however, I'm using Numpy=1.22.2 and I could not find a solution for my specific use case.

OS: Ubuntu 18.04.6 LTS (Bionic Beaver)

Python: Python 3.8.5

R: 4.1.2

RStudio server version: Version 1.4.1106

R Code that I'm using in the RMarkdown notebook:

{r chunk}
Sys.setenv(RETICULATE_PYTHON = "/opt/anaconda3/envs/env1/bin/python")
library(reticulate)
reticulate::use_condaenv("env1")

{python chunk}
import pandas

This question has been asked in the RCommunity page ( https://community.rstudio.com/t/numpy-install-with-reticulate-fail-sanity-check/141224 ), however has not been answered. Has anyone solved for / can anyone help with this issue? TIA

Reinstalling Numpy using conda instead of pip resolved this issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM