I don't use conda - I have python virtual env and R installed.
I don't know if it matters but I'm running on ubuntu for windows (WSL) (might be the cause of my error, might be unrelated).
In the console, it recognized jupyter. Inside R console I installed IRkernel but IRkernel::installspec() gave me the error above (didn't recognize jupyter).
I couldn't find a solution that worked, so I am writing here what solved it for me.
I found the internals of installspec here.
Check before hand where is your jupyter installed with which jupyter
and run R from command line.
Then, run the following code (adjusted from the link above):
srcdir <- system.file('kernelspec', package = 'IRkernel')
tmp_name <- tempfile()
dir.create(tmp_name)
file.copy(srcdir, tmp_name, recursive = TRUE)
spec_path <- file.path(tmp_name, 'kernelspec', 'kernel.json')
library(jsonlite)
spec$argv[[1]] <- file.path(R.home('bin'), 'R')
spec$display_name <- 'R'
write(toJSON(spec, pretty = TRUE, auto_unbox = TRUE), file = spec_path)
args <- c('kernelspec', 'install', '--replace', '--name', 'ir', file.path(tmp_name, 'kernelspec'))
system2('/path/to/jupyter', args) <--- here you copy paste the path you got earlier with pwd
unlink(tmp_name, recursive = TRUE)