Trelis 16.1.3 MacOS python interface crashes on import

On MacOS sierra.

Fresh install of Python 2.7 (brew install python)

Set environment variable TRELIS:

export TRELIS=/Applications/


import sys import os sys.path.append(os.path.dirname(os.environ["TRELIS"])) import cubit


Fatal Python error: PyThreadState_Get: no current thread
Abort trap: 6

The very same code works on Ubuntu 16.

It is possible that your version of python is incompatible with the one we use to build Trelis? We are using the default that came with Mac OS X (Mavericks):

Python 2.7.5 (default, Mar 9 2014, 22:15:05)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin

I should also note that it is 64-bit. In order for your version of python to be compatible, it needs to have the same major and minor version (which it seems you do), and also the same bitness (64-bit). I wonder if the python that your installed through homebrew is 32-bit and not 64-bit, so you might check that. If it doesn’t show up when you start python, you can always find it by doing this in python:

import platform

Interesting, that does seem to be the problem.

I have 64-bit 2.7.13:

[code]Python 2.7.13 (default, Dec 18 2016, 07:03:39)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin
Type “help”, “copyright”, “credits” or “license” for more information.

import platform
(‘64bit’, ‘’)[/code]

and that crashes on import.

The system default is 64-bit 2.7.10:

And that imports cubit without crash.

My Ubuntu reports python 2.7.12 compiled with GCC 5.4.0.

I note that you specify 2.7.5, but apparently that is compatible with 2.7.10 for this purpose, but something seems to have happened between .10 and .13.

Do I need to downgrade Python, or do you plan on a fix?


Yes, downgrade.

It can be as simple as running


which may already be on the system.


I am running into this same issue with Trelis 16.2 and MacOS 10.15.4 (Catalina). I’ve tried using Python 2.7.10 and have the same issue. Has there been any development to upgrade the python version that Trelis is compiled with?


Just following up on this… This can be resolved by using Trelis 17.0.1 and Python3+.