Import Python libraries from Python3

I am trying to import cubit in my python environment, I first add in the python path:


then I have in my script the following command:

import cubit

it works with python2 but if I do the same thing with python3 I get an error:

Traceback (most recent call last):
File “”, line 16, in
import cubit
File “/Applications/”, line 29, in
from cubit3 import *
File “/Applications/”, line 15, in
import _cubit3
ImportError: dlopen(/Applications/, 2): Symbol not found: _PyCMethod_New
Referenced from: /Applications/
Expected in: flat namespace
in /Applications/

Any Idea why?

My python version is Python 3.8.5 (anaconda3)

Hi @balep, sorry for your trouble. First off, we use Python 3.9.2 on Mac, so loading Cubit into 3.8.5 is unlikely to work. Secondly, in 2021.3 there were still some Mac-specific bugs in how we packaged Python 3.9.2 that have been fixed in 2021.5. I’d recommend you do two things:
Upgrade to 2021.5 from our downloads page.
Either use Python 3.9.2 or use the version of Python that ships with Cubit. On Mac, it’s at this path:


That’s a bit of a mouthful, unfortunately, but I know you won’t have any issues with that version of Python because we test against that.

1 Like

Thanks a lot for the help I will test it and let you know!

Thanks for asking this @balep. :blush: Another workaround I had for this was to install a conda environment with Python 3.9.2. Once the environment was activated, at the top of my Python script I include:

import sys
import os
print("Python version")
print (sys.version)
import cubit


I also can install modules like NumPy into my conda env and utilize them as well.

1 Like