shiny-reticulate-app icon indicating copy to clipboard operation
shiny-reticulate-app copied to clipboard

Error in system2(python, args, stdout = TRUE, stderr = FALSE) : '""' not found

Open Shafi2016 opened this issue 2 years ago • 3 comments

Hi, Thank you for the nice tutorial. I am getting error when I m deploying shiny. Also getting the same when running your codes locally. I have a following set up for python virtual enviroment.

(py36) C:\Users\shafi>where python C:\Users\shafi\anaconda3\envs\py36\python.exe C:\Users\shafi\anaconda3\python.exe

I deployed your shiny app successfully shiny-reticulate-app.

how do you create a virtual environment (example_env_name)? Are you creating this first? Do you create virtual env with python or R? `virtualenv_create(envname = "env22", version = install_python(version = "3.6.0")

Shafi2016 avatar Jan 06 '23 11:01 Shafi2016

I have the same problem

Archarlie2000 avatar Apr 16 '23 05:04 Archarlie2000

I found a solution to that. The .Rprofile is the issue. What .Rprofile essentially acts like an initialization function. As you could have guessed from reading the code inside it, it detects what environment you are running it on. In this case, I assume you and I are running locally. And .Rprofile will only be called when a new session is started.

Here is the step by step solution

  1. go to "tool" "Global Options" Python tab
  2. Copy the python interpreter path (This is where your "real" python is)
  3. go to .Rprofile
  4. In line 31, replace the path from "python3" to the path you just obtained

before Sys.setenv(PYTHON_PATH = 'python3') After Sys.setenv(PYTHON_PATH = 'C:/Users/Owner/AppData/Local/Programs/Python/Python311/python.exe')

  1. Restart the session
  2. re-run the documentation as instructed.

Archarlie2000 avatar Apr 16 '23 22:04 Archarlie2000

Thank you for steps. It works fine locally with me too. I am having issue when deploying it on shiny server.

Shafi2016 avatar Apr 17 '23 00:04 Shafi2016