Cantera / cantera

Chemical kinetics, thermodynamics, and transport tool suite
https://cantera.org
Other
582 stars 342 forks source link

DLL load failed while importing _cantera #1609

Closed ArthurCarret closed 9 months ago

ArthurCarret commented 10 months ago

Hi everyone, I just started using Cantera so you will have to excuse me if this is a stupid question. I found a similar problem in the forum but the answer (which was a needed update for Python) is not relevant in my case.

Problem description

I use Anaconda and therefore installed Cantera following the procedure on the website

_I used the name ct-envv3 due to the fact that I have already installed and used older versions but I now need new functionnalities!

This being done, I tried to run a tutorial from the Cantera website : adiabatic_flame.py

However, I got the following error message :

  File c:\users\utilisateur\desktop\sapienza\glarborg\cantera_tuto_adiabatic_flame.py:16
    import cantera as ct

  File ~\anaconda3\envs\ct-env_v3\Lib\site-packages\cantera\__init__.py:4
    from ._cantera import *

ImportError: DLL load failed while importing _cantera: La procédure spécifiée est introuvable.

System information

bryanwweber commented 10 months ago

Hi! Thanks for reporting this. When you say:

Downloading of few packages like libcantera directly from Anaconda Interface

what do you mean by that? Why do you need to do so? Conda's dependency solver should already account for any required packages by Cantera.

ArthurCarret commented 10 months ago

Hi ! Directly from anaconda navigator, you can install libacantera and libcantera-devel packages.

speth commented 10 months ago

Can you get a shell (that is, Windows command prompt) in Spyder that has the ct-env_v3 environment activated? If so, can you provide the output of the following commands?

ArthurCarret commented 10 months ago

Hi!

- For set

ALLUSERSPROFILE=C:\ProgramData
APPDATA=C:\Users\Utilisateur\AppData\Roaming
CommonProgramFiles=C:\Program Files\Common Files
CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files
CommonProgramW6432=C:\Program Files\Common Files
COMPUTERNAME=DESKTOP-3D3IK5O
ComSpec=C:\WINDOWS\system32\cmd.exe
CONDA_DEFAULT_ENV=ct-env_v3
CONDA_EXE=C:\Users\Utilisateur\anaconda3\Scripts\conda.exe
CONDA_PREFIX=C:\Users\Utilisateur\anaconda3\envs\ct-env_v3
CONDA_PREFIX_1=C:\Users\Utilisateur\anaconda3
CONDA_PROMPT_MODIFIER=(ct-env_v3)
CONDA_PYTHON_EXE=C:\Users\Utilisateur\anaconda3\python.exe
CONDA_SHLVL=2
DriverData=C:\Windows\System32\Drivers\DriverData
EFC_11532=1
FPS_BROWSER_APP_PROFILE_STRING=Internet Explorer
FPS_BROWSER_USER_PROFILE_STRING=Default
HOMEDRIVE=C:
HOMEPATH=\Users\Utilisateur
LOCALAPPDATA=C:\Users\Utilisateur\AppData\Local
LOGONSERVER=\\DESKTOP-3D3IK5O
NUMBER_OF_PROCESSORS=8
OneDrive=C:\Users\Utilisateur\OneDrive
OneDriveConsumer=C:\Users\Utilisateur\OneDrive
OS=Windows_NT
Path=C:\Users\Utilisateur\anaconda3\envs\ct-env_v3;C:\Users\Utilisateur\anaconda3\envs\ct-env_v3\Library\mingw-w64\bin;C:\Users\Utilisateur\anaconda3\envs\ct-env_v3\Library\usr\bin;C:\Users\Utilisateur\anaconda3\envs\ct-env_v3\Library\bin;C:\Users\Utilisateur\anaconda3\envs\ct-env_v3\Scripts;C:\Users\Utilisateur\anaconda3\envs\ct-env_v3\bin;C:\Users\Utilisateur\anaconda3\condabin;C:\Users\Utilisateur\Desktop\Sapienza\gcc\bin;C:\Users\Utilisateur\Desktop\Sapienza\gcc\libexec\gcc\x86_64-w64-mingw32\12.2.0;C:\Users\Utilisateur\gcc\bin;C:\Users\Utilisateur\gcc\libexec\gcc\x86_64-w64-mingw32\12.2.0;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client;C:\Program Files\Intel\iCLS Client;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\WiFi\bin;C:\Program Files\Common Files\Intel\WirelessCommon;C:\Program Files\dotnet;C:\Program Files (x86)\MINI-REFPROP;C:\TDM-GCC-64\bin;C:\Users\Utilisateur\AppData\Local\Microsoft\WindowsApps;C:\Users\Utilisateur\AppData\Local\Programs\MiKTeX 2.9\miktex\bin\x64;.;C:\Users\Utilisateur\AppData\Local\Programs\Microsoft VS Code\bin
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
PROCESSOR_ARCHITECTURE=AMD64
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 142 Stepping 10, GenuineIntel
PROCESSOR_LEVEL=6
PROCESSOR_REVISION=8e0a
ProgramData=C:\ProgramData
ProgramFiles=C:\Program Files
ProgramFiles(x86)=C:\Program Files (x86)
ProgramW6432=C:\Program Files
PROMPT=(ct-env_v3) $P$G
PSModulePath=C:\Program Files\WindowsPowerShell\Modules;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules
PUBLIC=C:\Users\Public
RPprefix=C:\Program Files (x86)\MINI-REFPROP
SESSIONNAME=Console
SSL_CERT_FILE=C:\Users\Utilisateur\anaconda3\envs\ct-env_v3\Library\ssl\cacert.pem
SystemDrive=C:
SystemRoot=C:\WINDOWS
TEMP=C:\Users\UTILIS~1\AppData\Local\Temp
TMP=C:\Users\UTILIS~1\AppData\Local\Temp
USERDOMAIN=DESKTOP-3D3IK5O
USERDOMAIN_ROAMINGPROFILE=DESKTOP-3D3IK5O
USERNAME=Utilisateur
USERPROFILE=C:\Users\Utilisateur
windir=C:\WINDOWS
__CONDA_OPENSLL_CERT_FILE_SET="1"

- For list

List_1 List_2 List_3 List_4 List_5 List_6

- For info

 active environment : ct-env_v3
    active env location : C:\Users\Utilisateur\anaconda3\envs\ct-env_v3
            shell level : 2
       user config file : C:\Users\Utilisateur\.condarc
 populated config files : C:\Users\Utilisateur\.condarc
          conda version : 23.3.1
    conda-build version : 3.22.0
         python version : 3.9.13.final.0
       virtual packages : __archspec=1=x86_64
                          __win=0=0
       base environment : C:\Users\Utilisateur\anaconda3  (writable)
      conda av data dir : C:\Users\Utilisateur\anaconda3\etc\conda
  conda av metadata url : None
           channel URLs : https://conda.anaconda.org/cantera/win-64
                          https://conda.anaconda.org/cantera/noarch
                          https://repo.anaconda.com/pkgs/main/win-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/win-64
                          https://repo.anaconda.com/pkgs/r/noarch
                          https://repo.anaconda.com/pkgs/msys2/win-64
                          https://repo.anaconda.com/pkgs/msys2/noarch
          package cache : C:\Users\Utilisateur\anaconda3\pkgs
                          C:\Users\Utilisateur\.conda\pkgs
                          C:\Users\Utilisateur\AppData\Local\conda\conda\pkgs
       envs directories : C:\Users\Utilisateur\anaconda3\envs
                          C:\Users\Utilisateur\.conda\envs
                          C:\Users\Utilisateur\AppData\Local\conda\conda\envs
               platform : win-64
             user-agent : conda/23.3.1 requests/2.28.1 CPython/3.9.13 Windows/10 Windows/10.0.22621
          administrator : False
             netrc file : None
           offline mode : False

I hope this can help you!

speth commented 10 months ago

Thanks for providing that information, @ArthurCarret. It does look like you have all the right packages installed, and your conda environment seems to have all the right paths specified. I think we need to figure out what DLL or function it's failing to find. The steps for this should be:

  1. install the Dependencies tool.
  2. Run this tool _from the command line where your ct-env_v3 environment is active_. That is, you will need to run something like"C:\Program Files\Dependencies\Dependencies.exe" from that prompt. Apologies, I do not know the exact path where it will be installed, as I am not currently using a Windows PC.
  3. Use Dependencies to open the file C:\Users\Utilisateur\anaconda3\envs\ct-env_v3\Lib\site-packages\cantera\_cantera.cp39-win_amd64.pyd
  4. Identify any DLLs that the tool is unable to find, or if there are methods that are not being resolved. Sorry, I can't really be more specific here, since it's not clear what's missing. One thing you may want to keep an eye out for is if there are any libraries that are being loaded from unexpected locations (i.e., other than from your conda installation and the Windows system directories).
band-a-prend commented 9 months ago

@ArthurCarret Please check does your system have installed Microsoft Visual C++ Redistributable library, e.g VC_redist.x64.2015-2022_14.34.31938 for x86_64 env. I didn't use Conda so maybe it requires x86 vcredist library.

speth commented 9 months ago

In the absence of any update from the original poster, I'm going to close this. We can re-open if @ArthurCarret responds with additional information.