Error retrieving requested Python version through R


This might be a really stupid question but I am trying to load Python into R and I am getting an error. I am using R markdown if that helps.


use_python("/Applications/Python 3.8", required = TRUE)

Error in use_python("/Applications/Python 3.8", required = TRUE) : failed to initialize requested version of Python

I am using a Mac. I'm not sure what I'm doing wrong. Any help would be appreciated!

Please, try this.

Thanks for pointing this out to me. I tried that and the comment below that had to do with Macs specifically and neither worked.

I figured it out using the below code on a Mac:

Sys.setenv(RETICULATE_PYTHON = "/usr/local/bin/python3")

#Restart R, then run this block.
#Then run the py_config() to make sure the correct version of Python is being used.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.