tensorflow: [Windows] Cannot import _pywrap_tensorflow when zlib.dll is not in PATH

What related GitHub issues or StackOverflow threads have you found by searching the web for your problem?

#1013 etc…

Environment info

Operating System:

Windows 10 Installed version of CUDA and cuDNN: No CUDA (“CPU support only”)

Pip wheel was self-build. Here’s the output of python -c "import tensorflow; print(tensorflow.__version__)": in attatchment

If installed from source, provide git-rev output - 3737ac321e67410bf061257d5f644eae8abbf79b No bazel (is it required?)

If possible, provide a minimal reproducible example (We usually don’t have time to read hundreds of lines of your code)

import tensorflow

What other attempted solutions have you tried?

Install with python setup.py install and generally avoid any tedious building/making but with no success.

Logs or other output that would be helpful

(If logs are large, please upload as attachment or provide link). output.txt

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 20 (8 by maintainers)

Commits related to this issue

Most upvoted comments

Hi folks, thanks for digging into this! It looks like we end up depending on both the static and dynamic versions of zlib on Windows, for some reason… I’m guessing it’s one of the external project on which we depend, maybe libpng?

I’m going to rename the bug and I’ll look into removing this dependency on zlib.dll.

I ran into this problem too after pip installing the cmake-built .whl (this is on vanilla Python 3.5 64-bit and built with VS2015). Although dependency walker suggested a bunch of missing dlls, the only one it actually needed was zlib.dll; after copying that from the build directory into the package installation directory under site-packages, the import worked just fine. I realize this is something that @KamodaP already tried unsuccessfully, but I thought it’d be worth chiming in anyway.

To that effect, should zlib.dll be vendored inside the wheel by cmake, or can it be listed as a dependency?

I looked at one of them and it might be part of the msvc crt. Can you run again with a shell that has the MSVC path etc enabled? There should be a batch file somewhere in program files x86 microsoft visual studio* binn or something like that.

Alternatively, try installing https://www.microsoft.com/en-us/download/details.aspx?id=48145 on your system.

Oh, I see. Well, you have to debug why it’s not loading. There are usually two reasons for that, and python would typically give the same error message:

  • The _pywrap_tensorflow.dll is not found in the path. You have to fiddle with the system paths. There are lots of hits on the web to figure that out
  • the dll itself does not resolve some transitive dependencies (e.g. it cannot find libcudart). You can download the dependency walker for that

We now have windows GPU support with cmake. It should work with cuda 6.5.