0

Context: I was using Python on Atom IDE and installing/importing packages is working normally. Now I would like to work with Python on Rstudio through Reticulate package.

Problem: I'm not able to import Pandas on Rstudio even though a can Import numpy and math. The error is "ModuleNotFoundError: No module named 'pandas'".

i) Python 3.8.5 installed (32 bit) ii) pip3 21.1.2 installed iii) Reticulate 1.2.0 installed iv) Pandas is already installed (~\AppData\Local\Programs\Python\Python38-32\Lib\site-packages)

2 Answers2

0

What does your code block look like for instantiating reticulate?

Here is mine; you should get into the habit of using environments as they will ensure all your packages are there and exactly the version you want.

# load python
library(reticulate)
use_python('C:/Users/Andrew/Anaconda3/')
use_condaenv(condaenv='my_ml', required=TRUE)
library(knitr)
John Stud
  • 1,506
  • 23
  • 46
0

You could have many Python environments.

Check reticulate::py_module_available("pandas").

And, if neccesary, reticulate::py_install("pandas").

crestor
  • 1,388
  • 8
  • 21
  • reticulate::py_install("pandas") worked. But why the installation through pip3 isn't being considered, as I already had installed Pandas using pip3? – Francisco Piccolo Aug 11 '21 at 12:37
  • They are different folders (different environments). `reticulate` needs its own installation. – crestor Aug 11 '21 at 12:47