I am a brand new Jupyter Notebook user. I've been trying to run R and Python from the same Notebook as I want to use some arcgis funtions through python and rest of the data analysis in R. I have followed all the steps mentioned here - How to program with Python and R in the same Jupyter notebook
After completing all the steps I went back and tried to run the following in Jupyter Notebook
%load_ext rpy2.ipython
It throws a long error code that ends with "RuntimeError: R_USER not defined."
I have searched, and every result leads me to changing the environmental variable like this one - How to set environment variable R_User? And how to get module winreg?
I have already done that. These are some screenshot
At this point, I'm not really sure what else I can do. Has anyone come across this? Any direction would be helpful.
The detailed error message if anyone is interested
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
<ipython-input-24-da667892317d> in <module>
----> 1 get_ipython().run_line_magic('load_ext', 'rpy2.ipython')
2
3 ##you only have to run it once. Takes a while to run. So, if this step has once been completed on your machine, feel free to comment out, or not run this cell
~\Anaconda3\envs\avenue\lib\site-packages\IPython\core\interactiveshell.py in run_line_magic(self, magic_name, line, _stack_depth)
2342 kwargs['local_ns'] = self.get_local_scope(stack_depth)
2343 with self.builtin_trap:
-> 2344 result = fn(*args, **kwargs)
2345 return result
2346
~\Anaconda3\envs\avenue\lib\site-packages\decorator.py in fun(*args, **kw)
230 if not kwsyntax:
231 args, kw = fix(args, kw, sig)
--> 232 return caller(func, *(extras + args), **kw)
233 fun.__name__ = func.__name__
234 fun.__doc__ = func.__doc__
~\Anaconda3\envs\avenue\lib\site-packages\IPython\core\magic.py in <lambda>(f, *a, **k)
185 # but it's overkill for just that one bit of state.
186 def magic_deco(arg):
--> 187 call = lambda f, *a, **k: f(*a, **k)
188
189 if callable(arg):
~\Anaconda3\envs\avenue\lib\site-packages\IPython\core\magics\extension.py in load_ext(self, module_str)
31 if not module_str:
32 raise UsageError('Missing module name.')
---> 33 res = self.shell.extension_manager.load_extension(module_str)
34
35 if res == 'already loaded':
~\Anaconda3\envs\avenue\lib\site-packages\IPython\core\extensions.py in load_extension(self, module_str)
78 if module_str not in sys.modules:
79 with prepended_to_syspath(self.ipython_extension_dir):
---> 80 mod = import_module(module_str)
81 if mod.__file__.startswith(self.ipython_extension_dir):
82 print(("Loading extensions from {dir} is deprecated. "
~\Anaconda3\envs\avenue\lib\importlib\__init__.py in import_module(name, package)
125 break
126 level += 1
--> 127 return _bootstrap._gcd_import(name[level:], package, level)
128
129
~\Anaconda3\envs\avenue\lib\importlib\_bootstrap.py in _gcd_import(name, package, level)
~\Anaconda3\envs\avenue\lib\importlib\_bootstrap.py in _find_and_load(name, import_)
~\Anaconda3\envs\avenue\lib\importlib\_bootstrap.py in _find_and_load_unlocked(name, import_)
~\Anaconda3\envs\avenue\lib\importlib\_bootstrap.py in _load_unlocked(spec)
~\Anaconda3\envs\avenue\lib\importlib\_bootstrap_external.py in exec_module(self, module)
~\Anaconda3\envs\avenue\lib\importlib\_bootstrap.py in _call_with_frames_removed(f, *args, **kwds)
~\Anaconda3\envs\avenue\lib\site-packages\rpy2\ipython\__init__.py in <module>
----> 1 from .rmagic import load_ipython_extension
~\Anaconda3\envs\avenue\lib\site-packages\rpy2\ipython\rmagic.py in <module>
52
53 import rpy2.rinterface as ri
---> 54 import rpy2.robjects as ro
55 import rpy2.robjects.packages as rpacks
56 from rpy2.robjects.conversion import (Converter,
~\Anaconda3\envs\avenue\lib\site-packages\rpy2\robjects\__init__.py in <module>
17 import rpy2.rlike.container as rlc
18
---> 19 from rpy2.robjects.robject import RObjectMixin, RObject
20 from rpy2.robjects.vectors import (BoolVector,
21 IntVector,
~\Anaconda3\envs\avenue\lib\site-packages\rpy2\robjects\robject.py in <module>
4 import rpy2.rinterface
5
----> 6 rpy2.rinterface.initr()
7
8 from . import conversion
~\Anaconda3\envs\avenue\lib\site-packages\rpy2\rinterface\__init__.py in initr(r_preservehash)
206 """"Wrapper around rpy2.rinterface._rinterface.initr()."""
207 atexit.register(endr, 0)
--> 208 _initr(r_preservehash=r_preservehash)
209
210 # def cleanUp(saveact, status, runlast):
RuntimeError: R_USER not defined.