Cantera / cantera

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

DLL load failed while importing _cantera #1707

Closed zhanggh97 closed 1 week ago

zhanggh97 commented 2 weeks ago

Problem description

DLL load failed while importing _cantera

Steps to reproduce

I use Anaconda and therefore installed Cantera by conda in anaconda powershell prompt.

conda install --channel cantera cantera

And I directly installed cantera in the environment 'base' without create a new environment. After installation, I try to run a script. When it run to the ‘import’ line as followed, there will be an error

import cantera as ct

Behavior (error infomation)

File "D:\Software\anaconda3\Lib\site-packages\cantera__init__.py", line 4, in from ._cantera import * ImportError: DLL load failed while importing _cantera: 找不到指定的模块。

I try to run it in pycharm and anaconda powershell prompt, the error happen in both.

I also use dependency walker to check the file: _cantera.cp311-win_amd64.pyd, and there are lots of dependency which was not found and most of them are 'API-MS-WIN' and 'EXT-MS-WIN'. I search it online and people said it always happened while using dependency walker. So I can't make sure which part is the real problem.

System information

Additional context

About one week ago, I uninstall the old version anaconda, then install the last version. And I updated the BIOS of my cpu and windows system. Before that, I can use the old version cantera without any problem. Today is the fisrt time I try to use cantera after update, then the problem happened. I'm not sure whether there is a causal relationship.

speth commented 2 weeks ago

Using the modern version of the dependency walker (https://github.com/lucasg/Dependencies) I don't see any unresolved dependencies. You also need to make sure to run the Dependencies tool from your Conda environment so it has the same path as your Python interpreter. For example, from the Conda prompt run start "C:\Program Files\Dependencies\DependenciesGUI.exe", adjusting the path to wherever you've installed it.

Here's what I see trying this on my system: image

Can you post a screenshot of what you see in the left panel when loading the _cantera.cp311-win_amd64.pyd file this way, and expanding at least the dependency on cantera_shared.dll? Also, can you share the output of the conda list command? What happens if you try following our instructions to install Cantera in a separate Conda environment?

ischoegl commented 2 weeks ago

As an aside, this may be a question for the User Group ... it looks like an installation issue to me (not a bug)

zhanggh97 commented 2 weeks ago

Using the modern version of the dependency walker (https://github.com/lucasg/Dependencies) I don't see any unresolved dependencies. You also need to make sure to run the Dependencies tool from your Conda environment so it has the same path as your Python interpreter. For example, from the Conda prompt run start "C:\Program Files\Dependencies\DependenciesGUI.exe", adjusting the path to wherever you've installed it.

Here's what I see trying this on my system: image

Can you post a screenshot of what you see in the left panel when loading the _cantera.cp311-win_amd64.pyd file this way, and expanding at least the dependency on cantera_shared.dll? Also, can you share the output of the conda list command? What happens if you try following our instructions to install Cantera in a separate Conda environment?

Using the modern version of the dependency walker (https://github.com/lucasg/Dependencies) I don't see any unresolved dependencies. You also need to make sure to run the Dependencies tool from your Conda environment so it has the same path as your Python interpreter. For example, from the Conda prompt run start "C:\Program Files\Dependencies\DependenciesGUI.exe", adjusting the path to wherever you've installed it.

Here's what I see trying this on my system: image

Can you post a screenshot of what you see in the left panel when loading the _cantera.cp311-win_amd64.pyd file this way, and expanding at least the dependency on cantera_shared.dll? Also, can you share the output of the conda list command? What happens if you try following our instructions to install Cantera in a separate Conda environment?

This is the conda list:
1 2 3 4 5 6

zhanggh97 commented 2 weeks ago

Using the modern version of the dependency walker (https://github.com/lucasg/Dependencies) I don't see any unresolved dependencies. You also need to make sure to run the Dependencies tool from your Conda environment so it has the same path as your Python interpreter. For example, from the Conda prompt run start "C:\Program Files\Dependencies\DependenciesGUI.exe", adjusting the path to wherever you've installed it.

Here's what I see trying this on my system: image

Can you post a screenshot of what you see in the left panel when loading the _cantera.cp311-win_amd64.pyd file this way, and expanding at least the dependency on cantera_shared.dll? Also, can you share the output of the conda list command? What happens if you try following our instructions to install Cantera in a separate Conda environment?

I created a new env for cantera with python=3.9.0, then I installed the cantera with version of 2.6.0. It runs well. So my problem is solved in some way. However, if you want to discuss this problem more. I will show the detail after I install the the modern version of the dependency walker.

zhanggh97 commented 2 weeks ago

As an aside, this may be a question for the User Group ... it looks like an installation issue to me (not a bug)

You are right. I'm sorry if I proposed this problem at a wrong place. Could you send me the link of User Group? Next time I get a problem I will try to propose it in a suitable way.

speth commented 2 weeks ago

I created a new env for cantera with python=3.9.0, then I installed the cantera with version of 2.6.0. It runs well. So my problem is solved in some way.

Did you try creating a new environment for python=3.11 and cantera=3.0? Does that work or fail with the same error?

speth commented 1 week ago

Closing in the absence of an update from the original poster.