tpaviot / pythonocc-contrib

Miscanellous pythonocc contributions and experiments. Anayone can request for an write access.
17 stars 11 forks source link

Problem using pythonocc-core installed through Anaconda's conda [ImportError: DLL load failed] #28

Open huskier opened 8 years ago

huskier commented 8 years ago

My OS: Windows 7(64bit) Anaconda: 64bit and 32bit, and I tried both. I mean I installed pythonocc-core and related libraries on both versions.

After installing pythonocc-core through conda, I encounter a problem when I try to run a simple pythonocc program, and the traceback reads:

C:\huskier\cad>c:\Anaconda\python.exe simplest_CQ_FreeCAD_PythonOCC.py FreeCAD 0.16, Libs: 0.16R6584 (Git) Traceback (most recent call last): File "simplest_CQ_FreeCAD_PythonOCC.py", line 15, in from OCC.BRep import BRep_Tool File "C:\Anaconda\Lib\site-packages\OCC\BRep.py", line 32, in _BRep = swig_import_helper() File "C:\Anaconda\Lib\site-packages\OCC\BRep.py", line 28, in swig_import_help er _mod = imp.load_module('_BRep', fp, pathname, description) ImportError: DLL load failed: The specific module could not be found.

C:\huskier\cad>

After googling the web, I add the PYTHONPATH into the system environment variables, and it looks like:

C:\Anaconda\Lib\site-packages;C:\Anaconda\Library\bin;C:\Anaconda\Library\lib;C:\Anaconda\Lib\site-packages\OCC;C:\Anaconda\Lib\site-packages\pywin32_system32;C:\Anaconda\Lib\site-packages\win32;C:\Anaconda\Library\lib;C:\Anaconda\DLLs;C:\Anaconda\pkgs\oce-0.16.1-vc9_5\Library\bin

And I also copied the OCC's dll located in the "C:\Anaconda\Library\bin" into "C:\Anaconda\Lib\site-packages", but the problem is still there.

The DLL problem looks common on Windows OS, but I don't know which DLL is the problem. Any ideas?

Thanks.

huskier commented 8 years ago

I injected a print statement just before the problem statement "_mod = imp.load_module('_BRep', fp, pathname, description)", and the printed info looks like:

pathname = C:\Anaconda\Lib\site-packages\OCC_BRep.pyd desc = ('.pyd', 'rb', 3) fp = <open file 'C:\Anaconda\Lib\site-packages\OCC\_BRep.pyd', mode 'rb' at 0x0000000003178540>

So, the problem should be "_BRep.pyd". However, I don't know how to jump into the deeper side to find the real issue.

Any ideas?