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

help with this: ModuleNotFoundError: No module named '_common'

0 votes

Dear all,

I have installed the Fenics through Anaconda, but when I am trying to run an example I am getting the following error. Can someone help me with this??

Thanks in advance.

RuntimeError: module compiled against API version 0xb but this version of numpy is 0xa Traceback (most recent call last): File
"/home/camv/Documents/Programming/anaconda3/lib/python3.6/site-packages/dolfin/cpp/common.py",
line 18, in swig_import_helper
return importlib.import_module(mname) File "/home/camv/Documents/Programming/anaconda3/lib/python3.6/importlib/init.py",
line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level) File "", line 978, in _gcd_import File
"", line 961, in _find_and_load File
"", line 950, in _find_and_load_unlocked
File "", line 648, in _load_unlocked
File "", line 560, in module_from_spec
File "", line 922, in
create_module File "", line 205, in
_call_with_frames_removed ImportError: numpy.core.multiarray failed to import During handling of the above exception, another exception
occurred: Traceback (most recent call last): File
"/home/camv/Downloads/demo_nonlinear-poisson.py", line 47, in
from dolfin import * File "/home/camv/Documents/Programming/anaconda3/lib/python3.6/site-packages/dolfin/init.py",
line 17, in
from . import cpp File "/home/camv/Documents/Programming/anaconda3/lib/python3.6/site-packages/dolfin/cpp/init.py",
line 43, in
exec("from . import %s" % module_name) File "", line 1, in File
"/home/camv/Documents/Programming/anaconda3/lib/python3.6/site-packages/dolfin/cpp/common.py",
line 21, in
_common = swig_import_helper() File "/home/camv/Documents/Programming/anaconda3/lib/python3.6/site-packages/dolfin/cpp/common.py",
line 20, in swig_import_helper
return importlib.import_module('_common') File "/home/camv/Documents/Programming/anaconda3/lib/python3.6/importlib/init.py",
line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level) ModuleNotFoundError: No module named '_common'

asked Jun 21, 2017 by CAMV FEniCS Novice (120 points)

1 Answer

0 votes

We uploaded a new fenics package yesterday that fixed a similar issue. Please make sure you have the updated package and if you still see the problem, then report it here.

answered Jun 21, 2017 by johannr FEniCS Expert (17,350 points)

Hello Johannes,

Thanks for your comment. Before you answered I did you said in other issue

Johannes Ring

May 15

Re: [fenics-support] Re: FEniCS 2017.1 released

On Mon, May 15, 2017 at 2:43 PM, Douglas Arnold arn...@umn.edu
wrote:

: weil 506; dpkg -l |grep dolfin
ii dolfin-bin 2017.1.0-1~ppa2~zesty1
all Executable scripts for DOLFIN
ii dolfin-doc 2017.1.0-1~ppa2~zesty1
all Documentation and demo programs for DOLFIN
ii libdolfin-dev 2017.1.0-1~ppa2~zesty1
amd64 Shared links and header files for DOLFIN
ii libdolfin2017.1 2017.1.0-1~ppa2~zesty1
amd64 Shared libraries for DOLFIN
ii python-dolfin 2017.1.0-1~ppa2~zesty1
amd64 Python interface for DOLFIN

Thanks, this looks correct. I cannot reproduce this in a clean
ubuntu:17.04 Docker container, so it is difficult to say what the
problem is. Could you do some debugging in
/usr/lib/python2.7/dist-packages/dolfin/cpp/common.py? Try adding
importlib.import_module(mname) after line 20 and before the try
block. The try to import fenics again.

Johannes

That solves the error, nevertheless, now I am getting a new one:

In instant.import_module_directly: Failed to import module
'dolfin_3f9468d15524a356de612aeaf25187c843aef0e7' from
'/home/camv/.cache/instant/python3.6/cache';
ImportError:/home/camv/.cache/instant/python3.6/cache/dolfin_3f9468d15524a356de612aeaf25187c843aef0e7/_dolfin_3f9468d15524a356de612aeaf25187c843aef0e7.so:
undefined symbol: _ZNK6dolfin8Variable3strB5cxx11Eb; Failed to import
module found in cache. Modulename:
'dolfin_3f9468d15524a356de612aeaf25187c843aef0e7'; Path:
'/home/camv/.cache/instant/python3.6/cache';
ImportError:/home/camv/.cache/instant/python3.6/cache/dolfin_3f9468d15524a356de612aeaf25187c843aef0e7/_dolfin_3f9468d15524a356de612aeaf25187c843aef0e7.so:
undefined symbol: _ZNK6dolfin8Variable3strB5cxx11Eb; Traceback (most
recent call last): File
"/home/camv/Downloads/demo_nonlinear-poisson.py", line 67, in
f = Expression("x[0]sin(x[1])") File "/home/camv/Documents/Programming/anaconda3/lib/python3.6/site-packages/dolfin/functions/expression.py",
line 679, in new
mpi_comm=kwargs.get("mpi_comm")) File "/home/camv/Documents/Programming/anaconda3/lib/python3.6/site-packages/dolfin/compilemodules/expressions.py",
line 266, in compile_expressions
mpi_comm=mpi_comm) File "/home/camv/Documents/Programming/anaconda3/lib/python3.6/site-packages/dolfin/compilemodules/expressions.py",
line 183, in compile_expression_code
mpi_comm=mpi_comm) File "/home/camv/Documents/Programming/anaconda3/lib/python3.6/site-packages/dolfin/compilemodules/jit.py",
line 70, in mpi_jit
return local_jit(
args, **kwargs) File "/home/camv/Documents/Programming/anaconda3/lib/python3.6/site-packages/dolfin/compilemodules/compilemodule.py",
line 567, in compile_extension_module
compiled_module = instant.import_module(module_name) File "/home/camv/Documents/Programming/anaconda3/lib/python3.6/site-packages/instant/cache.py",
line 176, in import_module
return check_disk_cache(modulename, cache_dir, moduleids) File "/home/camv/Documents/Programming/anaconda3/lib/python3.6/site-packages/instant/cache.py",
line 144, in check_disk_cache
module = import_and_cache_module(path, modulename, moduleids) File
"/home/camv/Documents/Programming/anaconda3/lib/python3.6/site-packages/instant/cache.py",
line 92, in import_and_cache_module
e)) File "/home/camv/Documents/Programming/anaconda3/lib/python3.6/site-packages/instant/output.py",
line 103, in instant_assert
raise AssertionError(text) AssertionError: Failed to import module found in cache. Modulename:
'dolfin_3f9468d15524a356de612aeaf25187c843aef0e7'; Path:
'/home/camv/.cache/instant/python3.6/cache';
ImportError:/home/camv/.cache/instant/python3.6/cache/dolfin_3f9468d15524a356de612aeaf25187c843aef0e7/_dolfin_3f9468d15524a356de612aeaf25187c843aef0e7.so:
undefined symbol: _ZNK6dolfin8Variable3strB5cxx11Eb;

Process finished with exit code 134 (interrupted by signal 6: SIGABRT)

I have tried instant-clean, but I still get the same error....do you have an idea of this?

Best

...