Skip to content

[Windows] Cannot import _pywrap_tensorflow when zlib.dll is not in PATH #5275

Closed

Description

@KamodaP

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 - 3737ac3
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

Activity

  1. drpngx commented on Oct 29, 2016

    @drpngx
    Contributor

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

  2. reopened this on Oct 29, 2016
  3. added
    stat:awaiting response
    on Oct 29, 2016
  4. KamodaP commented on Oct 29, 2016

    @KamodaP
    Author

    That's great that you do!
    But i don't have Nvidia, sorry :P
    Oh, and I focused so much on that form that I forgot to write what's wrong xD
    But that seems evident from the logs. It installs correctly (no cmake errors) but builds with warnings. I have the wheel and folder with setup.py. Both give the same error on import.

  5. drpngx commented on Oct 29, 2016

    @drpngx
    Contributor

    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
  6. KamodaP commented on Oct 29, 2016

    @KamodaP
    Author

    I copied the dll and libs and other stuff to Python folders already, with no success. But I tried the dependency walker, and here's what I found:
    All API-MS-.dll are missing
    All EXT-MS-
    .dll are missing
    also DEVICECLOCKHELPERS.DLL, EMCLIENT.DLL, ZLIB.DLL are missing

  7. drpngx commented on Oct 29, 2016

    @drpngx
    Contributor

    try getting zlib1 or zlib in place. The dirtiest, but easiest, is probably to put in in C:\windows\system. If you poke around the installation directory these DLLs should be there.

  8. KamodaP commented on Oct 30, 2016

    @KamodaP
    Author

    I copied this zlib.dll to some places, but nothing changed. And I couldn't find those previous two (or any of those prefixed with *-MS-[...])

  9. drpngx commented on Oct 30, 2016

    @drpngx
    Contributor

    Can you give the full names?

  10. KamodaP commented on Oct 31, 2016

    @KamodaP
    Author

    Here you go: dll_names.txt

  11. added
    type:build/install
    on Nov 1, 2016
  12. aselle commented on Nov 1, 2016

    @aselle
    Contributor

    @mrry, do you have any further insight?. I have no way to test this. You might try adding the DLL directories to PYTHONPATH and your windows PATH.

  13. added
    stat:awaiting tensorflower
    and removed
    stat:awaiting response
    on Nov 1, 2016
  14. 2 remaining items

  15. KamodaP commented on Nov 2, 2016

    @KamodaP
    Author

    I'll check with that msvc crt later today.
    I understand that there are out-of-the-box implementations of python for data science, but unfortunately I cannot use it in the project.
    The truth is that I switched to sklearn since time is of the essence here, but if I'm able to solve that in my free time I might devise some sort of tutorial on how to solve problems that I've encountered.

    @drpngx Oh and about that script, you told me to run something with a shell again, but do you mean simply to run python and try to import again, or try to build/install again?

  16. reiv commented on Nov 2, 2016

    @reiv

    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?

  17. KamodaP commented on Nov 3, 2016

    @KamodaP
    Author

    I haven't done one thing yet that I think I might try. Because I've copied the dll to DLLs in Python (C:\[...]\Python35\DLLs) directory, perhaps that's not the right thing to do and I should put it in C:\Windows directory?

  18. zandaqo commented on Nov 3, 2016

    @zandaqo

    @reiv Same story here, same mistake and copying zlib.dll helped, thanks for the suggestion. I too think the wheel could address this issue better.

  19. KamodaP commented on Nov 3, 2016

    @KamodaP
    Author

    @zandaqo did you copy it to windows directory?

  20. zandaqo commented on Nov 3, 2016

    @zandaqo

    @KamodaP No, just a random directory that was in my PATH. I'm not yet sure where to give a permanent place, so I checked by adding custom directory with zlib.dll to my PATH and it solved the importing issue.

  21. mrry commented on Nov 4, 2016

    @mrry
    Contributor

    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.

  22. changed the title [-]Tensorflow build myself on windows 10 cannot import _pywrap_tensorflow[/-] [+][Windows] Cannot import _pywrap_tensorflow when zlib.dll is not in PATH[/+] on Nov 4, 2016
  23. self-assigned this
    on Nov 4, 2016
  24. KamodaP commented on Nov 4, 2016

    @KamodaP
    Author

    So it does work after putting zlib.dll into a directory that is referenced in PATH environment variable, but it DOES NOT work when put in directory that is in PYTHONPATH (or something like that) so including DLLs directory.

  25. added a commit that references this issue on Nov 7, 2016
    f0502bc
  26. added a commit that references this issue on Nov 7, 2016
    e1c7e51
  27. lidongyv commented on Nov 13, 2016

    @lidongyv

    In win10 x64 cmake error
    -- Looking for pthread.h
    -- Looking for pthread.h - found
    -- Looking for pthread_create
    -- Looking for pthread_create - not found
    -- Looking for pthread_create in pthreads
    -- Looking for pthread_create in pthreads - found
    -- Found Threads: TRUE
    this is the only error appeared during cmake ,is it very important for the msbuild?
    or i can just ignore it.
    With ignore it ,i msbuild the project ,but stuck during clone protobuf and jsoncpp ,is it related the missing of pthreads.lib?
    i have successfully install the pthread protobuf and jsoncpp by testing in vs2015, so i don' t think the issue comes from installing .
    In vs2015 i use prgma linking to the pthreads.lib where can i add prgma in cmake files ,i haven;t find the target file, so i add prgma to every (5) file including pthread.h ,how can i fix this problem .

  28. added a commit that references this issue on Nov 14, 2016
    cb2ef58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

stat:awaiting tensorflowertype:build/install

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions