Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deep-learning-tools2: error when using python with R-notebook and reticulate #18

Open
hannaboe opened this issue Mar 7, 2022 · 6 comments

Comments

@hannaboe
Copy link

hannaboe commented Mar 7, 2022

I installed the deep-learning-tool with this docker-image: quay.io/nird-toolkit/deep-learning-tools2:20220303-cbd3b76. But when I open a R-notebook, I can't run code that uses python (using the reticulate package).

When I run reticulate::py_discover_config() to check which python version is used I get the following error:

Warning message in system2(conda, c("run", in_env, run_args, shQuote(cmd), args), : “running command ''/opt/conda/bin/conda' run --prefix '/opt/conda' --no-capture-output 'python' -c "import os; print(os.environ['PATH'])"' had status 1” Error in Sys.setenv(PATH = new_path): wrong length for argument Traceback:

1. py_discover_config() 2. python_config(python_version, required_module, python_versions) 3. python_munge_path(python) 4. Sys.setenv(PATH = new_path)

And I get a similar error when I run other code that uses python. For example when trying to train a deep learning model using the R-package keras.

@frafra
Copy link
Contributor

frafra commented Mar 16, 2022

It looks that it is trying to use conda, even if it is not installed, for some reason.

Here is what I tried from the R console:

> library('reticulate')
> reticulate::py_discover_config()

Output:

No non-system installation of Python could be found.
Would you like to download and install Miniconda?
Miniconda is an open source environment management system for Python.
See https://docs.conda.io/en/latest/miniconda.html for more details.

Would you like to install Miniconda? [Y/n]: n
Installation aborted.
python:         /usr/bin/python3
libpython:      [NOT FOUND]
pythonhome:     //usr://usr
version:        3.8.10 (default, Nov 26 2021, 20:14:08)  [GCC 9.3.0]
numpy:          [NOT FOUND]

I then tried to install miniconda using: reticulate::install_miniconda(). It seems to work just fine, and it satisfies all dependencies.

@hannaboe
Copy link
Author

hannaboe commented Mar 17, 2022

Now it doesn't find tensorflow anymore because it looks for it in the r-reticulate environment.

Error: Valid installation of TensorFlow not found. Python environments searched for 'tensorflow' package: /home/hbo042/.local/share/r-miniconda/envs/r-reticulate/bin/python3.8 Python exception encountered: ModuleNotFoundError: No module named 'tensorflow'

Should I try to install tensorflow and all other dependencies within this environment?

This wasn't an issue with the 'old' tensorflow1 deep-learning-tool.

@frafra
Copy link
Contributor

frafra commented Mar 17, 2022

You can avoid to use miniconda and just install numpy, so you avoid having a separate environment.

@hannaboe
Copy link
Author

I installed numpy, but that didn't help. I got the same error.
I assumeit is because python is also installed in the r-reticulate environment. It only finds this python installation so it automatically switches to the environment. And tensorflow is not installed in the environment.

@frafra
Copy link
Contributor

frafra commented Mar 17, 2022

Unable to replicate. Feel free to reach me on the phone or just have a meeting.

@frafra
Copy link
Contributor

frafra commented Mar 17, 2022

Fixed by deleting ~/.local/share/r-reticulate, ~/.local/share/r-miniconda.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants