Does Fenicsx installation require a brand new Ubuntu installation?

Following installation instructions for Ubuntu in an almost brand new Ubuntu 24.04 installation on WSL2, I got:

sudo apt install fenicsx
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 python3-dolfinx : Depends: python3-dolfinx-real but it is not installable or
                            python3-dolfinx-complex but it is not installable
E: Unable to correct problems, you have held broken packages.

The only thing I did after Ubuntu installation and before Fenicsx installation was to install pip and pyvista, a Python module required to run the very first demo of the tutorial, with

pip install pyvista --break-system-packages

Might installing pyvista after Fenicsx installation solve the issue ot the problem is due to --break-system-packages option?

Looks like you’re caught in the middle of the upgrade to 0.9. Try again later after the archive is finished updating.

In general pip install is safe for pyvista since it’s pure python, no C libraries. But to avoid interference with the deb packages, run it with --no-deps.

@nopria We are upgrading FEniCSx to 0.9, you have just been unlucky to be caught in the middle. I’ll let you know when we are finished.

For questions about pyvista installation please do as you were told yesterday.

@nopria PPA upgrade has finished. Please do a sudo apt update and then try again with the installation command you already used.

Thanks, Fenicsx installs now, but Python complains about multiple versions of matplotlib:

Python 3.12.3 (main, Sep 11 2024, 14:17:37) [GCC 13.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyvista
/home/nopria/.local/lib/python3.12/site-packages/matplotlib/projections/__init__.py:63: UserWarning: Unable to import Axes3D. This may be due to multiple versions of Matplotlib being installed (e.g. as a system package and as a pip package). As a result, the 3D projection is not available.
  warnings.warn("Unable to import Axes3D. This may be due to multiple versions of "

This is the problem I mentioned above with pip install. You need to run it with --no-deps to avoid this problem.

Uninstall all the packages you installed with pip
(or delete /home/nopria/.local/lib/python3.12/)

Ok, I successfully installed pip and Fenicsx from stracth on a brand new Ubuntu 24.04 WSL installation, and then installed pyvista with

pip install pyvista --no-deps --break-system-packages

but in Python REPL I got:

Python 3.12.3 (main, Sep 11 2024, 14:17:37) [GCC 13.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyvista
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/nopria/.local/lib/python3.12/site-packages/pyvista/__init__.py", line 14, in <module>
    from pyvista.core import *
  File "/home/nopria/.local/lib/python3.12/site-packages/pyvista/core/__init__.py", line 6, in <module>
    from . import _vtk_core
  File "/home/nopria/.local/lib/python3.12/site-packages/pyvista/core/_vtk_core.py", line 20, in <module>
    from vtkmodules.vtkCommonCore import vtkVersion
ModuleNotFoundError: No module named 'vtkmodules'

apt install python3-vtk9

In addition to

apt install python3-vtk9

also

sudo apt install python3-scooby

is needed.

As a recap for future visitors, in order to install Fenicsx with pyvista in a brand new Ubuntu installation I run the following instructions:

sudo apt install python3-pip
sudo add-apt-repository ppa:fenics-packages/fenics
sudo apt update
sudo apt install fenicsx
pip install pyvista --no-deps --break-system-packages
sudo apt install python3-vtk9
sudo apt install python3-scooby

Now I can import pyvista as required by the very first Fenicsx tutorial demo.

Glad it’s working. In the future we’ll make pyvista available from the PPA, so the process will become simpler (not needing pip) after that.

1 Like

pyvista is now available for ubuntu from the PPA. If you’ve been using pip to install it, consider now uninstalling the local pip version and use the deb package instead

pip uninstall pyvista
apt install python3-pyvista

Thanks @francesco-ballarin for preparing the deb packaging for pyvista.

1 Like