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

Python pupil_Apriltags : Problem with DLL path “Could not find module” #38

Open
marceau45800 opened this issue Jun 11, 2021 · 6 comments

Comments

@marceau45800
Copy link

Hello I have a problem with pupil_apriltags in python.
I have been searching for more than 1 week and tried multiple solutions but none of them worked.

My problem is not with the import of the librairy but when I try to create the detector. There is a reference to a xxxx.dll file (I think) which does not work.

My code

Very simple

from pupil_apriltags import Detector
import cv2
import numpy as np


at_detector = Detector(families='tag36h11',
                       nthreads=1,
                       quad_decimate=1.0,
                       quad_sigma=0.0,
                       refine_edges=1,
                       decode_sharpening=0.25,
                       debug=0)

My error

Traceback (most recent call last):                                                                                  
File "detection_apriltags.py", line 6, in <module>                                                                        
at_detector = Detector()                                                                                              
File "C:\Users\Utilisateur\anaconda3\lib\site-packages\pupil_apriltags\bindings.py", line 285, in __init__
self.libc = ctypes.CDLL(str(hit))                                                                                     
File "C:\Users\Utilisateur\anaconda3\lib\ctypes\__init__.py", line 381, in __init__                                       
self._handle = _dlopen(self._name, mode)                                                                            
FileNotFoundError: Could not find module 'C:\Users\Utilisateur\anaconda3\lib\site-
packages\pupil_apriltags\lib\apriltag.dll' (or one of its dependencies). Try using the full path 
with constructor syntax.

My configuration

  • Python 3.8.5
  • Windows 10
@Randy-W
Copy link

Randy-W commented Oct 9, 2021

I had the same problem, did you solve it?

@gggdttt
Copy link

gggdttt commented Feb 23, 2022

image
image
It seems that we need to change the path here.
But I don't know how to change...

@MichaelCurrie
Copy link

Same question is here:

https://stackoverflow.com/questions/67919822/python-pupil-apriltags-problem-with-dll-path-could-not-find-module

Answer:

I had the same problem, apparently the .dll search mechanism changed in python 3.8 You can see more details of how to fix it here.

I made a PR into this repo to fix the issue. See #48

After this PR is accepted this issue can be closed, I believe.

@shan0987
Copy link

Hi I have the same issue. Just wondering if you have fixed this issue?

@Fiiila
Copy link

Fiiila commented Jun 20, 2023

Problem

Hi there, just recently experienced the same problem with FileNotFoundError: Could not find module 'path/to/existing/dll'. Problem was caused by dependent libraries in different folder.

In my case...

  • installation with pip install pupil-apriltags in conda environment
    • pupil-apriltags==1.0.4.post10
    • Python==3.9.16
    • Windows 10 Enterprise - 10.0.19045
  • when trying to create detector Error message showed that missing module is C:/Users/username/Miniconda3/envs/my_env/lib/site-packages/pupil_apriltags/libapriltag.dll with same errors as @marceau45800 mentioned
  • found out thanks to dll-diagnostics that this dll library is dependent on these libraries
(my_env) C:\>dlldiag trace C:/Users/username/Miniconda3/envs/my_env/lib/site-packages/pupil_apriltags/lib/apriltag.dll   
DLL Diagnostic Tools version 0.0.18
Copyright (c) 2019-2021 Adam Rehn

Parsing module header and identifying non delay-loaded dependencies... done.

Identifying the module's delay-loaded dependencies... done.

Parsed module details:
Module:          C:\Users\username\Miniconda3\envs\my_env\lib\site-packages\pupil_apriltags\lib\apriltag.dll
Type:            Dynamic-Link Library
Architecture:    x64

The module imports 12 direct dependencies:
api-ms-win-crt-convert-l1-1-0.dll
api-ms-win-crt-environment-l1-1-0.dll
api-ms-win-crt-heap-l1-1-0.dll
api-ms-win-crt-math-l1-1-0.dll
api-ms-win-crt-runtime-l1-1-0.dll
api-ms-win-crt-stdio-l1-1-0.dll
api-ms-win-crt-string-l1-1-0.dll
api-ms-win-crt-utility-l1-1-0.dll
KERNEL32.dll
pthreadVC2.dll
VCRUNTIME140.dll
WINMM.dll

Error: no debugger found for architecture x64. Please ensure the Debugging Tools for Windows 10 (WinDbg) are installed correctly.

  • just looked around and found this folder with libraries C:\Users\username\Miniconda3\envs\my_env\lib\site-packages\pupil_apriltags.libs

Solution

just add this line before creating Detector instance:

os.add_dll_directory("C:/Users/username/Miniconda3/envs/my_env/lib/site-packages/pupil_apriltags.libs")

It worked for me.

@nadavof
Copy link

nadavof commented Jul 27, 2023

any updates about this open issue?

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

7 participants