Reticulate is an R library that lets you execute Python code from within R. Recently, I attempted to use reticulate to access numpy from Python. Numpy was installed, but I kept getting the following message:
However, I know that numpy was installed:
After some investigation, I discovered that the pip install numpy
was installing a binary version of numpy. Usually, this is good because it is much faster and more reliable than building numpy from source. But, for some reason, on my operating system (Ubuntu 22.04), reticulate could not find numpy. To solve the problem, I forced numpy to be installed from source:
It took several minutes to finish. After installing from source, reticulate was able to find numpy:
I can now use numpy from within my R script: