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

Failed to load the native TensorFlow runtime (TF 1.10.0, Windows Platform Only) #10034

Closed
staqiuddin opened this issue Sep 5, 2018 · 19 comments

Comments

Projects
None yet
7 participants
@staqiuddin
Copy link

commented Sep 5, 2018

Actual Behavior

After updating TF to v1.10.0 (through "conda update" command), it can no longer be imported. Kindly note that this issue is specific to Windows platform only (tested on both 10 and Server 2016). On Linux platform and using the same setting (TF installed using Anaconda Distribution), the same code is working fine (tested on Ubuntu 18.04.1 LTS).

I also tried running a stock example but the same issue occured (TF cannot be imported).

Note: I have already opened a TF issue for this (#22097). However, it was closed and I was advised to reach out to the owners of the Anaconda Distribution.

Expected Behavior

TensorFlow should be imported and running successfully.

Steps to Reproduce

Run "python -c "import tensorflow"" from Anaconda Prompt.

System Information

  • Anaconda version: 5.1.0
  • Operating System: Windows 10 and Windows Server 2016
  • TensorFlow version: 1.10.0
  • Python version: 3.6.6

Full Traceback:

Traceback (most recent call last):
  File "C:\Users\user\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "C:\Users\user\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "C:\Users\user\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper
    _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
  File "C:\Users\user\Anaconda3\lib\imp.py", line 243, in load_module
    return load_dynamic(name, filename, file)
  File "C:\Users\user\Anaconda3\lib\imp.py", line 343, in load_dynamic
    return _load(spec)
ImportError: DLL load failed: The specified module could not be found.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\user\Anaconda3\lib\site-packages\tensorflow\__init__.py", line 28, in <module>
    from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import
  File "C:\Users\user\Anaconda3\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "C:\Users\user\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in <module>
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "C:\Users\user\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "C:\Users\user\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "C:\Users\user\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper
    _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
  File "C:\Users\user\Anaconda3\lib\imp.py", line 243, in load_module
    return load_dynamic(name, filename, file)
  File "C:\Users\user\Anaconda3\lib\imp.py", line 343, in load_dynamic
    return _load(spec)
ImportError: DLL load failed: The specified module could not be found.


Failed to load the native TensorFlow runtime.

See https://www.tensorflow.org/install/install_sources#common_installation_problems

for some common reasons and solutions.  Include the entire stack trace
above this error message when asking for help.

conda info:

     active environment : base
    active env location : C:\Users\user\Anaconda3
            shell level : 1
       user config file : C:\Users\user\.condarc
 populated config files : C:\Users\user\.condarc
          conda version : 4.5.11
    conda-build version : 3.14.0
         python version : 3.6.6.final.0
       base environment : C:\Users\user\Anaconda3  (writable)
           channel URLs : https://repo.anaconda.com/pkgs/main/win-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/free/win-64
                          https://repo.anaconda.com/pkgs/free/noarch
                          https://repo.anaconda.com/pkgs/r/win-64
                          https://repo.anaconda.com/pkgs/r/noarch
                          https://repo.anaconda.com/pkgs/pro/win-64
                          https://repo.anaconda.com/pkgs/pro/noarch
                          https://repo.anaconda.com/pkgs/msys2/win-64
                          https://repo.anaconda.com/pkgs/msys2/noarch
          package cache : C:\Users\user\Anaconda3\pkgs
                          C:\Users\user\AppData\Local\conda\conda\pkgs
       envs directories : C:\Users\user\Anaconda3\envs
                          C:\Users\user\AppData\Local\conda\conda\envs
                          C:\Users\user\.conda\envs
               platform : win-64
             user-agent : conda/4.5.11 requests/2.19.1 CPython/3.6.6 Windows/10 Windows/10.0.17134
          administrator : False
             netrc file : None
           offline mode : False

conda list --show-channel-urls:

# packages in environment at C:\Users\user\Anaconda3:
#
# Name                    Version                   Build  Channel
_ipyw_jlab_nb_ext_conf    0.1.0                    py36_0    defaults
_tflow_1100_select        0.0.3                       mkl    defaults
_tflow_190_select         0.0.2                     eigen    defaults
absl-py                   0.4.1                    py36_0    defaults
alabaster                 0.7.11                   py36_0    defaults
anaconda                  custom           py36h363777c_0    defaults
anaconda-client           1.7.1                    py36_0    defaults
anaconda-navigator        1.8.7                    py36_0    defaults
anaconda-project          0.8.2                    py36_0    defaults
appdirs                   1.4.3            py36h28b3542_0    defaults
asn1crypto                0.24.0                   py36_0    defaults
astor                     0.7.1                    py36_0    defaults
astroid                   2.0.4                    py36_0    defaults
astropy                   3.0.4            py36hfa6e2cd_0    defaults
atomicwrites              1.2.1                    py36_0    defaults
attrs                     18.2.0           py36h28b3542_0    defaults
automat                   0.7.0                    py36_0    defaults
babel                     2.6.0                    py36_0    defaults
backcall                  0.1.0                    py36_0    defaults
backports                 1.0                      py36_1    defaults
backports.shutil_get_terminal_size 1.0.0                    py36_2    defaults
beautifulsoup4            4.6.3                    py36_0    defaults
bitarray                  0.8.3            py36hfa6e2cd_0    defaults
bkcharts                  0.2              py36h7e685f7_0    defaults
blas                      1.0                         mkl    defaults
blaze                     0.11.3                   py36_0    defaults
bleach                    2.1.4                    py36_0    defaults
blosc                     1.14.4               he51fdeb_0    defaults
bokeh                     0.13.0                   py36_0    defaults
boto                      2.49.0                   py36_0    defaults
bottleneck                1.2.1            py36h452e1ab_1    defaults
bzip2                     1.0.6                hfa6e2cd_5    defaults
ca-certificates           2018.03.07                    0    defaults
certifi                   2018.8.24                py36_1    defaults
cffi                      1.11.5           py36h74b6da3_1    defaults
chardet                   3.0.4                    py36_1    defaults
click                     6.7              py36hec8c647_0    defaults
cloudpickle               0.5.5                    py36_0    defaults
clyent                    1.2.2                    py36_1    defaults
colorama                  0.3.9            py36h029ae33_0    defaults
comtypes                  1.1.7                    py36_0    defaults
conda                     4.5.11                   py36_0    defaults
conda-build               3.14.0                   py36_0    defaults
conda-env                 2.6.0                         1    defaults
conda-verify              3.1.0                    py36_0    defaults
console_shortcut          0.1.1                         3    defaults
constantly                15.1.0           py36h28b3542_0    defaults
contextlib2               0.5.5            py36he5d52c0_0    defaults
cryptography              2.3.1            py36h74b6da3_0    defaults
cryptography-vectors      2.3.1                    py36_0    defaults
curl                      7.61.0               h7602738_0    defaults
cycler                    0.10.0           py36h009560c_0    defaults
cython                    0.28.5           py36h6538335_0    defaults
cytoolz                   0.9.0.1          py36hfa6e2cd_1    defaults
dask                      0.19.0                   py36_0    defaults
dask-core                 0.19.0                   py36_0    defaults
datashape                 0.5.4                    py36_1    defaults
decorator                 4.3.0                    py36_0    defaults
distributed               1.23.0                   py36_0    defaults
docutils                  0.14             py36h6012d8f_0    defaults
entrypoints               0.2.3                    py36_2    defaults
et_xmlfile                1.0.1            py36h3d2d736_0    defaults
fastcache                 1.0.2            py36hfa6e2cd_2    defaults
filelock                  3.0.6                    py36_0    defaults
flask                     1.0.2                    py36_1    defaults
flask-cors                3.0.6                    py36_0    defaults
freetype                  2.9.1                ha9979f8_1    defaults
future                    0.16.0                   py36_2    defaults
gast                      0.2.0                    py36_0    defaults
get_terminal_size         1.0.0                h38e98db_0    defaults
gevent                    1.3.6            py36hfa6e2cd_0    defaults
git                       2.18.0               h6bb4b03_0    defaults
glob2                     0.6                      py36_0    defaults
graphviz                  2.38                 hfd603c8_2    defaults
greenlet                  0.4.14           py36hfa6e2cd_0    defaults
grpcio                    1.12.1           py36h1a1b453_0    defaults
h5py                      2.8.0            py36h3bdd7fb_2    defaults
hdf5                      1.10.2               hac2f561_1    defaults
heapdict                  1.0.0                    py36_2    defaults
html5lib                  1.0.1                    py36_0    defaults
hyperlink                 18.0.0                   py36_0    defaults
icc_rt                    2017.0.4             h97af966_0    defaults
icu                       58.2                 ha66f8fd_1    defaults
idna                      2.7                      py36_0    defaults
imageio                   2.3.0                    py36_0    defaults
imagesize                 1.1.0                    py36_0    defaults
incremental               17.5.0                   py36_0    defaults
intel-openmp              2018.0.3                      0    defaults
ipykernel                 4.9.0                    py36_0    defaults
ipython                   6.5.0                    py36_0    defaults
ipython_genutils          0.2.0            py36h3c5d0ee_0    defaults
ipywidgets                7.4.1                    py36_0    defaults
isort                     4.3.4                    py36_0    defaults
itsdangerous              0.24                     py36_1    defaults
jdcal                     1.4                      py36_0    defaults
jedi                      0.12.1                   py36_0    defaults
jinja2                    2.10                     py36_0    defaults
jpeg                      9b                   hb83a4c4_2    defaults
jsonschema                2.6.0            py36h7636477_0    defaults
jupyter                   1.0.0                    py36_5    defaults
jupyter_client            5.2.3                    py36_0    defaults
jupyter_console           5.2.0                    py36_1    defaults
jupyter_core              4.4.0                    py36_0    defaults
jupyterlab                0.34.7                   py36_0    defaults
jupyterlab_launcher       0.13.1                   py36_0    defaults
keras                     2.2.2                         0    defaults
keras-applications        1.0.4                    py36_1    defaults
keras-base                2.2.2                    py36_0    defaults
keras-preprocessing       1.0.2                    py36_1    defaults
keyring                   13.2.1                   py36_0    defaults
kiwisolver                1.0.1            py36h6538335_0    defaults
lazy-object-proxy         1.3.1            py36hfa6e2cd_2    defaults
libcurl                   7.61.0               h7602738_0    defaults
libiconv                  1.15                 h1df5818_7    defaults
libmklml                  2018.0.3                      0    defaults
libpng                    1.6.34               h79bbb47_0    defaults
libprotobuf               3.6.0                h1a1b453_0    defaults
libsodium                 1.0.16               h9d3ae62_0    defaults
libssh2                   1.8.0                hd619d38_4    defaults
libtiff                   4.0.9                h36446d0_2    defaults
libxml2                   2.9.8                hadb2253_1    defaults
libxslt                   1.1.32               hf6f1972_0    defaults
llvmlite                  0.24.0           py36h6538335_0    defaults
locket                    0.2.0            py36hfed976d_1    defaults
lxml                      4.2.4            py36hef2cd61_0    defaults
lzo                       2.10                 h6df0209_2    defaults
m2w64-gcc-libgfortran     5.3.0                         6    defaults
m2w64-gcc-libs            5.3.0                         7    defaults
m2w64-gcc-libs-core       5.3.0                         7    defaults
m2w64-gmp                 6.1.0                         2    defaults
m2w64-libwinpthread-git   5.0.0.4634.697f757               2    defaults
markdown                  2.6.11                   py36_0    defaults
markupsafe                1.0              py36hfa6e2cd_1    defaults
matplotlib                2.2.3            py36hd159220_0    defaults
mccabe                    0.6.1                    py36_1    defaults
menuinst                  1.4.14           py36hfa6e2cd_0    defaults
mistune                   0.8.3            py36hfa6e2cd_1    defaults
mkl                       2018.0.3                      1    defaults
mkl-service               1.1.2            py36hb217b18_4    defaults
mkl_fft                   1.0.4            py36h1e22a9b_1    defaults
mkl_random                1.0.1            py36h77b88f5_1    defaults
more-itertools            4.3.0                    py36_0    defaults
mpmath                    1.0.0                    py36_2    defaults
msgpack-python            0.5.6            py36he980bc4_1    defaults
msys2-conda-epoch         20160418                      1    defaults
multipledispatch          0.6.0                    py36_0    defaults
navigator-updater         0.2.1                    py36_0    defaults
nbconvert                 5.3.1                    py36_0    defaults
nbformat                  4.4.0            py36h3a5bc1b_0    defaults
networkx                  2.1                      py36_0    defaults
nltk                      3.3.0                    py36_0    defaults
nose                      1.3.7                    py36_2    defaults
notebook                  5.6.0                    py36_0    defaults
numba                     0.39.0           py36h830ac7b_0    defaults
numexpr                   2.6.8            py36h9ef55f4_0    defaults
numpy                     1.15.1           py36ha559c80_0    defaults
numpy-base                1.15.1           py36h8128ebf_0    defaults
numpydoc                  0.8.0                    py36_0    defaults
odo                       0.5.1            py36h7560279_0    defaults
olefile                   0.45.1                   py36_0    defaults
openpyxl                  2.5.6                    py36_0    defaults
openssl                   1.0.2p               hfa6e2cd_0    defaults
packaging                 17.1                     py36_0    defaults
pandas                    0.23.4           py36h830ac7b_0    defaults
pandoc                    2.2.3.2                       0    defaults
pandocfilters             1.4.2                    py36_1    defaults
parso                     0.3.1                    py36_0    defaults
partd                     0.3.8            py36hc8e763b_0    defaults
path.py                   11.1.0                   py36_0    defaults
pathlib2                  2.3.2                    py36_0    defaults
patsy                     0.5.0                    py36_0    defaults
pickleshare               0.7.4            py36h9de030f_0    defaults
pillow                    5.2.0            py36h08bbbbd_0    defaults
pip                       10.0.1                   py36_0    defaults
pkginfo                   1.4.2                    py36_1    defaults
pluggy                    0.7.1            py36h28b3542_0    defaults
ply                       3.11                     py36_0    defaults
prometheus_client         0.3.1            py36h28b3542_0    defaults
prompt_toolkit            1.0.15           py36h60b8f86_0    defaults
protobuf                  3.6.0            py36he025d50_0    defaults
psutil                    5.4.7            py36hfa6e2cd_0    defaults
py                        1.6.0                    py36_0    defaults
pyasn1                    0.4.4            py36h28b3542_0    defaults
pyasn1-modules            0.2.2                    py36_0    defaults
pybind11                  2.2.3                     <pip>
pycodestyle               2.4.0                    py36_0    defaults
pycosat                   0.6.3            py36hfa6e2cd_0    defaults
pycparser                 2.18                     py36_1    defaults
pycrypto                  2.6.1            py36hfa6e2cd_9    defaults
pycurl                    7.43.0.2         py36h74b6da3_0    defaults
pydot                     1.2.4                    py36_0    defaults
pyflakes                  2.0.0                    py36_0    defaults
pygments                  2.2.0            py36hb010967_0    defaults
pylint                    2.1.1                    py36_0    defaults
pyodbc                    4.0.24           py36h6538335_0    defaults
pyopenssl                 18.0.0                   py36_0    defaults
pyparsing                 2.2.0                    py36_1    defaults
pyqt                      5.9.2            py36ha878b3d_0    defaults
pysocks                   1.6.8                    py36_0    defaults
pytables                  3.4.4            py36he6f6034_0    defaults
pytest                    3.7.4                    py36_0    defaults
pytest-arraydiff          0.2              py36h39e3cac_0    defaults
pytest-astropy            0.4.0                    py36_0    defaults
pytest-doctestplus        0.1.3                    py36_0    defaults
pytest-openfiles          0.3.0                    py36_0    defaults
pytest-remotedata         0.3.0                    py36_0    defaults
python                    3.6.6                hea74fb7_0    defaults
python-dateutil           2.7.3                    py36_0    defaults
pytz                      2018.5                   py36_0    defaults
pywavelets                1.0.0            py36h452e1ab_0    defaults
pywin32                   223              py36hfa6e2cd_1    defaults
pywinpty                  0.5.4                    py36_0    defaults
pyyaml                    3.13             py36hfa6e2cd_0    defaults
pyzmq                     17.1.2           py36hfa6e2cd_0    defaults
qt                        5.9.6            vc14h1e9a669_2    defaults
qtawesome                 0.4.4            py36h5aa48f6_0    defaults
qtconsole                 4.4.1                    py36_0    defaults
qtpy                      1.5.0                    py36_0    defaults
requests                  2.19.1                   py36_0    defaults
rope                      0.11.0                   py36_0    defaults
ruamel_yaml               0.15.46          py36hfa6e2cd_0    defaults
scikit-image              0.14.0           py36h6538335_1    defaults
scikit-learn              0.19.1           py36hae9bb9f_0    defaults
scipy                     1.1.0            py36h4f6bf74_1    defaults
seaborn                   0.9.0                    py36_0    defaults
send2trash                1.5.0                    py36_0    defaults
service_identity          17.0.0           py36h28b3542_0    defaults
setuptools                40.2.0                   py36_0    defaults
simplegeneric             0.8.1                    py36_2    defaults
singledispatch            3.4.0.3          py36h17d0c80_0    defaults
sip                       4.19.12          py36h6538335_0    defaults
six                       1.11.0                   py36_1    defaults
snappy                    1.1.7                h777316e_3    defaults
snowballstemmer           1.2.1            py36h763602f_0    defaults
sortedcollections         1.0.1                    py36_0    defaults
sortedcontainers          2.0.5                    py36_0    defaults
sphinx                    1.7.8                    py36_0    defaults
sphinxcontrib             1.0                      py36_1    defaults
sphinxcontrib-websupport  1.1.0                    py36_1    defaults
spyder                    3.3.1                    py36_1    defaults
spyder-kernels            0.2.6                    py36_0    defaults
sqlalchemy                1.2.11           py36hfa6e2cd_0    defaults
sqlite                    3.24.0               h7602738_0    defaults
statsmodels               0.9.0            py36h452e1ab_0    defaults
sympy                     1.2                      py36_0    defaults
tblib                     1.3.2            py36h30f5020_0    defaults
tensorboard               1.10.0           py36he025d50_0    defaults
tensorflow                1.10.0          mkl_py36hb361250_0    defaults
tensorflow-base           1.10.0          mkl_py36h81393da_0    defaults
termcolor                 1.1.0                    py36_1    defaults
terminado                 0.8.1                    py36_1    defaults
testpath                  0.3.1            py36h2698cfe_0    defaults
tk                        8.6.8                hfa6e2cd_0    defaults
toolz                     0.9.0                    py36_0    defaults
tornado                   5.1              py36hfa6e2cd_0    defaults
traitlets                 4.3.2            py36h096827d_0    defaults
twisted                   18.7.0           py36hfa6e2cd_1    defaults
typed-ast                 1.1.0            py36hfa6e2cd_0    defaults
typing                    3.6.4                    py36_0    defaults
unicodecsv                0.14.1           py36h6450c06_0    defaults
urllib3                   1.23                     py36_0    defaults
vc                        14.1                 h21ff451_3    defaults
vs2015_runtime            15.5.2                        3    defaults
wcwidth                   0.1.7            py36h3d5aa90_0    defaults
webencodings              0.5.1                    py36_1    defaults
werkzeug                  0.14.1                   py36_0    defaults
wheel                     0.31.1                   py36_0    defaults
widgetsnbextension        3.4.1                    py36_0    defaults
win_inet_pton             1.0.1                    py36_1    defaults
win_unicode_console       0.5              py36hcdbd4b5_0    defaults
wincertstore              0.2              py36h7fe50ca_0    defaults
winpty                    0.4.3                         4    defaults
wrapt                     1.10.11          py36hfa6e2cd_2    defaults
xlrd                      1.1.0                    py36_1    defaults
xlsxwriter                1.1.0                    py36_0    defaults
xlwings                   0.11.8                   py36_0    defaults
xlwt                      1.3.0            py36h1a4751e_0    defaults
yaml                      0.1.7                hc54c509_2    defaults
zeromq                    4.2.5                he025d50_1    defaults
zict                      0.1.3                    py36_0    defaults
zlib                      1.2.11               h8395fce_2    defaults
zope                      1.0                      py36_0    defaults
zope.interface            4.5.0            py36hfa6e2cd_0    defaults
@nehaljwani

This comment has been minimized.

Copy link

commented Sep 6, 2018

@staqiuddin If you create a new environment and try to install tensorflow in that, does it work?

conda create -yn tflow tensorflow
activate tflow
python -c 'import tensorflow'

If it still doesn't work, could you share output for try the following:

activate base
conda install m2w64-ntldd-git
ntldd C:\Users\user\Anaconda3\lib\site-packages\tensorflow\python\_pywrap_tensorflow_internal.pyd
@staqiuddin

This comment has been minimized.

Copy link
Author

commented Sep 6, 2018

@nehaljwani I executed the virtual environment code snippet and the same issue occurred. Kindly find below the output log:

(base) C:\Users\user>conda create -yn tflow tensorflow
Solving environment: done

## Package Plan ##

  environment location: C:\Users\user\Anaconda3\envs\tflow

  added / updated specs:
    - tensorflow


The following NEW packages will be INSTALLED:

    _tflow_1100_select: 0.0.3-mkl
    absl-py:            0.4.1-py36_0
    astor:              0.7.1-py36_0
    blas:               1.0-mkl
    certifi:            2018.8.24-py36_1
    gast:               0.2.0-py36_0
    grpcio:             1.12.1-py36h1a1b453_0
    icc_rt:             2017.0.4-h97af966_0
    intel-openmp:       2018.0.3-0
    libmklml:           2018.0.3-0
    libprotobuf:        3.6.0-h1a1b453_0
    markdown:           2.6.11-py36_0
    mkl:                2018.0.3-1
    mkl_fft:            1.0.4-py36h1e22a9b_1
    mkl_random:         1.0.1-py36h77b88f5_1
    numpy:              1.15.1-py36ha559c80_0
    numpy-base:         1.15.1-py36h8128ebf_0
    pip:                10.0.1-py36_0
    protobuf:           3.6.0-py36he025d50_0
    python:             3.6.6-hea74fb7_0
    setuptools:         40.2.0-py36_0
    six:                1.11.0-py36_1
    tensorboard:        1.10.0-py36he025d50_0
    tensorflow:         1.10.0-mkl_py36hb361250_0
    tensorflow-base:    1.10.0-mkl_py36h81393da_0
    termcolor:          1.1.0-py36_1
    vc:                 14-h0510ff6_3
    vs2015_runtime:     14.0.25123-3
    werkzeug:           0.14.1-py36_0
    wheel:              0.31.1-py36_0
    wincertstore:       0.2-py36h7fe50ca_0
    zlib:               1.2.11-h8395fce_2

Preparing transaction: done
Verifying transaction: done
Executing transaction: done
#
# To activate this environment, use
#
#     $ conda activate tflow
#
# To deactivate an active environment, use
#
#     $ conda deactivate


(base) C:\Users\user>activate tflow

(tflow) C:\Users\user>python -c "import tensorflow"
Traceback (most recent call last):
  File "C:\Users\user\Anaconda3\envs\tflow\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "C:\Users\user\Anaconda3\envs\tflow\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "C:\Users\user\Anaconda3\envs\tflow\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper
    _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
  File "C:\Users\user\Anaconda3\envs\tflow\lib\imp.py", line 243, in load_module
    return load_dynamic(name, filename, file)
  File "C:\Users\user\Anaconda3\envs\tflow\lib\imp.py", line 343, in load_dynamic
    return _load(spec)
ImportError: DLL load failed: The specified module could not be found.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\user\Anaconda3\envs\tflow\lib\site-packages\tensorflow\__init__.py", line 28, in <module>
    from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import
  File "C:\Users\user\Anaconda3\envs\tflow\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "C:\Users\user\Anaconda3\envs\tflow\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in <module>
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "C:\Users\user\Anaconda3\envs\tflow\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "C:\Users\user\Anaconda3\envs\tflow\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "C:\Users\user\Anaconda3\envs\tflow\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper
    _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
  File "C:\Users\user\Anaconda3\envs\tflow\lib\imp.py", line 243, in load_module
    return load_dynamic(name, filename, file)
  File "C:\Users\user\Anaconda3\envs\tflow\lib\imp.py", line 343, in load_dynamic
    return _load(spec)
ImportError: DLL load failed: The specified module could not be found.


Failed to load the native TensorFlow runtime.

See https://www.tensorflow.org/install/install_sources#common_installation_problems

for some common reasons and solutions.  Include the entire stack trace
above this error message when asking for help.

If it still doesn't work, could you share output for try the following:

Here is the output for the second code snippet:

(tflow) C:\Users\user>activate base

(base) C:\Users\user>conda install m2w64-ntldd-git
Solving environment: done

## Package Plan ##

  environment location: C:\Users\user\Anaconda3

  added / updated specs:
    - m2w64-ntldd-git


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    m2w64-ntldd-git-15.e7622f6 |                3          36 KB

The following NEW packages will be INSTALLED:

    m2w64-ntldd-git: 15.e7622f6-3

Proceed ([y]/n)?


Downloading and Extracting Packages
m2w64-ntldd-git-15.e | 36 KB     | ############################################################################ | 100%
Preparing transaction: done
Verifying transaction: done
Executing transaction: done

(base) C:\Users\user>ntldd C:\Users\user\Anaconda3\lib\site-packages\tensorflow\python\_pywrap_tensorflow_internal.pyd
        mklml.dll => C:\Users\user\Anaconda3\Library\bin\mklml.dll (0x00000000067f0000)
        python36.dll => C:\Users\user\Anaconda3\python36.dll (0x00000000067f0000)
        ADVAPI32.dll => C:\Windows\SYSTEM32\ADVAPI32.dll (0x0000000008280000)
        MSVCP140.dll => C:\Users\user\Anaconda3\MSVCP140.dll (0x0000000000150000)
        WS2_32.dll => C:\Windows\SYSTEM32\WS2_32.dll (0x0000000006df0000)
        SHLWAPI.dll => C:\Windows\SYSTEM32\SHLWAPI.dll (0x0000000000150000)
        KERNEL32.dll => C:\Windows\SYSTEM32\KERNEL32.dll (0x0000000000150000)
        VCRUNTIME140.dll => C:\Users\user\Anaconda3\VCRUNTIME140.dll (0x0000000000150000)

Thanks!

@nehaljwani

This comment has been minimized.

Copy link

commented Sep 6, 2018

Weird. I was unable to reproduce it. @staqiuddin To help me eliminate this further, does the non-mkl build work for you? Try: conda install tensorflow-eigen

@staqiuddin

This comment has been minimized.

Copy link
Author

commented Sep 7, 2018

@nehaljwani

I was unable to reproduce it

Just to make sure, we are talking about Windows operating system. I tried the non-mkl build as per your suggestion and it worked. Kindly find below the output:

(base) C:\Users\user>conda create -yn tflow tensorflow-eigen
Solving environment: done

## Package Plan ##

  environment location: C:\Users\user\Anaconda3\envs\tflow

  added / updated specs:
    - tensorflow-eigen


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    tensorflow-base-1.10.0     |eigen_py36h45df0d8_0        38.5 MB
    tensorflow-eigen-1.10.0    |       h97799b2_0           3 KB
    _tflow_1100_select-0.0.2   |            eigen           3 KB
    tensorflow-1.10.0          |eigen_py36h849fbd8_0           4 KB
    ------------------------------------------------------------
                                           Total:        38.5 MB

The following NEW packages will be INSTALLED:

    _tflow_1100_select: 0.0.2-eigen
    absl-py:            0.4.1-py36_0
    astor:              0.7.1-py36_0
    blas:               1.0-mkl
    certifi:            2018.8.24-py36_1
    gast:               0.2.0-py36_0
    grpcio:             1.12.1-py36h1a1b453_0
    icc_rt:             2017.0.4-h97af966_0
    intel-openmp:       2018.0.3-0
    libprotobuf:        3.6.0-h1a1b453_0
    markdown:           2.6.11-py36_0
    mkl:                2018.0.3-1
    mkl_fft:            1.0.4-py36h1e22a9b_1
    mkl_random:         1.0.1-py36h77b88f5_1
    numpy:              1.15.1-py36ha559c80_0
    numpy-base:         1.15.1-py36h8128ebf_0
    pip:                10.0.1-py36_0
    protobuf:           3.6.0-py36he025d50_0
    python:             3.6.6-hea74fb7_0
    setuptools:         40.2.0-py36_0
    six:                1.11.0-py36_1
    tensorboard:        1.10.0-py36he025d50_0
    tensorflow:         1.10.0-eigen_py36h849fbd8_0
    tensorflow-base:    1.10.0-eigen_py36h45df0d8_0
    tensorflow-eigen:   1.10.0-h97799b2_0
    termcolor:          1.1.0-py36_1
    vc:                 14-h0510ff6_3
    vs2015_runtime:     14.0.25123-3
    werkzeug:           0.14.1-py36_0
    wheel:              0.31.1-py36_0
    wincertstore:       0.2-py36h7fe50ca_0
    zlib:               1.2.11-h8395fce_2


Downloading and Extracting Packages
tensorflow-base-1.10 | 38.5 MB   | ############################################################################ | 100%
tensorflow-eigen-1.1 | 3 KB      | ############################################################################ | 100%
_tflow_1100_select-0 | 3 KB      | ############################################################################ | 100%
tensorflow-1.10.0    | 4 KB      | ############################################################################ | 100%
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
#
# To activate this environment, use
#
#     $ conda activate tflow
#
# To deactivate an active environment, use
#
#     $ conda deactivate


(base) C:\Users\user>activate tflow

(tflow) C:\Users\user>python -c "import tensorflow"

(tflow) C:\Users\user>

What do you think is the issue here?

@nehaljwani

This comment has been minimized.

Copy link

commented Sep 7, 2018

@staqiuddin Yes, I have been testing this on Windows too.

The mkl build of tensorflow depends mklml (which further depends on libiomp5). From the output you have shared so far, it seems that python is unable to load the file _pywrap_tensorflow_internal.pyd into memory.

To help me help you further, the next step here would be to use dependency walker and find out which DLL is it choking on. There is a nice tutorial at https://www.thewindowsclub.com/dependency-walker-download . All you need to do is, spawn dependency walker, and run the python from the environment in which tensorflow-mkl is installed from within dependency walker and then type import tensorflow. It should dump a bunch of info in a text box and should highlight the problem. I need from you the dump of that output.

@staqiuddin

This comment has been minimized.

Copy link
Author

commented Sep 7, 2018

Thank you @nehaljwani. I downloaded the Dependency Walker tool and read the tutorial. However, I am not able to apply it to my case. I tried multiple times to get the requested information dump but did not succeed (tried loading Anaconda Prompt, python.exe, cmd.exe, etc. within the tool). I am not able to get import tensorflow to be executed within Dependency Walker and, therefore, the dump I get is irrelevant.

Can you please assist me in providing you with the information dump. Thanks!

@nehaljwani

This comment has been minimized.

Copy link

commented Sep 7, 2018

So, the steps are:

  • In your tensorflow-mkl environment, type where python and then you will see the location of the python prompt. Copy it.
    screenshot from 2018-09-07 22-17-33

  • Open dependency walker. Go to File->Open, enter the location of the python from the 1st step, and then wait. Within 5 minutes, it will do some analysis and then it will load the exe.

  • Then click on Profile->Start Profiling. In the first textbox, enter the value: -c "import tensorflow". Then click OK:
    screenshot from 2018-09-07 22-20-32

  • Then wait for a while, it will open a python prompt, run the import (and fail, in your case) will do some analysis, and then you will be back at the dependency walker window. Then, go to File again, and click on the previously selected python:
    screenshot from 2018-09-07 22-23-32

  • Now, at the bottom text portion of the window, you will have the logs that I require:
    screenshot from 2018-09-07 22-25-12

I've attached the logs that I see (on my successful import)
tflow_mkl_win.txt

@staqiuddin

This comment has been minimized.

Copy link
Author

commented Sep 7, 2018

Thank you @nehaljwani for your detailed steps and great explanation. I appreciate your effort. Kindly find attached the requested log. Thanks!

tflow_win.txt

@nehaljwani

This comment has been minimized.

Copy link

commented Sep 9, 2018

I am not completely sure yet, but the difference seems to be here somewhere:
In your output, we have:

LoadLibraryExW("c:\users\user\anaconda3\lib\site-packages\tensorflow\python\_pywrap_tensorflow_internal.pyd", 0x0000000000000000, LOAD_WITH_ALTERED_SEARCH_PATH) called from "PYTHON36.DLL" at address 0x0000000067265010.
Loaded "_PYWRAP_TENSORFLOW_INTERNAL.PYD" at address 0x00007FFABA3A0000.  Successfully hooked module.
Loaded "MSVCP140.DLL" at address 0x00007FFABA300000.  Successfully hooked module.
Loaded "MKLML.DLL" at address 0x00007FFAADEA0000.  Successfully hooked module.
Unloaded "MKLML.DLL" at address 0x00007FFAADEA0000.
Unloaded "MSVCP140.DLL" at address 0x00007FFABA300000.
Unloaded "_PYWRAP_TENSORFLOW_INTERNAL.PYD" at address 0x00007FFABA3A0000.
LoadLibraryExW("c:\users\user\anaconda3\lib\site-packages\tensorflow\python\_pywrap_tensorflow_internal.pyd", 0x0000000000000000, LOAD_WITH_ALTERED_SEARCH_PATH) returned NULL. Error: The specified module could not be found (126).

In my output, we have:

LoadLibraryExW("c:\users\nwani\downloads\scratch\ad3\lib\site-packages\tensorflow\python\_pywrap_tensorflow_internal.pyd", 0x0000000000000000, LOAD_WITH_ALTERED_SEARCH_PATH) called from "PYTHON36.DLL" at address 0x000000005AC0DFBC.
Loaded "_PYWRAP_TENSORFLOW_INTERNAL.PYD" at address 0x00007FFE958E0000.  Successfully hooked module.
Loaded "MSVCP140.DLL" at address 0x00007FFE9F8E0000.  Successfully hooked module.
Loaded "MKLML.DLL" at address 0x00007FFE8C9A0000.  Successfully hooked module.
Loaded "MSVCR120.DLL" at address 0x00007FFEC9F60000.  Successfully hooked module.
Loaded "LIBIOMP5MD.DLL" at address 0x00007FFE8C7D0000.  Successfully hooked module.

I am not sure as to why my system loads MSVCR120.DLL.

If you download and install https://www.microsoft.com/en-us/download/details.aspx?id=40784 , does the problem go away?

@nehaljwani

This comment has been minimized.

Copy link

commented Sep 9, 2018

Actually, that missing DLL is also part of the conda package: vs2013_runtime .
So, you could try conda install vs2013_runtime instead of downloading and installing that runtime from Microsoft's website.

@nehaljwani

This comment has been minimized.

Copy link

commented Sep 9, 2018

This confirms that mklml.dll is dependent on MSVCR120.dll and I was able to reproduce the issue in a clean VM, which was solved on installing a vs2013_runtime.

(base) C:\Users\nwani\Downloads\scratch>ntldd C:\Users\nwani\Downloads\scratch\ad3\Library\bin\mklml.dll
        MSVCR120.dll => C:\WINDOWS\SYSTEM32\MSVCR120.dll (0x0000000009cf0000)
        KERNEL32.dll => C:\WINDOWS\SYSTEM32\KERNEL32.dll (0x0000000009de0000)
        libiomp5md.dll => C:\Users\nwani\Downloads\scratch\ad3\Library\bin\libiomp5md.dll (0x0000000009cf0000)
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC>dumpbin /dependents C:\Users\nwani\Downloads\scratch\ad3\Library\bin\mklml.dll
Microsoft (R) COFF/PE Dumper Version 14.00.24215.1
Copyright (C) Microsoft Corporation.  All rights reserved.


Dump of file C:\Users\nwani\Downloads\scratch\ad3\Library\bin\mklml.dll

File Type: DLL

  Image has the following dependencies:

    MSVCR120.dll
    KERNEL32.dll
    libiomp5md.dll

  Summary

       E5000 .data
        1000 .data1
       EF000 .pdata
      741000 .rdata
        E000 .reloc
        1000 .rsrc
     860A000 .text
        1000 .tls
        1000 _RDATA
@nehaljwani

This comment has been minimized.

Copy link

commented Sep 9, 2018

Opened an issue at intel/mkl-dnn#316 to highlight the issue on missing (or not so easy to find?) documentation on runtime dependencies of libmklml.

A new release of libmklml conda package is out which depends on vs2013_runtime. Any user who does conda install tensorflow in a new environment should get that required runtime for the mkl variant. One can also just do: conda update libmklml

@staqiuddin Please confirm whether installing vs2013_runtime solves the problem for you.

@staqiuddin

This comment has been minimized.

Copy link
Author

commented Sep 9, 2018

First of all, many thanks @nehaljwani for your great effort and meticulous feedback. Sorry for not replying earlier but I was traveling. I have updated the libmklml conda package using conda update command (as per your last comment) and the problem was solved for both Windows machines (10 and Server 2016).

Thank you.
Closing this issue.

@staqiuddin staqiuddin closed this Sep 9, 2018

@nehaljwani

This comment has been minimized.

Copy link

commented Sep 9, 2018

Thank you for reporting this problem and being patient with the replies. Much appreciated.

@ahmed1186

This comment has been minimized.

Copy link

commented Feb 12, 2019

The problem for me was with a package named protobuf, It was solved by using
pip install https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-0.12.0rc0-cp35-cp35m-win_amd64.whl
which upgraded protobuf to 3.6.1 and solved the error.

@saikrishnadas

This comment has been minimized.

Copy link

commented Feb 15, 2019

The problem for me was with a package named protobuf, It was solved by using
pip install https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-0.12.0rc0-cp35-cp35m-win_amd64.whl
which upgraded protobuf to 3.6.1 and solved the error.

Thanks a lot bro ! @ahmed1186

@xioxu

This comment has been minimized.

Copy link

commented Feb 26, 2019

The problem for me was with a package named protobuf, It was solved by using
pip install https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-0.12.0rc0-cp35-cp35m-win_amd64.whl
which upgraded protobuf to 3.6.1 and solved the error.

Thanks, it solved my issue!

@Pranavan135

This comment has been minimized.

Copy link

commented Mar 4, 2019

Upgrade from conda 4.4.8 to 4.6.7 has resolved the issue for me.

@PallawiSinghal

This comment has been minimized.

Copy link

commented Apr 22, 2019

pip install --upgrade --ignore-installed tensorflow-gpu==1.5

This solved my problem.

@ContinuumIO ContinuumIO locked as resolved and limited conversation to collaborators Apr 22, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.