Import Error: DLL load failed

Submitted by gabriela123 on Thu, 04/09/2020 - 19:02
Forums

Hello, I am using Freeling 4.1 on Windows environment with MSVC 2015 and the equivalent versions of icu and boost. I installed Freeling from source and the python version that I used was 3.7.6 . When I try to test sample.py I get a error about DLL files, that says that the module is not found so I changed the path like it is recommended on freeling manual but it didn't work. The error is the following :

C:\Freeling\freeling\share\freeling\APIs\python3>python sample.py < mytext.txt
Traceback (most recent call last):
File "sample.py", line 10, in
import pyfreeling
File "C:\Freeling\freeling\share\freeling\APIs\python3\pyfreeling.py", line 15, in
import _pyfreeling
ImportError: DLL load failed: Impossível localizar o módulo especificado.

Can you help me fix this issue? Thank you very much!

Did you follow the manual page "Building APIs for other languages in Windows" https://freeling-user-manual.readthedocs.io/en/v4.1/installation/apis-windows/  ?

You need to add option -DPYTHON3_API=ON to the CMake command

If you don't get any errors from "CMake" nor form "make" nor from "make install", then the python API pyfreeling.py will be built and installed

If it is not, there is an error somewhere in the process (most likely you did not set that option, or the needed extra python libraries were not installed, or were not found)

If the library is built, but the loader does not find it, then you need to properly set the %PATH% variable, as specified in the web page above

Hello again, thank you for your reply. My case is the last option, the library was built with the source code but when I try to use it , the DLL is not found.(Please open the following links that contain print screens for every situation that I am describing).
I already set the %PATH% variable, and this is how it looks like:Image here

After the installation of the source code the folder "%FLINSTALL%\freeling\share\freeling\APIs\python" has all the files that is supposed to have.This is my python3 folder inside %FLINSTALL%:
Image here

I did the installation with -DPYTHON3_API=ON, -DSWIG_DIR=C:\swigwin and -DSWIG_EXECUTABLE=C:\swigwin\swig.exe in the cmake command, but when I try to run the example I get this error: Image here

Another thing is: When I try to test the installation in the precompiled folder it works , but when I try the same command in the folder after the installation of the source code nothing happens.

Precompiled folder test:
Image here

Source code test:
Image here

My main goal is to use Freeling with python. Can you please help me?

This looks like a path problem.

If analyzer.bat fails, it may also be because it is not finding the library. 

You can start diagnosing why analyzer.bat is failing.  Maybe runing commands in analyzer.bat one by one, and see if any of them produces an error.

You can also seek answers in windows/python forums, about how to proprely set windows path variables (I don't use windows so I can't help you much there)