This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

fenics import error: undefined symbol: ompi_mpi_comm_world

0 votes

Dear all,
I'm coding my FEniCS code under Pycharm and every is ok, I can run it and see the results. But when I try to run it under the terminal by just type:
python myFEniCS-Code.py
Then I received this error. So now I can only run my code by PyCharm, this is not so convenient. How can I solve it? Maybe this is a very stupid question, I'm a very new FEniCSer. Thank you!

Python 2.7.12 (default, Jul 1 2016, 15:12:24)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.

import dolfin
Traceback (most recent call last):
File "", line 1, in
File "/usr/lib/python2.7/dist-packages/dolfin/init.py", line 17, in
from . import cpp
File "/usr/lib/python2.7/dist-packages/dolfin/cpp/init.py", line 43, in
exec("from . import %s" % module_name)
File "", line 1, in
File "/usr/lib/python2.7/dist-packages/dolfin/cpp/common.py", line 32, in
_common = swig_import_helper()
File "/usr/lib/python2.7/dist-packages/dolfin/cpp/common.py", line 28, in swig_import_helper
_mod = imp.load_module('_common', fp, pathname, description)
ImportError: /usr/lib/libblacsCinit-openmpi.so.1: undefined symbol: ompi_mpi_comm_world

I checked my /usr/lib, and I find I have the libblacsCinit-openmpi.so.1 file, so I don't know why this problem happen.

Hope someone can help me.
Thank you.

asked Nov 11, 2016 by walkandthink FEniCS Novice (320 points)

The error tells you not that the file is missing, but that it doesn't contain a particular symbol (i.e. function definition): ompi_mpi_comm_world. This probably means that you have several versions installed and dolfin is not finding the right one. Could it be that you installed FEniCS using virtualenv or conda and you are not running the right python interpreter? Look for the interpreter in the Pycharm's project configuration and compare it with the one you run from the console.

Thank you for the reply.
Its the python interpterter.
I'm running it under Ubuntu not a virtual PC.

virtualenv is not a virtualization technology like VirtualBox or Parallels, but a way of managing multiple independent python installations with packages, dependencies, etc. So is conda.

...