Problems to run cantera in ubuntu 18 terminal

97 views
Skip to first unread message

Rafael Meier

unread,
Jul 30, 2021, 1:19:51 AM7/30/21
to Cantera Users' Group
Hello guys,
I am used to running my python scripts in the terminal. Recently, I changed my system from Ubuntu 16 (which I used for a long time) to 18, and I installed Cantera following the steps in https://cantera.org/install/ubuntu-install.html. I checked my old scripts running in python idle firstly, and they worked. However, when I tried to import the Cantera or run a script from the terminal, I received just a message of segment fault (core dumped).

I checked similar problems on the web, but some of them are too old and were applicable for others versions. I wonder if there's a problem with a missing package (or conflict) or yet some problems with the system paths, or any mistake

Thanks in advance,
Rafael

Bryan Weber

unread,
Jul 30, 2021, 9:04:25 AM7/30/21
to Cantera Users' Group
Hi Rafael,

Can you please copy the contents of the entire script and the entire error message into a post? That'll help with debugging.

Thanks!
Bryan

Rafael Meier

unread,
Jul 30, 2021, 11:54:49 AM7/30/21
to Cantera Users' Group
Hello Bryan,
I attached my files. However, the script does not even run. If I open my terminal I have  only this sequence,

boltzmann@MrGoodBytes:~/Desktop$ python3 flameSpeedGuessProfile.py
Segmentation fault (core dumped)
boltzmann@MrGoodBytes:~/Desktop$

In the same way,

boltzmann@MrGoodBytes:~/Desktop$ python3
Python 3.6.9 (default, Jan 26 2021, 15:33:00)
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cantera
Segmentation fault (core dumped)
boltzmann@MrGoodBytes:~/Desktop$

At this exact moment, I tried something weird. I run this script as a super-user and worked. But it does not work as a normal user yet. Do you have any idea what can be happening?

Thanks for your answer,
Rafael
dmeSkelSandia.xml
flameSpeedGuessProfile.py

Bryan Weber

unread,
Jul 30, 2021, 12:04:04 PM7/30/21
to Cantera Users' Group
Hi Rafael,

Thanks for providing that! Can you try running Python under gdb, to see where the segfault is occurring?

gdb --args python3 -c 'import cantera'

When it reaches the error, type 

where

and then paste the output back here?

Thanks,
Bryan

Rafael Meier

unread,
Jul 30, 2021, 2:02:01 PM7/30/21
to Cantera Users' Group
Hey Bryan,
The output is just,

GNU, blabla..,
Copyright, blabla,

Type "apropos word" to search for commands related to "word"...
Reading symbols from python3...(no debugging symbols found)...done.
(gdb) where
No stack.
(gdb)

Thanks,
Rafael

Bryan Weber

unread,
Jul 30, 2021, 4:40:11 PM7/30/21
to Cantera Users' Group
Hi Rafael,

Ah, you may need to type "run" once gdb opens (without the quote marks). "where" only works when a segfault has happened. Which Python are you using, specifically how did you install that Python? What is the output of which python3

Best,
Bryan

Rafael Meier

unread,
Jul 30, 2021, 4:55:51 PM7/30/21
to Cantera Users' Group
Hey Bryan,
In gdb, I receive this message now,

(gdb) run
Starting program: /usr/bin/python3 -c import cantera
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
  File "<string>", line 1
    import
         ^
SyntaxError: invalid syntax
[Inferior 1 (process 12868) exited with code 01]

(gdb) where
No stack.
(gdb)

Regarding the Python version I am using Python3, but I did not install it. The Ubuntu 18 comes with Python3 by default. And about the which python3, I have
/usr/bin/python3.

Thank you
Rafael

Bryan Weber

unread,
Aug 1, 2021, 7:46:08 AM8/1/21
to Cantera Users' Group
Hi Rafael,

Well, it seems that there's a syntax error there in the Python part of the code. You might need to put the "import cantera" part into single quotes, like this:

gdb --args python3 -c 'import cantera'

By the way, what this is doing is running Python in the GNU Debugger. Everything after "--args" is passed to the debugger to be run. So you can also run everything after the "--args" on the command line. The "-c" flag for Python runs the following statement and exits Python immediately.

Best,
Bryan

Rafael Meier

unread,
Aug 2, 2021, 9:14:27 AM8/2/21
to Cantera Users' Group
Hello Bryan,

Sorry for that. Actually, I've never used gdb (dumb thing done, :) ). Now when I add gdb --args python3 -c 'import cantera', I have

(gdb) run
Starting program: /usr/bin/python3 -c import\ cantera
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff62d5389 in GlobalError::PushToStack() () from /usr/lib/x86_64-linux-gnu/libapt-pkg.so.5.0
(gdb) where

And the result of command 'where' I attached in whereGDB file.

I appreciate your attention
Rafael
whereGDB

Bryan Weber

unread,
Aug 2, 2021, 10:01:01 AM8/2/21
to Cantera Users' Group
Hi Rafael,

Thanks! That was insightful. At the top of the file, it is showing that it is calling the CPython 3.6 library, whereas you said that /usr/bin/python3 points to Python 3.8. Can you make sure that all traces of Python 3.6 are removed from the system? I'm not sure how to do that, though.

Thanks,
Bryan

Rafael Meier

unread,
Aug 3, 2021, 10:59:16 AM8/3/21
to Cantera Users' Group
Hello Bryan,
Thanks for your feedback. I will try to handle in some way this issue.
Thanks again,
Rafael

Ray Speth

unread,
Aug 6, 2021, 11:58:40 PM8/6/21
to Cantera Users' Group

Hi Rafael,

I found the library (apt_pkg) and function call (GlobalError::PushToStack) mentioned in that stack trace suspicious, as neither is used by Cantera. I found a similar bug report which suggested that this is an error in the Ubuntu apport package, which is the tool that’s supposed to let you report errors more easily, but is in this case causing the segfault. Can you try the suggestion from that thread, of removing the python3-apport package? I think that you will still get an error, but now it should just be a regular Python exception that we have some chance of actually debugging.

Regards,
Ray

Rafael Meier

unread,
Aug 10, 2021, 8:37:46 PM8/10/21
to Cantera Users' Group

Hello Ray,
Thanks. I followed the thread and as you said the error showed up. This is what is shown in my terminal,
Python 3.6.9
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cantera as ct
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3/dist-packages/cantera/__init__.py", line 4, in <module>
    from ._cantera import *
ImportError: /usr/lib/python3/dist-packages/cantera/_cantera.cpython-36m-x86_64-linux-gnu.so: undefined symbol: CVLapackBand
>>>

I am not sure if it is related to Fortran packages or some python module.

Regards,
Rafael
Reply all
Reply to author
Forward
0 new messages