Reticulate does not work too well in the presence of multiple versions of Python, from what I understand. There are supposed to be improvements on the way, you might find them in the GitHub repository.
---
title: "R Notebook"
output: html_notebook
---
```{r}
library(reticulate)
use_python("/usr/bin/python3")
```
```{python}
x = [5, 6, 7, 8]
for i, j in enumerate(x):
print(i, 'th element of x is', j)
```
```{r}
library(reticulate)
use_python("/usr/bin/python3")
```
```{python}
x = [5, 6, 7, 8]
for i, j in enumerate(x):
print(i, 'th element of x is', j)
```
I get this:
Error in initialize_python(required_module, use_environment) :
Python shared library '/usr/lib/libpython3.5.so' not found, Python bindings not loaded.
I believe this is happening because the system package libpython3-dev is not installed.
We will look into adding this in the next quarterly update of the base image.
I don't know whether you'll be able to see these changes directly or not. So, I'm making a copy into a new space and sharing the project link. Hopefully, you'll be able to access it.
Which version of reticulate did you install?
I removed and I installed again reticulate in the project: https://rstudio.cloud/project/224848
As you can see there, the version installed is 1.1 from CRAN
However, it is still not working.
Is it possible that somehow, your whole Rstudio cloud account has something different from the others?
I'm pretty sure it's not the case. Why? I just tried once again in the project that I derived from yours, and failed. Reinstalling didn't work this time.
I was trying to open a new project by myself, and failed. I got curious and noted that in all the previous projects (where I succeeded), I've installed keras there. When one installs keras, loads it and run install_keras(), which will do the following as per this documentation:
The Keras R interface uses the TensorFlow backend engine by default. To install both the core Keras library as well as the TensorFlow backend use the install_keras() function:
library(keras)
install_keras()
This will provide you with default CPU-based installations of Keras and TensorFlow.
Anyway, I noted that I succeeded to run the same code (which failed before installing keras). I don't why it's happening. Let me know whether this works for you as well or not.
And, someone please let me know the correct way to share a project. I created a new space named Other Space, changed access to Shared with initial role as Contributor and then shared the project link after changing Who can view this project to Everyone in Other Space, but enric can't access it. So, I must be missing something.