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

ImportError: DLL load failed while importing _rife_ncnn_vulkan_wrapper: The specified module could not be found. #1

Open
dsmanneke opened this issue May 16, 2021 · 9 comments

Comments

@dsmanneke
Copy link

when you try to import the module: "from rife_ncnn_vulkan import RIFE"
the following error will come:
Traceback (most recent call last):
File ".\run_test.py", line 1, in
from rife_ncnn_vulkan import RIFE
File "C:\Users%username%\Projects\Restoration_GUI\rife\rife_ncnn_vulkan.py", line 12, in
import rife_ncnn_vulkan_wrapper as raw
File "C:\Users%username%\Projects\Restoration_GUI\rife\rife_ncnn_vulkan_wrapper.py", line 15, in
import _rife_ncnn_vulkan_wrapper
ImportError: DLL load failed while importing _rife_ncnn_vulkan_wrapper: The specified module could not be found.

I download the following file:
When downloading rife-ncnn-vulkan-python-20210504-windows.zip

This is also the case for previous builds

@ArchieMeng
Copy link
Member

ArchieMeng commented May 16, 2021

Thank you for your issue.

The release package hasn't been fully tested under windows, so your issues reminded me to have a look at the behavior of it on windows.

I have downloaded the release package and had a short check on the zip archive (I am busy working on my assignments recently, so I can only have short checks before I am have time to boot up my windows machine for testing the issue.). I found that the DLL lib file "rife-ncnn-vulkan-python-20210504-windows/_rife_ncnn_vulkan_wrapper.pyd" is there. So I think 🤔 it should work. Could you have a look at where "_rife_ncnn_vulkan_wrapper.pyd" is and check if it is located within the same folder with _rife_ncnn_vulkan_wrapper.py?

@dsmanneke
Copy link
Author

Thank you for answering quickly.

I checked and the file is located in the folder. To be sure, here is my terminal output ;)

 Directory: C:\Users\%username%\Projects\Restoration_GUI\rife_ncnn
  
  
 Mode            LastWriteTime         Length Name
 ----                 -------------         ------ ----
 d-----         5/16/2021   5:40 PM             models
 d-----         5/16/2021   6:47 PM            __pycache__
 -a----         5/16/2021   6:47 PM           1098 LICENSE
 -a----         5/16/2021   6:47 PM           3459 README.md
 -a----         5/16/2021   6:47 PM           2507 rife_ncnn_vulkan.py
 -a----         5/16/2021   6:47 PM           6100 rife_ncnn_vulkan_wrapper.py
 -a----         5/16/2021   6:45 PM             35 run_test.py
 -a----         5/16/2021   6:47 PM         177552 vcomp140.dll
 -a----         5/16/2021   6:47 PM        3821056 _rife_ncnn_vulkan_wrapper.dll
 -a----         5/16/2021   6:47 PM        3821056 _rife_ncnn_vulkan_wrapper.pyd
  
  
  PS C:\Users\%username%\Projects\Restoration_GUI\rife_ncnn> python.exe .\run_test.py
  Traceback (most recent call last):
    File ".\run_test.py", line 1, in <module>
      from rife_ncnn_vulkan import RIFE
    File "C:\Users\%username%\Projects\Restoration_GUI\rife_ncnn\rife_ncnn_vulkan.py", line 12, in <module>
      import rife_ncnn_vulkan_wrapper as raw
    File "C:\Users\%username%\Projects\Restoration_GUI\rife_ncnn\rife_ncnn_vulkan_wrapper.py", line 15, in <module>
      import _rife_ncnn_vulkan_wrapper
  ImportError: DLL load failed while importing _rife_ncnn_vulkan_wrapper: The specified module could not be found.

Here is also my python version

PS C:\Users\%username%\Projects\Restoration_GUI\rife_ncnn> python.exe -VV
Python 3.8.5 (tags/v3.8.5:580fbb0, Jul 20 2020, 15:57:54) [MSC v.1924 64 bit (AMD64)]

@ArchieMeng
Copy link
Member

ArchieMeng commented May 17, 2021

Thank you for answering quickly.

