Hello,
I am trying to install multiphenicsx in the docker environment, which is used for dolfinx library.
The motivation for installation is to use the Lagrange multiplier method in the variational formulation.
I installed multiphenicsx using
!pip3 install "multiphenicsx@git+https://github.com/multiphenics/multiphenicsx.git@2ff1154"
inside the jupyter notebook.
By doing so, I could successfully run the command
import multiphenicsx
However, failed with
import multiphenicsx.fem
with following error :
/usr/local/lib/python3.10/dist-packages/multiphenicsx/cpp/multiphenicsx/fem/DofMapRestriction.cpp: In member function ‘void multiphenicsx::fem::DofMapRestriction::_compute_cell_dofs(std::shared_ptr<const dolfinx::fem::DofMap>)’:
/usr/local/lib/python3.10/dist-packages/multiphenicsx/cpp/multiphenicsx/fem/DofMapRestriction.cpp:213:41: error: ‘using element_type = const class dolfinx::fem::DofMap’ {aka ‘const class dolfinx::fem::DofMap’} has no member named ‘map’
213 | auto unrestricted_cell_dofs = dofmap->map();
| ^~~
/usr/local/lib/python3.10/dist-packages/multiphenicsx/cpp/multiphenicsx/fem/DofMapRestriction.cpp:217:48: error: ‘std::experimental’ has not been declared
217 | const auto unrestricted_cell_dofs_c = std::experimental::submdspan(
| ^~~~~~~~~~~~
/usr/local/lib/python3.10/dist-packages/multiphenicsx/cpp/multiphenicsx/fem/DofMapRestriction.cpp:218:39: error: ‘std::experimental’ has not been declared
218 | unrestricted_cell_dofs, c, std::experimental::full_extent);
| ^~~~~~~~~~~~
---------------------------------------------------------------------------
DistutilsExecError Traceback (most recent call last)
File /usr/lib/python3.10/distutils/unixccompiler.py:117, in UnixCCompiler._compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts)
116 try:
--> 117 self.spawn(compiler_so + cc_args + [src, '-o', obj] +
118 extra_postargs)
119 except DistutilsExecError as msg:
File /usr/lib/python3.10/distutils/ccompiler.py:910, in CCompiler.spawn(self, cmd)
909 def spawn(self, cmd):
--> 910 spawn(cmd, dry_run=self.dry_run)
File /usr/lib/python3.10/distutils/spawn.py:91, in spawn(cmd, search_path, verbose, dry_run)
90 cmd = cmd[0]
---> 91 raise DistutilsExecError(
92 "command %r failed with exit code %s" % (cmd, exitcode))
DistutilsExecError: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
During handling of the above exception, another exception occurred:
CompileError Traceback (most recent call last)
File /usr/lib/python3.10/distutils/core.py:148, in setup(**attrs)
147 try:
--> 148 dist.run_commands()
149 except KeyboardInterrupt:
File /usr/lib/python3.10/distutils/dist.py:966, in Distribution.run_commands(self)
965 for cmd in self.commands:
--> 966 self.run_command(cmd)
File /usr/lib/python3.10/distutils/dist.py:985, in Distribution.run_command(self, command)
984 cmd_obj.ensure_finalized()
--> 985 cmd_obj.run()
986 self.have_run[command] = 1
File /usr/lib/python3/dist-packages/setuptools/command/build_ext.py:79, in build_ext.run(self)
78 old_inplace, self.inplace = self.inplace, 0
---> 79 _build_ext.run(self)
80 self.inplace = old_inplace
File /usr/lib/python3.10/distutils/command/build_ext.py:340, in build_ext.run(self)
339 # Now actually compile and link everything.
--> 340 self.build_extensions()
File /usr/lib/python3.10/distutils/command/build_ext.py:449, in build_ext.build_extensions(self)
448 else:
--> 449 self._build_extensions_serial()
File /usr/lib/python3.10/distutils/command/build_ext.py:474, in build_ext._build_extensions_serial(self)
473 with self._filter_build_errors(ext):
--> 474 self.build_extension(ext)
File /usr/lib/python3/dist-packages/setuptools/command/build_ext.py:202, in build_ext.build_extension(self, ext)
201 self.compiler = self.shlib_compiler
--> 202 _build_ext.build_extension(self, ext)
203 if ext._needs_stub:
File /usr/lib/python3.10/distutils/command/build_ext.py:529, in build_ext.build_extension(self, ext)
527 macros.append((undef,))
--> 529 objects = self.compiler.compile(sources,
530 output_dir=self.build_temp,
531 macros=macros,
532 include_dirs=ext.include_dirs,
533 debug=self.debug,
534 extra_postargs=extra_args,
535 depends=ext.depends)
537 # XXX outdated variable, kept here in case third-part code
538 # needs it.
File /usr/lib/python3.10/distutils/ccompiler.py:574, in CCompiler.compile(self, sources, output_dir, macros, include_dirs, debug, extra_preargs, extra_postargs, depends)
573 continue
--> 574 self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
576 # Return *all* object filenames, not just the ones we just built.
File /usr/lib/python3.10/distutils/unixccompiler.py:120, in UnixCCompiler._compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts)
119 except DistutilsExecError as msg:
--> 120 raise CompileError(msg)
CompileError: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
During handling of the above exception, another exception occurred:
SystemExit Traceback (most recent call last)
[... skipping hidden 1 frame]
Cell In[6], line 2
1 import multiphenicsx
----> 2 import multiphenicsx.fem
File /usr/local/lib/python3.10/dist-packages/multiphenicsx/fem/__init__.py:9
6 """Tools for assembling finite element forms with restrictions."""
----> 9 import multiphenicsx.fem.petsc # import module rather than its content to be consistent with dolfinx.fem.petsc
10 from multiphenicsx.fem.dofmap_restriction import DofMapRestriction
File /usr/local/lib/python3.10/dist-packages/multiphenicsx/fem/petsc.py:21
19 import petsc4py.PETSc
---> 21 from multiphenicsx.cpp import cpp_library as mcpp
23 DolfinxConstantsType = np.typing.NDArray[petsc4py.PETSc.ScalarType]
File /usr/local/lib/python3.10/dist-packages/multiphenicsx/cpp/__init__.py:15
13 from multiphenicsx.cpp.compile_package import compile_package
---> 15 cpp_library = compile_package(
16 mpi4py.MPI.COMM_WORLD,
17 "multiphenicsx",
18 os.path.dirname(os.path.abspath(__file__)),
19 # Files are manually sorted to handle dependencies
20 "fem/DofMapRestriction.cpp",
21 "fem/sparsitybuild.cpp",
22 "fem/petsc.cpp",
23 "fem/utils.cpp",
24 "la/petsc.cpp"
25 )
File /usr/local/dolfinx-real/lib/python3.10/dist-packages/dolfinx/jit.py:56, in mpi_jit_decorator.<locals>.mpi_jit(comm, *args, **kwargs)
55 if comm.size == 1:
---> 56 return local_jit(*args, **kwargs)
58 # Default status (0 == ok, 1 == fail)
File /usr/local/lib/python3.10/dist-packages/multiphenicsx/cpp/compile_package.py:85, in compile_package(package_name, package_root, *args, **kwargs)
84 # Compile C++ module and return
---> 85 return compile_code(package_name, package_file, **kwargs)
File /usr/local/lib/python3.10/dist-packages/multiphenicsx/cpp/compile_code.py:109, in compile_code(package_name, package_file, **kwargs)
108 # Return module generated by cppimport
--> 109 return cppimport.imp(package_name_with_hash)
File /usr/local/lib/python3.10/dist-packages/cppimport/__init__.py:50, in imp(fullname, opt_in)
49 filepath = find_module_cpppath(fullname, opt_in)
---> 50 return imp_from_filepath(filepath, fullname)
File /usr/local/lib/python3.10/dist-packages/cppimport/__init__.py:87, in imp_from_filepath(filepath, fullname)
86 if is_build_needed(module_data) or not try_load(module_data):
---> 87 build_safely(filepath, module_data)
88 load_module(module_data)
File /usr/local/lib/python3.10/dist-packages/cppimport/importer.py:36, in build_safely(filepath, module_data)
35 break
---> 36 template_and_build(filepath, module_data)
37 except filelock.Timeout:
File /usr/local/lib/python3.10/dist-packages/cppimport/importer.py:62, in template_and_build(filepath, module_data)
61 run_templating(module_data)
---> 62 build_module(module_data)
63 checksum_save(module_data)
File /usr/local/lib/python3.10/dist-packages/cppimport/build_module.py:84, in build_module(module_data)
83 with contextlib.redirect_stderr(f):
---> 84 setuptools.setup(**setuptools_args)
85 logger.debug(f"Setuptools/compiler output: {f.getvalue()}")
File /usr/lib/python3/dist-packages/setuptools/__init__.py:153, in setup(**attrs)
152 _install_setup_requires(attrs)
--> 153 return distutils.core.setup(**attrs)
File /usr/lib/python3.10/distutils/core.py:163, in setup(**attrs)
162 else:
--> 163 raise SystemExit("error: " + str(msg))
165 return dist
SystemExit: error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
During handling of the above exception, another exception occurred:
AssertionError Traceback (most recent call last)
[... skipping hidden 1 frame]
File /usr/local/lib/python3.10/dist-packages/IPython/core/interactiveshell.py:2047, in InteractiveShell.showtraceback(self, exc_tuple, filename, tb_offset, exception_only, running_compiled_code)
2044 if exception_only:
2045 stb = ['An exception has occurred, use %tb to see '
2046 'the full traceback.\n']
-> 2047 stb.extend(self.InteractiveTB.get_exception_only(etype,
2048 value))
2049 else:
2050 try:
2051 # Exception classes can customise their traceback - we
2052 # use this in IPython.parallel for exceptions occurring
2053 # in the engines. This should return a list of strings.
File /usr/local/lib/python3.10/dist-packages/IPython/core/ultratb.py:585, in ListTB.get_exception_only(self, etype, value)
577 def get_exception_only(self, etype, value):
578 """Only print the exception type and message, without a traceback.
579
580 Parameters
(...)
583 value : exception value
584 """
--> 585 return ListTB.structured_traceback(self, etype, value)
File /usr/local/lib/python3.10/dist-packages/IPython/core/ultratb.py:452, in ListTB.structured_traceback(self, etype, evalue, etb, tb_offset, context)
449 chained_exc_ids.add(id(exception[1]))
450 chained_exceptions_tb_offset = 0
451 out_list = (
--> 452 self.structured_traceback(
453 etype, evalue, (etb, chained_exc_ids),
454 chained_exceptions_tb_offset, context)
455 + chained_exception_message
456 + out_list)
458 return out_list
File /usr/local/lib/python3.10/dist-packages/IPython/core/ultratb.py:1118, in AutoFormattedTB.structured_traceback(self, etype, value, tb, tb_offset, number_of_lines_of_context)
1116 else:
1117 self.tb = tb
-> 1118 return FormattedTB.structured_traceback(
1119 self, etype, value, tb, tb_offset, number_of_lines_of_context)
File /usr/local/lib/python3.10/dist-packages/IPython/core/ultratb.py:1012, in FormattedTB.structured_traceback(self, etype, value, tb, tb_offset, number_of_lines_of_context)
1009 mode = self.mode
1010 if mode in self.verbose_modes:
1011 # Verbose modes need a full traceback
-> 1012 return VerboseTB.structured_traceback(
1013 self, etype, value, tb, tb_offset, number_of_lines_of_context
1014 )
1015 elif mode == 'Minimal':
1016 return ListTB.get_exception_only(self, etype, value)
File /usr/local/lib/python3.10/dist-packages/IPython/core/ultratb.py:865, in VerboseTB.structured_traceback(self, etype, evalue, etb, tb_offset, number_of_lines_of_context)
856 def structured_traceback(
857 self,
858 etype: type,
(...)
862 number_of_lines_of_context: int = 5,
863 ):
864 """Return a nice text document describing the traceback."""
--> 865 formatted_exception = self.format_exception_as_a_whole(etype, evalue, etb, number_of_lines_of_context,
866 tb_offset)
868 colors = self.Colors # just a shorthand + quicker name lookup
869 colorsnormal = colors.Normal # used a lot
File /usr/local/lib/python3.10/dist-packages/IPython/core/ultratb.py:799, in VerboseTB.format_exception_as_a_whole(self, etype, evalue, etb, number_of_lines_of_context, tb_offset)
796 assert isinstance(tb_offset, int)
797 head = self.prepare_header(etype, self.long_header)
798 records = (
--> 799 self.get_records(etb, number_of_lines_of_context, tb_offset) if etb else []
800 )
802 frames = []
803 skipped = 0
File /usr/local/lib/python3.10/dist-packages/IPython/core/ultratb.py:854, in VerboseTB.get_records(self, etb, number_of_lines_of_context, tb_offset)
848 formatter = None
849 options = stack_data.Options(
850 before=before,
851 after=after,
852 pygments_formatter=formatter,
853 )
--> 854 return list(stack_data.FrameInfo.stack_data(etb, options=options))[tb_offset:]
File /usr/local/lib/python3.10/dist-packages/stack_data/core.py:578, in FrameInfo.stack_data(cls, frame_or_tb, options, collapse_repeated_frames)
562 @classmethod
563 def stack_data(
564 cls,
(...)
568 collapse_repeated_frames: bool = True
569 ) -> Iterator[Union['FrameInfo', RepeatedFrames]]:
570 """
571 An iterator of FrameInfo and RepeatedFrames objects representing
572 a full traceback or stack. Similar consecutive frames are collapsed into RepeatedFrames
(...)
576 and optionally an Options object to configure.
577 """
--> 578 stack = list(iter_stack(frame_or_tb))
580 # Reverse the stack from a frame so that it's in the same order
581 # as the order from a traceback, which is the order of a printed
582 # traceback when read top to bottom (most recent call last)
583 if is_frame(frame_or_tb):
File /usr/local/lib/python3.10/dist-packages/stack_data/utils.py:97, in iter_stack(frame_or_tb)
95 while frame_or_tb:
96 yield frame_or_tb
---> 97 if is_frame(frame_or_tb):
98 frame_or_tb = frame_or_tb.f_back
99 else:
File /usr/local/lib/python3.10/dist-packages/stack_data/utils.py:90, in is_frame(frame_or_tb)
89 def is_frame(frame_or_tb: Union[FrameType, TracebackType]) -> bool:
---> 90 assert_(isinstance(frame_or_tb, (types.FrameType, types.TracebackType)))
91 return isinstance(frame_or_tb, (types.FrameType,))
File /usr/local/lib/python3.10/dist-packages/stack_data/utils.py:176, in assert_(condition, error)
174 if isinstance(error, str):
175 error = AssertionError(error)
--> 176 raise error
AssertionError:
To summarize, it seems that an error occurred at :
File /usr/lib/python3/dist-packages/setuptools/__init__.py:153, in setup(**attrs)
152 _install_setup_requires(attrs)
--> 153 return distutils.core.setup(**attrs)
File /usr/lib/python3.10/distutils/core.py:163, in setup(**attrs)
162 else:
--> 163 raise SystemExit("error: " + str(msg))
165 return dist
SystemExit: error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
I searched for the error above and many suggested using
sudo apt-get install python3-dev
So, I tried this before initiating docker environment but nothing changed. Should I try something inside the docker environment?
Thanks for reading.