1

So I am just starting a data science/stats class and I am trying to setup a R notebook within Dataspell I am able to create a Jupyter notbook but it only wants a python interpreter and I can't seem to change the interpreter to R

dataspell

python

enter image description here

I only allows me to set a python interpreter. I am able to run R files just fine but I am trying to do it in a notebook. (Whether that be Jupyter or some other notebook I couldn't care less)

I would like to stick to Jetbrains IDE's either Dataspell or Pycharm. I tried our Datalore and got an R notebook working but its really slow for me.

ThatPurpleGuy
  • 426
  • 7
  • 20

2 Answers2

3

Actually, there's an (currently - as of May 2022) undocumented feature in Dataspell 2022.1 which they have been developing which supports R kernels in Dataspell as an IDE.

If you have an Conda environment which has R and the irkernel installed and configured (for instance, if you set up your Anaconda environment to run Jupyter notebooks with the R kernel), you can open existing R notebooks in Dataspell and run them just like Python notebooks. The only thing you can't do is create new ones, sadly.

Basically, just use Anaconda or Miniconda to create an environment which can run Jupyter notebooks with the irkernel, create your notebooks in Jupyter, then point your Dataspell directory at it and it should work.

They do mention that it's a developing feature - so if you encounter bugs, you can flag them in the Dataspell issue tracker. I tried it and it worked pretty well so far.

You can see an example of my R kernel running in Dataspell here: Example

  • I tried what you suggest here, thanks. However, when I try to open the notebook I created i Jupyter Lab in Data Spell, nothing happens. I get all the R windows in Data Spell, such as console and plots, but the notebook is not opened. I work with Data Spell 2022.2 Update: It works now, after I shut down anaconda and the running jupyterlab and restarted Data Spell. A good workaround until Data Spell will let us create R notebooks. – jory Aug 07 '22 at 19:40
  • Here's how I was able to make it work: after reading above and installing irkernel in Anaconda, I was able to create a notebook in Data Spell, click the "Open in Browser" link, then in Jupyter change the kernel to R and save the notebook, next reopen the notebook in Data Spell and the option to change the interpreter to R in the top drop down was available. Data Spell 2022.1.4 and R 4.2.1. – sublucent Aug 16 '22 at 23:21
  • Did you created a conda environment in DataSpell in the first place? – Jia Gao Jul 28 '23 at 23:47
1

DataSpell can be a little difficult to navigate. In any case, File>New... pops up a menu:

New Popup Menu

Pick "RMarkdown File", which your purposes will work the same as a notebook. RStudio has both markdown and notebook options, but they still have an Rmd extension.

You should also see a R Console button at the bottom of the screen.

John Morris
  • 396
  • 2
  • 10
  • I actually have exactly the same issue as this, but the answer below will not suit my needs. Any suggestions? – Jonathan Graves May 04 '22 at 20:03
  • Hi John, I can get your solution to work in Pycharm, but in DataSpell, I need help getting the conda environment to be listed as an alternative interpreter. I can create conda environment in DataSpell, which can be confirmed in anaconda3\envs. but Dataspell does not list it in the Python Interpreter UI. Do you have any suggestions? – Jia Gao Jul 28 '23 at 23:30