1

I'm building a site which contains lot of optimization work and all those work are done in R language. I'm building whole site on Django. Is there any way I can connect both R code and Django or what should I do here ?

I tried installing rpy2 which works fine in python but in Django I'm getting a error:

  File "F:\django-app\restapi\views.py", line 25, in <module>
  import rpy2.robjects as robjects
  File "F:\django-app\venv\lib\site-packages\rpy2\robjects\__init__.py", line 19, in <module>
    from rpy2.robjects.robject import RObjectMixin, RObject
  File "F:\django-app\venv\lib\site-packages\rpy2\robjects\robject.py", line 6, in <module>
    rpy2.rinterface.initr()
  File "F:\django-app\venv\lib\site-packages\rpy2\rinterface\__init__.py", line 208, in initr
    initr(r_preservehash=r_preservehash)
 RuntimeError: R_USER not defined.

what's the best option to do this. Is there any thing I'm missing here?

naive_user
  • 119
  • 8

1 Answers1

0

Have you tried forcing WSGI use the first Django sub interpreter?

Check this article.

General Grievance
  • 4,555
  • 31
  • 31
  • 45