-
Notifications
You must be signed in to change notification settings - Fork 220
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
tensorflow-gpu win64 import failure #6431
Comments
tagging @nehaljwani |
OK, this seems to be due to the cudatoolkit libraries being installed into |
Yes, if you look at the recipe for this (peek at the tarball), that location is added to PATH manually, before running the tests. @mingwandroid @jjhelmus Should the DDLs be added to PATH by the tensorflow-gpu package or the cudatoolkit package? |
We already add far too many entries to PATH on Windows, the system with the shortest limits and biggest issues around PATH! Can we move the DLLs to somewhere that is on PATH instead? |
Yes, I think we can move things to a different location. I don't know why our DLLs were going into the DLLs directory in the first place. That said, I'm seeing other things in that directory:
Is there some rpath thing that should be happening with the tensorflow .pyd files so that we don't need any of these directories on the path? |
Also, for my reference, what is the canonical installation directory for DLLs in a conda environment? Looking at the environment I just made, I see: |
Looking at the Numba code, we specifically look for the CUDA libraries in the DLLs directory on Windows (that code is 4 years old!), so there might also be some drift in Windows packaging conventions over that time. :) |
Python is putting libraries into the DLLs folder as that is the folder name from the Python.org installer. |
There are 5 entries that conda adds to PATH:
We do not add |
For MSVC-compiled DLLs, I'd say |
Are symlinks a thing on Windows? Because Numba has been looking in DLLs for so long, we would need to add additional search paths to Numba, release it, and get them out there before we could push updates to the cudatoolkit package. However, if we could install to Library\bin and then symlink to DLLs, the migration could happen over some amount of time. |
$PREFIX\DLLs gets added to the Python search path by Python itself which is why the various compiled extensions in the standard library are importable. The libraries in that directory are not on the PATH otherwise from what I can tell. |
Yeah, it ends up in sys.path from: This reminds me, we need to stop applying this old patch: https://github.com/AnacondaRecipes/python-feedstock/blob/master/recipe/0005-Win32-Ensure-Library-bin-is-in-os.environ-PATH.patch Maybe we can route it through sys.path / pyconfig.h instead? The reason we should not apply this patch is because it prevents conda's activate / deactivate from working correctly since it adds an extra entry to PATH that conda is not expecting. |
It looks like the DLLs folder is added to |
We don't set that registry key, so I think we're falling back to:
.. from pyconfig.h |
Did this recently change? I want to make a package that has internal DLLs that in turn depend on CUDA DLLs so adding it to the path via |
AFAIK the DLLs directory has never been included on the PATH, although it is possible that a package is adding it via an activation script. I don't think cudatoolkit should be putting file in that directory, |
The reason this issue never came up before was that the only users of the cudatoolkit packages in Anaconda were Numba and Accelerate (now Pyculib). Both dynamically loaded the cuda DLLs in their Python code at runtime using an explicit search path (defined inside Numba) because the packages needed to work both with and without CUDA support being present. It's clear now (4 years later) that the DLLs from cudatoolkit were put in the Are links an option? |
Symlinks are not a viable option on Windows because they often require administrative privileges for creation. Is there any reason hardlinks won't work? (Will they not be handled properly by conda build?) |
The tar format (and apparently Python's tar module) should handle hard links, but I don't know if there are some Windows nuances to worry about, or if hardlinks in a conda package tar file will cause trouble elsewhere in the system. |
It looks like hardlinks aren't handled properly on Windows. According to the Python documentation:
I'm guessing Windows is considered to be a system that does not support symbolic links. I just tried creating a cudatoolkit package with hardlinks to the DLLs in |
OK, given that all the straightforward solutions are not available, is it worth considering a cudatoolkit package that has a post-link script to create the required hard links? (And corresponding pre-unlink script to remove them.) I know such scripts are discouraged, but this seems like the only option, short of breaking things for existing Numba installation if the user happens to install a newer cudatoolkit. |
This seems like a reasonable solution to me...at the same time would it also make sense to just make cudatoolkit that only contains this post-link script and depends on subpackages that only contain specific CUDA libraries. This would save a lot of space for situations where we don't need specific libraries (e.g., cufft and NPP) and also allow you to avoid post-installation hardlinks unless you needed them for Numba. Are the cudatoolkit build recipes internal? I'm not sure how straightforward it would be to split the package up... |
The cuda recipes are present here: https://github.com/numba/conda-recipe-cudatoolkit/ |
OK, I'll talk to Stuart about this (the splitting up was something I think he proposed at one point). We'll put something together and get back to you. |
Hello, Thank you. |
The tensorflow-gpu package for win64 doesn't seem to import:
Here is the import error:
The text was updated successfully, but these errors were encountered: