Fenics Installation problem using source

You need to do

. /home/fenics/spack/share/spack/setup-env.sh

so that you can use spack to load the py-fenics-dolfinx python module.
Running this command sets your current terminal to use spack. If you close it and open a new one, you need to run this command again.
If it’s too annoying you can define an alias in your .bashrc, e.g.

alias load-spack=". /home/fenics/spack/share/spack/setup-env.sh"

and then simply use load-spack when you need to use fenics.

1 Like

Without using the alias for the time being, I am using these command to run the demo_poisson.py and below are the outputs:

fenics@DESKTOP-CVH2BNB:~$ . /home/fenics/spack/share/spack/setup-env.sh

fenics@DESKTOP-CVH2BNB:~$ spack load py-fenics-dolfinx

fenics@DESKTOP-CVH2BNB:~$ python3 demo_poisson.py
WARNING:py.warnings:/home/fenics/spack/opt/spack/linux-ubuntu20.04-skylake/gcc-9.4.0/python-3.9.13-pcu4sw73ldnrq56zpsmhzdotodg5rh6i/lib/python3.9/site-packages/pyvista/plotting/plotting.py:115: UserWarning:
This system does not appear to be running an xserver.
PyVista will likely segfault when rendering.

Try starting a virtual frame buffer with xvfb, or using
pyvista.start_xvfb()

warnings.warn(

[0]PETSC ERROR: ------------------------------------------------------------------------
[0]PETSC ERROR: Caught signal number 11 SEGV: Segmentation Violation, probably memory access out of range
[0]PETSC ERROR: Try option -start_in_debugger or -on_error_attach_debugger
[0]PETSC ERROR: or see Frequently Asked Questions (FAQ) — PETSc 3.17.2 documentation
[0]PETSC ERROR: or try http://valgrind.org on GNU/linux and Apple MacOS to find memory corruption errors
[0]PETSC ERROR: configure using --with-debugging=yes, recompile, link, and run
[0]PETSC ERROR: to get more information on the crash.
[0]PETSC ERROR: Run with -malloc_debug to check if memory corruption is causing the crash.

MPI_ABORT was invoked on rank 0 in communicator MPI_COMM_WORLD
with errorcode 59.

NOTE: invoking MPI_ABORT causes Open MPI to kill all MPI processes.
You may or may not see output from other processes, depending on
exactly when Open MPI kills them.

Now, what to do? My recent goal is to run and visualize the demo_poisson.py testcase successfully.

Now dolfinx is running fine. The error you are seeing is because you are using WSL, and by default WSL has no way of displaying anything on your screen (except for the terminal). What you need to do is install a X server on windows (not WSL) and configure your linux session inside WSL to be aware of that X server. You can do that by following the instructions I gave on this post.

As for the MPI error, maybe it’s related to the display error, but I’m not sure. Try fixing the display error first.

You can also comment out the pyvista plotting, and use Paraview to inspect the output file (out_poisson/poisson.xdmf)

1 Like

I have commented out the pyvista portion of plotting in the code. The code has run successfully without any error. It has generated poisson.xdmf file as below:

fenics@DESKTOP-CVH2BNB:~/out_poisson$ ls
poisson.h5 poisson.xdmf

Now, can you please guide me to how to plot it in Paraview? I have installed paraview in my system also.

See for instance: Using Paraview for visualization — FEniCSx tutorial

I have opened poisson.xdmf in paraview (scrrenshot attached with this mail: poisson_xdmf_in_paraview.jpg). But I am unable to select Filters->Alphabetic->ExtractBlock. (screenshot attached with this mail: Extract_block.jpg).

I have installed paraview in windows with .exe file and I have copied poisson.xdmf from wsl ubuntu to windows mnt/c/Users/Anirban/Downloads folder and then opened with paraview.


You need to press the green “Apply button” on the left side of your screen.
For this particular problem, you should not need to extract a block (as there is only one solution in the file)

At the instant, I am pressing the “Apply button”, the GUI of paraview is loading and it is getting closed. Is that the problem with paraview installation?

I install paraview passing this command:

fenics@DESKTOP-CVH2BNB:~$ sudo apt install paraview
[sudo] password for fenics:
Reading package lists… Done
Building dependency tree
Reading state information… Done
paraview is already the newest version (5.7.0-4ubuntu9).
0 upgraded, 0 newly installed, 0 to remove and 60 not upgraded.

When I use:

fenics@DESKTOP-CVH2BNB:~$ paraview
qt.qpa.xcb: could not connect to display
qt.qpa.plugin: Could not load the Qt platform plugin “xcb” in “” even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, xcb.

Aborted

I am trying to install VcXsrv Windows X Server from this link: VcXsrv Windows X Server download | SourceForge.net. I am unable to download the full size file as the download gets freezed in between every time and I have tried this in different systems, but I have failed to download the file.
If you have the .exe file, can you share it with me?, or can you tell me how to install it from source code. I have cloned the source code of VcXsrv by git clone.

You can try with this link

1 Like

I am following this post Installing Fenics on Windows - #26 by Calva (link given by you in this message thread). I have installed the vcxsrv .exe file given by you in my windows system. I have edited my bashrc file. Still it is showing some error:

fenics@DESKTOP-CVH2BNB:~$ python3 demo_poisson.py
WARNING:py.warnings:/home/fenics/spack/opt/spack/linux-ubuntu20.04-skylake/gcc-9.4.0/python-3.9.13-pcu4sw73ldnrq56zpsmhzdotodg5rh6i/lib/python3.9/site-packages/pyvista/plotting/plotting.py:115: UserWarning:
This system does not appear to be running an xserver.
PyVista will likely segfault when rendering.

Try starting a virtual frame buffer with xvfb, or using
pyvista.start_xvfb()

warnings.warn(

[0]PETSC ERROR: ------------------------------------------------------------------------
[0]PETSC ERROR: Caught signal number 11 SEGV: Segmentation Violation, probably memory access out of range
[0]PETSC ERROR: Try option -start_in_debugger or -on_error_attach_debugger
[0]PETSC ERROR: or see Frequently Asked Questions (FAQ) — PETSc 3.17.2 documentation
[0]PETSC ERROR: or try http://valgrind.org on GNU/linux and Apple MacOS to find memory corruption errors
[0]PETSC ERROR: configure using --with-debugging=yes, recompile, link, and run
[0]PETSC ERROR: to get more information on the crash.
[0]PETSC ERROR: Run with -malloc_debug to check if memory corruption is causing the crash.

MPI_ABORT was invoked on rank 0 in communicator MPI_COMM_WORLD
with errorcode 59.

NOTE: invoking MPI_ABORT causes Open MPI to kill all MPI processes.
You may or may not see output from other processes, depending on
exactly when Open MPI kills them.

I am unable to do the step:
*Check the ‘disable access control’ checkbox in the VcXsrv config.
Can you please tell me how to do that?

What were you unable to do? When you start VcXsrv, a prompt will show up for configuration. At some point a check box named ‘disable access control’ will appear. Just check this one and leave the rest as default.

I am attaching the pop-ups (in .jpg format) appearing in my GUI after installing VcXsrv with this thread.

After that, when I run

fenics@DESKTOP-CVH2BNB:~/fenics_test_cases$ python3 demo_poisson.py

still the same output (Fenics Installation problem using source - #33 by Anirban_Mondal) exists with error.
vcxsrv_step_1
vcxsrv_step_2
vcxsrv_step_3
vcxsrv_step_4

If I run the demo_poissson.py without the pyvista plotting part, the code gets executed and I can plot with paraview the outout generated .xdmf file. (ref: Fenics Installation problem using source - #25 by dokken)
But, I am unable to execute the code with pyvista. Please help!

Did you make sure to “reload” your shell after editing the .bashrc file (e.g. running bash again so that the new command in the bashrc is actually executed)?
Appart from that, can you try to launch another GUI application inside ubuntu to see if the X server is working or not. E.g. install geditwith apt and launch it to see if an error appears or not.
Finally, can you show the output of the following command: echo $DISPLAY.

  1. After reloading .bashrc file there is no change in the output. Should I edit .bashrc file after installing VcXsrv by entering new commands?

  2. After installing gedit with $ sudo apt install gedit and launching it, the following output comes:

(base) fenics@DESKTOP-CVH2BNB:~$ gedit

Unable to init server: Could not connect: Connection refused
(gedit:1672): Gtk-WARNING **: 22:48:14.269: cannot open display

  1. output of $ echo $DISPLAY shows nothing:

(base) fenics@DESKTOP-CVH2BNB:~$ echo $DISPLAY

(base) fenics@DESKTOP-CVH2BNB:~$

N.B. : VcXsrv is running in background.

Okay so the command did not set the DISPLAY variable correctly.
Can you show the output of

cat /etc/resolv.conf

?

fenics@DESKTOP-CVH2BNB:~$ cat /etc/resolv.conf

This file was automatically generated by WSL. To stop automatic generation of this file, add the following entry to /etc/wsl.conf:

[network]

generateResolvConf = false

nameserver 172.25.240.1

Great, now you need to set the DISPLAY variable manually since for some reason the command I gave you did not work. Try the following:

export DISPLAY=172.25.240.1:0

then

gedit

And see if it works. If it does, you can add the first command to .bashrc, reload the shell and you’re good to go.

2 Likes