简体   繁体   中英

ImportError: DLL load failed: The specified module could not be found. (Python rocketcea wrapper for NASA Fortran CEA)

I am trying to use the rocketcea (installed via pip rather than cloning the git) wrapper for NASA's CEA code, but I recieve the following error in the title when I try to run their example code:

#example code
from rocketcea.cea_obj import CEA_Obj
C = CEA_Obj( oxName='LOX', fuelName='LH2')
for mr in range(2,9):
    print(mr, C.get_Isp(Pc=100.0, MR=mr, eps=40.0) )

Resulting error (Python 3.7 launched from the PyCharm IDE):

Traceback (most recent call last):
  File "C:/Users/George/Documents/SpaceportTXV/cea test/cea import.py", line 1, in <module>
    from rocketcea.cea_obj import CEA_Obj
  File "C:\Users\George\AppData\Local\Programs\Python\Python37-32\lib\site-packages\rocketcea\cea_obj.py", line 51, in <module>
    import rocketcea.py_cea as py_cea
ImportError: DLL load failed: The specified module could not be found.

I am using the MinGW GCC compiler suite, and I have added both bin and lib to my PATH as rocketcea recommends to resolve the issue.

My PATH:

C:\Users\George>echo %PATH%
C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Microsoft VS Code\bin;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\Microsoft SQL Server\120\DTS\Binn\;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Users\George\AppData\Local\Programs\Python\Python37-32\Scripts\;C:\Users\George\AppData\Local\Programs\Python\Python37-32\;C:\Users\George\AppData\Local\Microsoft\WindowsApps;C:\Users\George\AppData\Local\Programs\mingw\mingw64\bin;C:\Users\George\AppData\Local\Programs\mingw\mingw64\lib;

If it helps, link to what my rocketcea folder contains.

If anyone has any insight as to why I am having this error, I would greatly appreciate it. I can also add any additional information that may be helpful

I don't know if an alternative solution will have been found by now, but after struggling for hours on end with this, I found a way to make the error message go away. This was done òn Windows 10 with an Anaconda3 install running Python 3.6.8 x64, but the core idea is that in C:\\ProgramData\\Anaconda3\\Lib\\site-packages\\rocketcea , one can navigate to ..\\rocketcea\\.libs , where a .dll file resides. I added the path to this .libs folder to my Path variable, and on calling the test code again, it ran.

I hope this helps.

As a side note, I also added the path to the python3.dll file in my python install folder to the Path variable, but I suspect the rocketcea specific .dll was the true key.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM