oloBion / Retip

Retip - Retention Time prediction for metabolomics
31 stars 16 forks source link

error while running fit.keras #9

Closed TalWac closed 3 years ago

TalWac commented 3 years ago

Dear Developers,

I'm following the explanation in the retip and reached till the Building QSAR models:.

There, when running:

keras <- fit.keras(training,testing)

Receive this error:

2021-02-15 17:28:40.887108: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cudart64_101.dll'; dlerror: cudart64_101.dll not found 2021-02-15 17:28:40.887560: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine. Error:

And when trying again:

`

keras <- fit.keras(training,testing) 2021-02-15 17:29:17.094035: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library nvcuda.dll 2021-02-15 17:29:17.130586: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1561] Found device 0 with properties: pciBusID: 0000:02:00.0 name: GeForce GT 710 computeCapability: 3.5 coreClock: 0.954GHz coreCount: 1 deviceMemorySize: 2.00GiB deviceMemoryBandwidth: 11.92GiB/s 2021-02-15 17:29:17.133583: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cudart64_101.dll'; dlerror: cudart64_101.dll not found 2021-02-15 17:29:17.135754: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cublas64_10.dll'; dlerror: cublas64_10.dll not found 2021-02-15 17:29:17.137999: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cufft64_10.dll'; dlerror: cufft64_10.dll not found 2021-02-15 17:29:17.140565: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'curand64_10.dll'; dlerror: curand64_10.dll not found 2021-02-15 17:29:17.142849: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cusolver64_10.dll'; dlerror: cusolver64_10.dll not found 2021-02-15 17:29:17.145072: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cusparse64_10.dll'; dlerror: cusparse64_10.dll not found 2021-02-15 17:29:17.147183: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cudnn64_7.dll'; dlerror: cudnn64_7.dll not found 2021-02-15 17:29:17.147632: W tensorflow/core/common_runtime/gpu/gpu_device.cc:1598] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow the guide at https://www.tensorflow.org/install/gpu for how to download and setup the required libraries for your platform. Skipping registering GPU devices... 2021-02-15 17:29:17.149085: I tensorflow/core/platform/cpu_feature_guard.cc:143] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 2021-02-15 17:29:17.163720: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x27ee1547440 initialized for platform Host (this does not guarantee that XLA will be used). Devices: 2021-02-15 17:29:17.164150: I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): Host, Default Version 2021-02-15 17:29:17.164576: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1102] Device interconnect StreamExecutor with strength 1 edge matrix: 2021-02-15 17:29:17.164985: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1108]
[1] "Computing model1 Keras ... Please wait ..." Error in py_call_impl(callable, dots$args, dots$keywords) : ModuleNotFoundError: No module named 'rpytools' `

I tried to follow this explantions: Evaluation error: ModuleNotFoundError: No module named 'rpytools' #561

Evaluation error: ModuleNotFoundError: No module named 'rpytools'. #959

Any suggestions\ ideas \ thoughts to how to solve this will be appriciated Many thanks

tobigithub commented 3 years ago

Hi, indeed Keras can be tricky under R. It runs on CPUs and on GPUs. Also it can use different backends such as tensorflow or theano or others. https://keras.rstudio.com/reference/use_implementation.html

I think the installation of Keras and tensorflow is not appropriately covered in retip per se. So that can lead to errors. The first thing would be to correctly install Keras. Try first the "CPU version" this version is slower, but if the Keras CPU version runs, you can try to run the GPU version which requires tensorflow and CUDA.

Installation of Keras: https://tensorflow.rstudio.com/installation/ and https://keras.rstudio.com/reference/install_keras.html

The error you have is based on missing CUDA drivers, you need Anaconda and/or a conda virtual environment to do so. So first make sure the Keras CPU version runs fine, then switch to the GPU version (if you have an appropriate GPU that can run tensorflow).

Your GeForce GT 710 (computeCapability: 3.5) has 192 CUDA cores. See if you can install CUDA on it, if not, just use the Keras CPU version. https://www.gpuzoo.com/GPU-NVIDIA/GeForce_GT_710.html The 710 might be able to run CUDA, but I expect the CPU version to run much faster in this specific case (https://browser.geekbench.com/cuda-benchmarks) But you never know until you try.

Cheers Tobias

TalWac commented 3 years ago

Dear Tobias,

Thank you for your time and the detailed answer!

Following the steps you mentioned, tried to install correctly keras.

And have 3 more questions with your permission.

First, install the TensorFlow:

> install.packages("tensorflow")
Installing package into ‘D:/BCDD/Documents/R/win-library/4.0’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.0/tensorflow_2.2.0.zip'
Content type 'application/zip' length 144492 bytes (141 KB)
downloaded 141 KB

package ‘tensorflow’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
    C:\Users\BCDD\AppData\Local\Temp\RtmpA3ciF2\downloaded_packages
> library(tensorflow)
> install_tensorflow(version = "nightly", method = "conda") 
Collecting package metadata (current_repodata.json): ...working... done
Solving environment: ...working... done

==> WARNING: A newer version of conda exists. <==
  current version: 4.9.0
  latest version: 4.9.2

Please update conda by running

    $ conda update -n base conda

# All requested packages already installed.

Requirement already satisfied: tf-nightly in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (2.5.0.dev20210204)
Requirement already satisfied: astunparse~=1.6.3 in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (from tf-nightly) (1.6.3)
Requirement already satisfied: protobuf>=3.9.2 in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (from tf-nightly) (3.14.0)
Requirement already satisfied: wrapt~=1.12.1 in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (from tf-nightly) (1.12.1)
Requirement already satisfied: absl-py~=0.10 in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (from tf-nightly) (0.11.0)
Collecting gast==0.4.0
  Using cached gast-0.4.0-py3-none-any.whl (9.8 kB)
Requirement already satisfied: flatbuffers~=1.12.0 in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (from tf-nightly) (1.12)
Requirement already satisfied: google-pasta~=0.2 in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (from tf-nightly) (0.2.0)
Requirement already satisfied: typing-extensions~=3.7.4 in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (from tf-nightly) (3.7.4.3)
Requirement already satisfied: tb-nightly~=2.5.0.a in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (from tf-nightly) (2.5.0a20210215)
Requirement already satisfied: six~=1.15.0 in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (from tf-nightly) (1.15.0)
Requirement already satisfied: wheel~=0.35 in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (from tf-nightly) (0.36.2)
Requirement already satisfied: opt-einsum~=3.3.0 in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (from tf-nightly) (3.3.0)
Requirement already satisfied: grpcio~=1.34.0 in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (from tf-nightly) (1.34.1)
Collecting h5py~=3.1.0
  Using cached h5py-3.1.0-cp36-cp36m-win_amd64.whl (2.7 MB)
Requirement already satisfied: termcolor~=1.1.0 in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (from tf-nightly) (1.1.0)
Requirement already satisfied: numpy~=1.19.2 in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (from tf-nightly) (1.19.5)
Requirement already satisfied: keras-preprocessing~=1.1.2 in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (from tf-nightly) (1.1.2)
Requirement already satisfied: tf-estimator-nightly~=2.5.0.dev in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (from tf-nightly) (2.5.0.dev2021021601)
Requirement already satisfied: cached-property in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (from h5py~=3.1.0->tf-nightly) (1.5.2)
Requirement already satisfied: markdown>=2.6.8 in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (from tb-nightly~=2.5.0.a->tf-nightly) (3.3.3)
Requirement already satisfied: tensorboard-plugin-wit>=1.6.0 in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (from tb-nightly~=2.5.0.a->tf-nightly) (1.8.0)
Requirement already satisfied: google-auth<2,>=1.6.3 in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (from tb-nightly~=2.5.0.a->tf-nightly) (1.26.1)
Requirement already satisfied: tensorboard-data-server<0.4.0,>=0.3.0 in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (from tb-nightly~=2.5.0.a->tf-nightly) (0.3.0)
Requirement already satisfied: werkzeug>=0.11.15 in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (from tb-nightly~=2.5.0.a->tf-nightly) (1.0.1)
Requirement already satisfied: google-auth-oauthlib<0.5,>=0.4.1 in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (from tb-nightly~=2.5.0.a->tf-nightly) (0.4.2)
Requirement already satisfied: requests<3,>=2.21.0 in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (from tb-nightly~=2.5.0.a->tf-nightly) (2.25.1)
Requirement already satisfied: setuptools>=41.0.0 in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (from tb-nightly~=2.5.0.a->tf-nightly) (49.6.0.post20210108)
Requirement already satisfied: cachetools<5.0,>=2.0.0 in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (from google-auth<2,>=1.6.3->tb-nightly~=2.5.0.a->tf-nightly) (4.2.1)
Requirement already satisfied: pyasn1-modules>=0.2.1 in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (from google-auth<2,>=1.6.3->tb-nightly~=2.5.0.a->tf-nightly) (0.2.8)
Requirement already satisfied: rsa<5,>=3.1.4 in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (from google-auth<2,>=1.6.3->tb-nightly~=2.5.0.a->tf-nightly) (4.7)
Requirement already satisfied: requests-oauthlib>=0.7.0 in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (from google-auth-oauthlib<0.5,>=0.4.1->tb-nightly~=2.5.0.a->tf-nightly) (1.3.0)
Requirement already satisfied: importlib-metadata in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (from markdown>=2.6.8->tb-nightly~=2.5.0.a->tf-nightly) (3.4.0)
Requirement already satisfied: pyasn1<0.5.0,>=0.4.6 in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (from pyasn1-modules>=0.2.1->google-auth<2,>=1.6.3->tb-nightly~=2.5.0.a->tf-nightly) (0.4.8)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (from requests<3,>=2.21.0->tb-nightly~=2.5.0.a->tf-nightly) (2020.12.5)
Requirement already satisfied: idna<3,>=2.5 in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (from requests<3,>=2.21.0->tb-nightly~=2.5.0.a->tf-nightly) (2.10)
Requirement already satisfied: chardet<5,>=3.0.2 in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (from requests<3,>=2.21.0->tb-nightly~=2.5.0.a->tf-nightly) (4.0.0)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (from requests<3,>=2.21.0->tb-nightly~=2.5.0.a->tf-nightly) (1.26.3)
Requirement already satisfied: oauthlib>=3.0.0 in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (from requests-oauthlib>=0.7.0->google-auth-oauthlib<0.5,>=0.4.1->tb-nightly~=2.5.0.a->tf-nightly) (3.1.0)
Requirement already satisfied: zipp>=0.5 in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (from importlib-metadata->markdown>=2.6.8->tb-nightly~=2.5.0.a->tf-nightly) (3.4.0)
Installing collected packages: h5py, gast
  Attempting uninstall: h5py
    Found existing installation: h5py 2.10.0
    Uninstalling h5py-2.10.0:
      Successfully uninstalled h5py-2.10.0
  Attempting uninstall: gast
    Found existing installation: gast 0.3.3
    Uninstalling gast-0.3.3:
      Successfully uninstalled gast-0.3.3
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
tensorflow 2.2.0 requires gast==0.3.3, but you have gast 0.4.0 which is incompatible.
tensorflow 2.2.0 requires h5py<2.11.0,>=2.10.0, but you have h5py 3.1.0 which is incompatible.
Successfully installed gast-0.4.0 h5py-3.1.0

Installation complete.

Then the keras :

> install.packages("keras")
Installing package into ‘D:/BCDD/Documents/R/win-library/4.0’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.0/keras_2.3.0.0.zip'
Content type 'application/zip' length 2490808 bytes (2.4 MB)
downloaded 2.4 MB

package ‘keras’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
    C:\Users\BCDD\AppData\Local\Temp\RtmpYJOwpm\downloaded_packages
> library(keras)
> use_implementation("tensorflow")
> install_keras(method = "conda")
Collecting package metadata (current_repodata.json): ...working... done
Solving environment: ...working... done

==> WARNING: A newer version of conda exists. <==
  current version: 4.9.0
  latest version: 4.9.2

Please update conda by running

    $ conda update -n base conda

# All requested packages already installed.

Requirement already satisfied: tensorflow==2.2.0 in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (2.2.0)
Requirement already satisfied: keras in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (2.4.3)
Requirement already satisfied: tensorflow-hub in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (0.11.0)
Requirement already satisfied: h5py in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (3.1.0)
Requirement already satisfied: pyyaml==3.12 in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (3.12)
Requirement already satisfied: requests in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (2.25.1)
Requirement already satisfied: Pillow in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (8.1.0)
Requirement already satisfied: scipy in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (1.4.1)
Collecting scipy
  Using cached scipy-1.5.4-cp36-cp36m-win_amd64.whl (31.2 MB)
Requirement already satisfied: tensorboard<2.3.0,>=2.2.0 in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (from tensorflow==2.2.0) (2.2.2)
Requirement already satisfied: wheel>=0.26 in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (from tensorflow==2.2.0) (0.36.2)
Requirement already satisfied: astunparse==1.6.3 in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (from tensorflow==2.2.0) (1.6.3)
Requirement already satisfied: six>=1.12.0 in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (from tensorflow==2.2.0) (1.15.0)
Collecting gast==0.3.3
  Using cached gast-0.3.3-py2.py3-none-any.whl (9.7 kB)
Requirement already satisfied: google-pasta>=0.1.8 in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (from tensorflow==2.2.0) (0.2.0)
Collecting h5py
  Using cached h5py-2.10.0-cp36-cp36m-win_amd64.whl (2.4 MB)
Requirement already satisfied: wrapt>=1.11.1 in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (from tensorflow==2.2.0) (1.12.1)
Requirement already satisfied: numpy<2.0,>=1.16.0 in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (from tensorflow==2.2.0) (1.19.5)
Requirement already satisfied: protobuf>=3.8.0 in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (from tensorflow==2.2.0) (3.14.0)
Requirement already satisfied: termcolor>=1.1.0 in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (from tensorflow==2.2.0) (1.1.0)
Requirement already satisfied: keras-preprocessing>=1.1.0 in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (from tensorflow==2.2.0) (1.1.2)
Requirement already satisfied: grpcio>=1.8.6 in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (from tensorflow==2.2.0) (1.34.1)
Requirement already satisfied: tensorflow-estimator<2.3.0,>=2.2.0 in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (from tensorflow==2.2.0) (2.2.0)
Requirement already satisfied: opt-einsum>=2.3.2 in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (from tensorflow==2.2.0) (3.3.0)
Requirement already satisfied: absl-py>=0.7.0 in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (from tensorflow==2.2.0) (0.11.0)
Requirement already satisfied: google-auth<2,>=1.6.3 in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (from tensorboard<2.3.0,>=2.2.0->tensorflow==2.2.0) (1.26.1)
Requirement already satisfied: setuptools>=41.0.0 in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (from tensorboard<2.3.0,>=2.2.0->tensorflow==2.2.0) (49.6.0.post20210108)
Requirement already satisfied: tensorboard-plugin-wit>=1.6.0 in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (from tensorboard<2.3.0,>=2.2.0->tensorflow==2.2.0) (1.8.0)
Requirement already satisfied: google-auth-oauthlib<0.5,>=0.4.1 in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (from tensorboard<2.3.0,>=2.2.0->tensorflow==2.2.0) (0.4.2)
Requirement already satisfied: markdown>=2.6.8 in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (from tensorboard<2.3.0,>=2.2.0->tensorflow==2.2.0) (3.3.3)
Requirement already satisfied: werkzeug>=0.11.15 in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (from tensorboard<2.3.0,>=2.2.0->tensorflow==2.2.0) (1.0.1)
Requirement already satisfied: idna<3,>=2.5 in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (from requests) (2.10)
Requirement already satisfied: chardet<5,>=3.0.2 in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (from requests) (4.0.0)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (from requests) (1.26.3)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (from requests) (2020.12.5)
Requirement already satisfied: rsa<5,>=3.1.4 in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (from google-auth<2,>=1.6.3->tensorboard<2.3.0,>=2.2.0->tensorflow==2.2.0) (4.7)
Requirement already satisfied: pyasn1-modules>=0.2.1 in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (from google-auth<2,>=1.6.3->tensorboard<2.3.0,>=2.2.0->tensorflow==2.2.0) (0.2.8)
Requirement already satisfied: cachetools<5.0,>=2.0.0 in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (from google-auth<2,>=1.6.3->tensorboard<2.3.0,>=2.2.0->tensorflow==2.2.0) (4.2.1)
Requirement already satisfied: requests-oauthlib>=0.7.0 in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (from google-auth-oauthlib<0.5,>=0.4.1->tensorboard<2.3.0,>=2.2.0->tensorflow==2.2.0) (1.3.0)
Requirement already satisfied: importlib-metadata in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (from markdown>=2.6.8->tensorboard<2.3.0,>=2.2.0->tensorflow==2.2.0) (3.4.0)
Requirement already satisfied: pyasn1<0.5.0,>=0.4.6 in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (from pyasn1-modules>=0.2.1->google-auth<2,>=1.6.3->tensorboard<2.3.0,>=2.2.0->tensorflow==2.2.0) (0.4.8)
Requirement already satisfied: oauthlib>=3.0.0 in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (from requests-oauthlib>=0.7.0->google-auth-oauthlib<0.5,>=0.4.1->tensorboard<2.3.0,>=2.2.0->tensorflow==2.2.0) (3.1.0)
Requirement already satisfied: typing-extensions>=3.6.4 in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (from importlib-metadata->markdown>=2.6.8->tensorboard<2.3.0,>=2.2.0->tensorflow==2.2.0) (3.7.4.3)
Requirement already satisfied: zipp>=0.5 in c:\users\bcdd\anacon~2\envs\r-reti~1\lib\site-packages (from importlib-metadata->markdown>=2.6.8->tensorboard<2.3.0,>=2.2.0->tensorflow==2.2.0) (3.4.0)
Installing collected packages: h5py, gast
  Attempting uninstall: h5py
    Found existing installation: h5py 3.1.0
    Uninstalling h5py-3.1.0:
      Successfully uninstalled h5py-3.1.0
  Attempting uninstall: gast
    Found existing installation: gast 0.4.0
    Uninstalling gast-0.4.0:
      Successfully uninstalled gast-0.4.0
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
tf-nightly 2.5.0.dev20210204 requires gast==0.4.0, but you have gast 0.3.3 which is incompatible.
tf-nightly 2.5.0.dev20210204 requires h5py~=3.1.0, but you have h5py 2.10.0 which is incompatible.
Successfully installed gast-0.3.3 h5py-2.10.0

Installation complete.

My first question:

  1. Does this look correct?

Then you wrote :

So first make sure the Keras CPU version runs fine

  1. How do I know keras runs fine?

my third question is regarding the last paragraph you wrote. I entered the 2 links and installed CUDA from this link but still when trying to run the model there are more or less the same issues and I'm do not know what's I'm doing wrong:

 > keras <- fit.keras(training,testing)
