tensorflow: Tensorflow 2.0.0 cpu, import error: DLL load failed

System information

  • OS Platform and Distribution: x86_64-w64-mingw32/x64 (64-bit) under Win10 x64 (build 18363), Bios V1.08
  • Processor: Intel® Pentium® CPU N3710 @ 1,6GHz, RAM 4GB (DDR), 4 cores, L1 Cache 56kB, L2 Cache 1024kB
  • Maker & Model: Acer Notebook TravelMate B117-M Signature Edition
  • TensorFlow installed from (source or binary): binary i. under Rstudio 1.2.5033 with R 3.6.2 (20191212) & Miniconda3 4.7.12 (Py 3.7.4-64bit) ii. under conda (since i. failed, see below)
  • TensorFlow version: 2.0.0
  • Python version: 3.6.10 (under conda)
  • Installed using virtualenv? pip? conda?: conda=>pip install

Describe the problem i. Since I used keras (including reticulate & tensorflow) for the last 3 yrs under RStudio, but had various problems with my very old installation, I definitely want to continue with tensorflow + keras under RStudio and tried to install tensorflow 2.0.0. under RStudio:

install.packages("tensorflow", version = "2.0.0.")   
library(tensorflow)
install_tensorflow(method = "conda")

then test sequence - is tensorflow installed?

library(reticulate)
use_condaenv(condaenv = "r-reticulate", required = TRUE)
library(tensorflow)
> reticulate::py_config()
python:         C:/.../Miniconda3/envs/r-reticulate/python.exe
libpython:      C:/.../Miniconda3/envs/r-reticulate/python36.dll
pythonhome:     C:/.../Miniconda3/envs/r-reticulate
version:        3.6.10 |Anaconda, Inc.| (default, Jan  7 2020, 15:18:16) [MSC v.1916 64 bit (AMD64)]
Architecture:   64bit
numpy:          C:/.../Miniconda3/envs/r-reticulate/Lib/site-packages/numpy
numpy_version:  1.18.1
tensorflow:     C:\...\MINICO~1\envs\R-RETI~1\lib\site-packages\tensorflow\__init__.p
python versions found: 
 C:/.../Miniconda3/envs/r-reticulate/python.exe
 C:/.../Miniconda3/python.exe
> tensorflow::tf_config()
**Installation of TensorFlow not found.**
Python environments searched for 'tensorflow' package:
 C:\...\Miniconda3\envs\r-reticulate\python.exe
 C:\...Miniconda3\python.exe
**You can install TensorFlow using the install_tensorflow() function.**

Thus, although installation was terminated correctly, tensorflow was not found, i.e. not working.

ii. After forwarding this issue under Installation w/ Miniconda, Reticulate 1.14, Tensorflow 2.0.0 & Keras 2.2.5.0 failing #964 to RStudio/keras, tests were made to get tensorflow 2.0.0 pip installed directly under Miniconda3 (also under Anaconda3 and starting with R3.5.3 and R3.6.1), all with the same result:

conda activate r-reticulate
pip install tensorflow==2.0
python 
import tensorflow as tf

This produced the following error log (sorry, I’m unable to copy text from the python shell window), indicating ImportError: DLL load failed twice:

import_tensorflow_as_tf_20200122-1800

Any other info Unfortunately, I am an absolute newbie as regards Python - taking that into account, please help…

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 19 (3 by maintainers)

Most upvoted comments

If I may add: This issue - DLL not found - looks very similar to the recently closed

tensorflow/tensorflow#35749 and tensorflow/tensorflow#35618

which were solved by either

  • reverting from 2.1 to 2.0
  • installing tensorflow-cpu explicitly
  • installing Microsoft Visual C++ Redistributable for Visual Studio

@faltinl tried all of those but none worked. The above screenshot shows the “DLL not found” error using TF 2.0.

Yeah! Do you know a good way of getting it, apart from adding a print statement to line 342 of imp.py (which might be a way though; and shouldn’t require admin rights I guess [[but not sure as myself I’m not on Windows]])

There are many DLLs that are loaded and depending on which one fails to load the solution is different. It would be great if we have the DLL name listed in the issue.