I checked and the file is located in the folder. To be sure, here is my terminal output ;)

 Directory: C:\Users\%username%\Projects\Restoration_GUI\rife_ncnn
  
  
 Mode            LastWriteTime         Length Name
 ----                 -------------         ------ ----
 d-----         5/16/2021   5:40 PM             models
 d-----         5/16/2021   6:47 PM            __pycache__
 -a----         5/16/2021   6:47 PM           1098 LICENSE
 -a----         5/16/2021   6:47 PM           3459 README.md
 -a----         5/16/2021   6:47 PM           2507 rife_ncnn_vulkan.py
 -a----         5/16/2021   6:47 PM           6100 rife_ncnn_vulkan_wrapper.py
 -a----         5/16/2021   6:45 PM             35 run_test.py
 -a----         5/16/2021   6:47 PM         177552 vcomp140.dll
 -a----         5/16/2021   6:47 PM        3821056 _rife_ncnn_vulkan_wrapper.dll
 -a----         5/16/2021   6:47 PM        3821056 _rife_ncnn_vulkan_wrapper.pyd
  
  
  PS C:\Users\%username%\Projects\Restoration_GUI\rife_ncnn> python.exe .\run_test.py
  Traceback (most recent call last):
    File ".\run_test.py", line 1, in <module>
      from rife_ncnn_vulkan import RIFE
    File "C:\Users\%username%\Projects\Restoration_GUI\rife_ncnn\rife_ncnn_vulkan.py", line 12, in <module>
      import rife_ncnn_vulkan_wrapper as raw
    File "C:\Users\%username%\Projects\Restoration_GUI\rife_ncnn\rife_ncnn_vulkan_wrapper.py", line 15, in <module>
      import _rife_ncnn_vulkan_wrapper
  ImportError: DLL load failed while importing _rife_ncnn_vulkan_wrapper: The specified module could not be found.

Here is also my python version

PS C:\Users\%username%\Projects\Restoration_GUI\rife_ncnn> python.exe -VV
Python 3.8.5 (tags/v3.8.5:580fbb0, Jul 20 2020, 15:57:54) [MSC v.1924 64 bit (AMD64)]

I confirmed that the problem exists. It is caused by CMake compilie configurations which might binded the compiled lib with the host's python lib. In other words, the current rife-ncnn-vulkan-python windows build can only be run with python 3.7.9. Even python 3.7.8, python 3.8.5 and python 3.9.5 will fail to run it. However, this was supposed to be already fixed in previous commits which solved such problems on Linux platforms.
I will try to fix it in the next build. At the present, you can try to compile it on your own computers. The best reference is release.yml which is the configurations for generating windows releases with Github Action. You can just look at the run sections in the windows parts.
I hope these contents are helpful to you.

ArchieMeng added a commit that referenced this issue May 17, 2021
ArchieMeng added a commit that referenced this issue May 17, 2021
ArchieMeng added a commit that referenced this issue May 17, 2021
@ArchieMeng
Copy link
Member

ArchieMeng commented May 20, 2021

Sorry to tell you that this issue is quite complicated to solve. Since the upstream has already got two version updates to follow, I need to make new release now.
I will fix this issue once I find a solution in the future. Before that, I am sorry that you may need to compile it on your own or use python 3.9 which is the python version on the compile machine.
Or do you think compiling this lib for popular python versions on Windows is good?

@ArchieMeng
Copy link
Member

@Justin62628
Copy link
Contributor

Could you try the new binaries?
https://github.com/media2x/rife-ncnn-vulkan-python/releases/tag/1.1.1

Unfortunately, the rife pyd still points to python310.dll In the latest 1.1.1 build
2054FD93-D502-48D1-B64B-77231E17FF35
C6A794CF-C016-409B-8719-77979B3F51DC

@Justin62628
Copy link
Contributor

Btw, I also tried manually building by MSVC after cloning the whole project. the import also crashes loading under my python 3.7.9 env. The cmake config could be still problematic.

@Justin62628
Copy link
Contributor

#5 This fixed my issue in my fork after referring to other media2x closed issues, the pyd now can link to python37.dll correctly

@ArchieMeng
Copy link
Member

#5 This fixed my issue in my fork after referring to other media2x closed issues, the pyd now can link to python37.dll correctly

Thank you for your PR. We forgot to add the PY_VERSION patch after @k4yt3x implemented the download tricks in setup.py.
@dsmanneke Could you use the latest build to see if the problem is solved? https://github.com/media2x/rife-ncnn-vulkan-python/releases/tag/1.1.2-2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants