cantera incorrectly configured

166 views
Skip to first unread message

Aneesh Vasudev

unread,
Nov 10, 2020, 12:42:42 PM11/10/20
to Cantera Users' Group
Hello community members,

I have been to trying to use setup cantera on a new computer for c++ development. I have followed the instructions presented in  

Directly following the instructions resulted in python 3.8 and numpy version 1.19, which gave an error that 'numpy version was incompatible'. This was after completing installation.
In fact, this was a similar error I got in Matlab, since i also compiled for Matlab toolbox.

Therefore, I downgraded the python version to 3.7.9 and numpy version to 1.17.4 and recompiled the program from source code

Still scons test and install was successfully completed.
However, running the kinetics1 in visual studio gives me yet another error


***********************************************************************
CanteraError thrown by ct2ctml_string:
Error converting input file "C:/Users/AVASUDEV/AppData/Local/Programs/cantera_2.4\data/gri30.cti" to CTML.
Python command was: 'C:\Anacondaconda3\envs\cantera-dev\python.exe'
The exit code was: 1
-------------- start of converter log --------------
sys.path: ['', 'C:\\Anacondaconda3\\envs\\cantera-dev\\python37.zip', 'C:\\Anacondaconda3\\envs\\cantera-dev\\DLLs', 'C:\\Anacondaconda3\\envs\\cantera-dev\\lib', 'C:\\Anacondaconda3\\envs\\cantera-dev', 'C:\\Anacondaconda3\\envs\\cantera-dev\\lib\\site-packages']

Traceback (most recent call last):
  File "C:\Anacondaconda3\envs\cantera-dev\lib\site-packages\numpy\core\__init__.py", line 17, in <module>
    from . import multiarray
  File "C:\Anacondaconda3\envs\cantera-dev\lib\site-packages\numpy\core\multiarray.py", line 14, in <module>
    from . import overrides
  File "C:\Anacondaconda3\envs\cantera-dev\lib\site-packages\numpy\core\overrides.py", line 7, in <module>
    from numpy.core._multiarray_umath import (
ImportError: DLL load failed: The specified module could not be found.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 5, in <module>
  File "C:\Anacondaconda3\envs\cantera-dev\lib\site-packages\cantera\__init__.py", line 4, in <module>
    from ._cantera import *
  File "interfaces\cython\cantera\_cantera.pyx", line 1, in init cantera._cantera
  File "C:\Anacondaconda3\envs\cantera-dev\lib\site-packages\numpy\__init__.py", line 142, in <module>
    from . import core
  File "C:\Anacondaconda3\envs\cantera-dev\lib\site-packages\numpy\core\__init__.py", line 47, in <module>
    raise ImportError(msg)
ImportError:

IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!

Importing the numpy c-extensions failed.
- Try uninstalling and reinstalling numpy.
- If you have already done that, then:
  1. Check that you expected to use Python3.7 from "C:\Anacondaconda3\envs\cantera-dev\python.exe",
     and that you have no directories in your PATH or PYTHONPATH that can
     interfere with the Python and numpy version "1.17.4" you're trying to use.
  2. If (1) looks fine, you can open a new issue at
     https://github.com/numpy/numpy/issues.  Please include details on:
     - how you installed Python
     - how you installed numpy
     - your operating system
     - whether or not you have multiple versions of Python installed
     - if you built from source, your compiler versions and ideally a build log

- If you're working with a numpy git repository, try `git clean -xdf`
  (removes all files not under version control) and rebuild numpy.

Note: this error has many possible causes, so please don't comment on
an existing issue about this - open a new one instead.

Original error was: DLL load failed: The specified module could not be found.
--------------- end of converter log ---------------
***********************************************************************

 terminating...

C:\Users\AVASUDEV\Documents\UVA_ACEM\mzm_cpp_dev\cantera_test\build\Debug\kinetics1.exe (process 18404) exited with code -1.
Press any key to close this window . . .


You help/advice is much appreciated

Thanks and regards
Aneesh

Ingmar Schoegl

unread,
Nov 11, 2020, 11:28:00 AM11/11/20
to Cantera Users' Group
Hi Aneesh,

Sorry to hear about your troubles - I typed up those gist instructions to compile on Windows for testing purposes, but haven't really used it for development (I use a Linux machine for that). Regardless, if things compile they should be usable from Visual Studio, but the instructions don't include configuration steps that may be necessary.

interestingly, you mention that scons test and scons install worked in either case (both Python 3.8 and 3.7?). This points towards your VS development environment not being configured correctly. Are you sure that all library paths are defined and things are being executed in the 'cantera-dev' conda environment?

While I may be of limited help for VS, I'd be interested to hear how this works out, and would most certainly add those instructions to the gist.

-ingmar-

Aneesh Vasudev

unread,
Nov 12, 2020, 6:32:15 AM11/12/20
to canter...@googlegroups.com
Hi Ingmar,

Thanks for getting back to me. And also thanks for the write-up on the instructions. It has been very helpful for amateurs like myself :-P. I used the instruction for installation on my previous computer and was successfully able to compile, run and develop on visual studio. However, the story is different this time.

Currently, I have python 3.7.9. And yes, scons test and install worked for both versions of python. 
Regarding things running correctly in the cantera-dev environment, is the following what you mean?
In the anaconda powershell prompt I activated the cantera-dev environment. Then I opened python and ran some functions from the cantera library. Outcome: It works!
Similarly, in the cantera-dev environment, I opened matlab and performed the same actions. Outcome: It works!

However, outside the cantra-dev environment, there seems to be this issue. As I mentioned in the previous post, I get a similar error both in Matlab and Visual Studio. 

Also, since you have asked, for development in Visual studio, I used the provided CMake file (in the installed examples) to setup the VS project file. In addition, I had to make some changes regarding 'iterator debug level' and runtime library mode - as I mention in the post https://groups.google.com/forum/?oldui=1#!searchin/cantera-users/aneesh%7Csort:date/cantera-users/8EVNbfcPl68/LgzKWDMhAgAJ

Thanks and regards
Aneesh     

--
You received this message because you are subscribed to the Google Groups "Cantera Users' Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cantera-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cantera-users/e5218c56-3881-4b22-a144-787f334dc016n%40googlegroups.com.

Ingmar Schoegl

unread,
Nov 12, 2020, 8:49:18 AM11/12/20
to Cantera Users' Group
Dear Aneesh,

Thanks for the follow up - yes: running everything from inside the cantera-dev environment was exactly what I meant (including matlab). What happens here is that all library paths are set correctly, which won't be the case otherwise. Did you ever try to start VS from within the anaconda powershell?

-ingmar-



You received this message because you are subscribed to a topic in the Google Groups "Cantera Users' Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/cantera-users/T9t5OfTV1QA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to cantera-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cantera-users/CAH_py82xTkQhp2mrcsmKuPgyiz5bkJROn9Z8yaD3ei5g9xTE1w%40mail.gmail.com.

Ingmar Schoegl

unread,
Nov 12, 2020, 9:26:55 AM11/12/20
to Cantera Users' Group
PS: just tried launching VS Community from the powershell myself - it needs its path added to environment variables first, but then it launches via `devenv`: I didn't investigate further though. I also added some comments to the gist to clarify that activating the conda environment is essential.

Aneesh Vasudev

unread,
Nov 16, 2020, 4:39:35 AM11/16/20
to canter...@googlegroups.com
Hi Ingmar,

Yes, as you have suggested, with VS ide open in the 'cantera-dev' environment, I was able to compile and run the cpp code. However, isn't there a fix to straightforwardly operate it (i.e. outside this cantera-dev environment)? 

Thanks and regards
Aneesh 

Ingmar Schoegl

unread,
Nov 16, 2020, 7:12:31 AM11/16/20
to canter...@googlegroups.com
Dear Aneesh,

There should be a way to make VS aware of the Python conda environment. I don’t have a project to test this with, but this may be of interest ... 

Let me know what you find out.

-Ingmar-

Ingmar Schoegl

unread,
Nov 16, 2020, 7:15:52 AM11/16/20
to canter...@googlegroups.com
PS: you’ll always need the conda environment enabled unless you install into the base system (which I wouldn’t recommend and haven’t tested).

Steven DeCaluwe

unread,
Nov 16, 2020, 11:58:37 AM11/16/20
to <cantera-users@googlegroups.com>
If I’m understanding the convo, the simplest approach is to click on the python configuration in the lower left corner, which will let you choose the correct python environment (apologize for attaching a screenshot, but not sure there’s any way around it here).  This shows up once you are viewing a python file in the editor.

I usually run VS with a terminal window, an just activate my condo environment there.





Ingmar Schoegl

unread,
Nov 16, 2020, 12:20:33 PM11/16/20
to canter...@googlegroups.com
Thanks Steven - i think the question was whether you still have to start VS out of the terminal, of whether you can make it aware of the correct conda environment when launching it without the terminal. Btw, is this VS Code or the full VS Community IDE? (I am using the former for Python work these days, but am still on Emacs for C++) ... 

Steven DeCaluwe

unread,
Nov 16, 2020, 12:34:56 PM11/16/20
to <cantera-users@googlegroups.com>
I’m using VS Code, for both C++ and python.  I do not need to launch it from the terminal, but once I launch, I go to “View”->”Terminal” to have a terminal window as part of my IDE. Re-reading my original email, and this was not perfectly clear—sorry.

I make it aware of the condo environment after launching, either by clicking the environment from the previous screenshot or in VS Code’s terminal window (I usually execute my code by running it from terminal command line).  Also, I’m on a Mac. Not sure if that makes a difference, in all this.

Best,
Steven



On Nov 16, 2020, at 10:20 AM, Ingmar Schoegl <isch...@gmail.com> wrote:

Thanks Steven - i think the question was whether you still have to start VS out of the terminal, of whether you can make it aware of the correct conda environment when launching it without the terminal. Btw, is this VS Code or the full VS Community IDE? (I am using the former for Python work these days, but am still on Emacs for C++) ... 
On Mon, Nov 16, 2020 at 10:58 AM Steven DeCaluwe <steven....@gmail.com> wrote:
If I’m understanding the convo, the simplest approach is to click on the python configuration in the lower left corner, which will let you choose the correct python environment (apologize for attaching a screenshot, but not sure there’s any way around it here).  This shows up once you are viewing a python file in the editor.

I usually run VS with a terminal window, an just activate my condo environment there.



<Screen Shot 2020-11-16 at 9.55.17 AM.png>


Ingmar Schoegl

unread,
Nov 16, 2020, 1:01:11 PM11/16/20
to Cantera Users' Group
Steven, thanks for the clarification! That's how I use VS Code also (Linux & Windows, albeit only for Python at the moment). I assume that there's a corresponding configuration option for the full VS Community IDE also ...
-ingmar-

Aneesh Vasudev

unread,
Nov 18, 2020, 3:40:01 AM11/18/20
to Cantera Users' Group
Hi Ingmar and Steven,

Thanks for your responses.

Kind regards,
Aneesh

Reply all
Reply to author
Forward
0 new messages