2021-02-16 13:43:02.663811: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cudart64_110.dll
Error: 
> keras
Error: object 'keras' not found
> keras <- fit.keras(training,testing)
2021-02-16 13:43:50.615714: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library nvcuda.dll
2021-02-16 13:43:50.670246: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1770] Found device 0 with properties: 
pciBusID: 0000:02:00.0 name: GeForce GT 710 computeCapability: 3.5
coreClock: 0.954GHz coreCount: 1 deviceMemorySize: 2.00GiB deviceMemoryBandwidth: 11.92GiB/s
2021-02-16 13:43:50.671442: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cudart64_110.dll
2021-02-16 13:43:51.635151: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cublas64_11.dll
2021-02-16 13:43:51.635770: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cublasLt64_11.dll
2021-02-16 13:43:52.314351: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cufft64_10.dll
2021-02-16 13:43:52.387254: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library curand64_10.dll
2021-02-16 13:43:52.391386: W tensorflow/stream_executor/platform/default/dso_loader.cc:60] Could not load dynamic library 'cusolver64_10.dll'; dlerror: cusolver64_10.dll not found
2021-02-16 13:43:52.805547: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cusparse64_11.dll
2021-02-16 13:43:52.808049: W tensorflow/stream_executor/platform/default/dso_loader.cc:60] Could not load dynamic library 'cudnn64_8.dll'; dlerror: cudnn64_8.dll not found
2021-02-16 13:43:52.808451: W tensorflow/core/common_runtime/gpu/gpu_device.cc:1803] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow the guide at https://www.tensorflow.org/install/gpu for how to download and setup the required libraries for your platform.
Skipping registering GPU devices...
2021-02-16 13:43:52.841519: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations:  AVX2
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2021-02-16 13:43:52.848350: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1300] Device interconnect StreamExecutor with strength 1 edge matrix:
2021-02-16 13:43:52.848995: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1306]      
[1] "Computing model1 Keras  ... Please wait ..."
Error in py_call_impl(callable, dots$args, dots$keywords) : 
  ModuleNotFoundError: No module named 'rpytools'

Kindly your advice/suggestion many thanks

Best regards,

Tal

tobigithub commented 3 years ago

Hello Tal, I have to admit that Keras and Tensorflow in R are not a good match. It will work eventually, you can try it out in the Kaggle cloud. Create a login for Kaggle and then fork a script that has R and Keras installed. Then run the script. This is standard behavior. https://www.kaggle.com/alessandroguida/simple-keras-in-r

Your specific error is discussed here (https://www.google.com/search?q=cusolver64_10.dll%27%3B+dlerror%3A+cusolver64_10.dll+not+found) there are many people with the same problem. Nevertheless keras and TF should not have any issues when using a CPU installation, but they have.

This is what I did in order to install Keras and TF into an existing environment (CPU only), but there are many error messages and issues on Gitub, so I think this is nicely broken. Most of the error messages were: Error: Python module tensorflow.keras was not found.

I added one potential way at the bottom, it seems to be logical, but I gave up. It requires to run R or Rstudio directly in a conda environment. So instead of using R and installing Python into it (what a conundrum), you install Python and then R into it (another conundrum). I think Python alone should be sufficient.

Best Tobias


Examples how to fix it and analyze it.
---
library(reticulate)
library(keras)
virtualenv_create("myenv")
use_virtualenv("myenv")
install_keras(method="virtualenv", envname="myenv")
use_virtualenv("myenv")

---
library(keras)
library(tensorflow)
trainy <- c(0,0,0,0,0,1,1,1,1,1)
trainLabels <- to_categorical(trainy)

---

reticulate::py_discover_config("keras")
reticulate::py_discover_config("tensorflow")
reticulate::py_config()
devtools::session_info()
--
reticulate::py_discover_config()
reticulate::use_condaenv("r-tensorflow")
reticulate::py_config()

--
https://github.com/rstudio/keras/issues/649
devtools::install_github("rstudio/tensorflow")
devtools::install_github("rstudio/keras")
tensorflow::install_tensorflow()
tensorflow::tf_config()

Seems to work see https://github.com/rstudio/keras/issues/649

1) Install conda / Anaconda 2) Install Rstudio in a conda environment 3) Use Rstudio within the conda Environment.

TalWac commented 3 years ago

Dear Tobias,

Thank you for the help! I'll go through it and update. Regards, Tal

TalWac commented 3 years ago

Dear Tobias,

Followed by your examples and links the fit.keras seem to work for now.

This is what worked for me:

devtools::install_github("rstudio/reticulate")
devtools::install_github("rstudio/tensorflow")
devtools::install_github("rstudio/keras")

library(reticulate)
library(keras)
library(tensorflow)
conda_create("myenv")
use_condaenv("myenv")
install_keras(method="conda", envname="myenv")
install_tensorflow(version = "nightly", method = "conda", envname="myenv") 
use_condaenv("myenv")

Many thanks!

tobigithub commented 3 years ago

@TalWac Thanks! This is mind boggling... in a positive way of course :-) Cheers Tobias