0

I am trying to source data from a python script to use in R. I am using Articulate and PyCharm.

The script imports the module GetOldTweets3 and runs fine on its own, but when I try to run it using Articulate, I get Exception: ModuleNotFoundError: No module named 'GetOldTweets3'

py_config() gives me:

python:         C:/Users/<username>/AppData/Local/r-miniconda/envs/r-reticulate/python.exe
libpython:      C:/Users/<username>/AppData/Local/r-miniconda/envs/r-reticulate/python36.dll
pythonhome:     C:/Users/<username>/AppData/Local/r-miniconda/envs/r-reticulate
version:        3.6.10 |Anaconda, Inc.| (default, Mar 23 2020, 17:58:33) [MSC v.1916 64 bit (AMD64)]
Architecture:   64bit
numpy:          C:/Users/<username>/AppData/Local/r-miniconda/envs/r-reticulate/Lib/site-packages/numpy
numpy_version:  1.18.1

Running conda list in a terminal shows it there (in the pypi channel).

I am calling the python script using source_python().

SelketDaly
  • 539
  • 1
  • 5
  • 20
  • conda is most likely using a virtual python environment noted by the envs/r-reticulate. My guess is that R is not activating the r-reticulate python virtual environment. This is why it works in conda, but not R. – Kristian Mar 30 '20 at 15:03

1 Answers1

0

Make sure you activate the conda virtual environment

It looks like numpy is installed in your personal r-retuculate python virtual environment. Make sure you activate the virtual environment associated with your installed python packages.

library(reticulate)
use_virtualenv("r-reticulate")
Kristian
  • 482
  • 2
  • 8