Install fenicsx on ubuntu20.04

I use the follow commands to install fenicsx as recommanded and it finally successed:

add-apt-repository ppa:fenics-packages/fenics

apt update

apt install fenicsx

sudo apt install python3-dolfinx
python3-dolfinx is already the newest version(1:0.4.1-1exp2-ppa2-focal1)

but I can‘t import it in python,I can’t find it by pip list.
What should I do to cope with it ?

Could you the input and output of the command that you are running to import in python here?

I use import dolfinx,and I get no module named 'dolfinx'

And here are the output of the command sudo apt install fenicsx:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
fenicsx is already the newest version (2:0.4.1.2~ppa1~focal1).
The following packages were automatically installed and are no longer required:
  caribou cython3 five-or-more folks-common four-in-a-row fprintd gdal-data gir1.2-caribou-1.0 gir1.2-champlain-0.12 gir1.2-clutter-1.0 gir1.2-cogl-1.0 gir1.2-coglpango-1.0 gir1.2-dazzle-1.0
  gir1.2-gdata-0.0 gir1.2-gfbgraph-0.2 gir1.2-grilo-0.3 gir1.2-gtkchamplain-0.12 gir1.2-gtkclutter-1.0 gir1.2-handy-0.0 gir1.2-mediaart-2.0 gir1.2-rest-0.7 gir1.2-tracker-2.0 gir1.2-zpj-0.0
  gnome-calculator gnome-characters gnome-chess gnome-clocks gnome-color-manager gnome-contacts gnome-documents gnome-games gnome-klotski gnome-logs gnome-maps gnome-music gnome-nibbles
  gnome-online-miners gnome-robots gnome-shell-extension-prefs gnome-shell-extensions gnome-sound-recorder gnome-system-monitor gnome-taquin gnome-tetravex gnome-tweaks gnome-weather hitori hoichess
  iagno libarmadillo9 libatkmm-1.6-1v5 libavahi-gobject0 libavahi-ui-gtk3-0 libcacard0 libcairomm-1.0-1v5 libcaribou-common libcaribou0 libcdio17 libcfitsio8 libcharls2 libdap25 libdapclient6v5
  libenchant1c2a libepsilon1 libfolks-eds25 libfolks25 libfprint-2-2 libfreerdp2-2 libfreexl1 libfyba0 libgdal26 libgeos-3.8.0 libgeos-c1v5 libgeotiff5 libgfbgraph-0.2-0 libglew2.1 libglibmm-2.4-1v5
  libgsf-bin libgspell-1-1 libgtk-vnc-2.0-0 libgtkmm-3.0-1v5 libgvnc-1.0-0 libhdf4-0-alt libhdf5-103 libhdf5-cpp-103 libkmlbase1 libkmldom1 libkmlengine1 liblaszip8 libmanette-0.2-0 libminizip1
  libmysqlclient21 libnetcdf15 libnss-myhostname libogdi4.1 libpam-fprintd libpangomm-1.4-1v5 libpdal-base9 libpdal-plugin-faux libpdal-plugin-icebridge libpdal-plugin-pgpointcloud
  libpdal-plugin-python libpdal-plugin-sqlite libpdal-plugins libpdal-util9 libphodav-2.0-0 libphodav-2.0-common libpq5 libproj15 libproxy1-plugin-webkit libqhull7 libqt5help5 libqt5sql5
  libqt5sql5-sqlite libqt5x11extras5 libspatialite7 libspice-client-glib-2.0-8 libspice-client-gtk-3.0-5 libsqlite3-mod-spatialite liburiparser1 libusbredirhost1 libusbredirparser1 libwinpr2-2
  libxerces-c3.2 libzapojit-0.0-0 lightsoff odbcinst odbcinst1debian2 paraview-doc proj-bin proj-data python-talloc python3-attr python3-autobahn python3-automat python3-cbor python3-constantly
  python3-hamcrest python3-hyperlink python3-incremental python3-lz4 python3-png python3-pyasn1 python3-pyasn1-modules python3-pyqrcode python3-service-identity python3-snappy python3-trie
  python3-twisted python3-twisted-bin python3-txaio python3-u-msgpack python3-ubjson python3-wsaccel python3-zope.interface quadrapassel spice-client-glib-usb-acl-helper swell-foop tali
  ubuntu-system-service unoconv vinagre
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 70 not upgraded.

My guess is there’s some interference via pip, or perhaps you’re trying to not use the default python3 provided by Ubuntu (which is python3.8). The dolfinx package only builds for the default python3 and PETSc (petsc 3.12 on Ubuntu 20.04 focal).

Check your python version with python3 --version. Check that PETSC_DIR is not set (in order to use the default petsc from /usr/lib/petsc).

Confirm your dolfinx installation:

dpkg -l *dolfinx* | cat

Confirm the module is in fact in place

ls -l /usr/lib/python3/dist-packages/dolfinx.pth /usr/lib/petscdir/petsc3.12/x86_64-linux-gnu-real/lib/python3/dist-packages/dolfinx/

If you find it’s missing, make sure that python3-dolfinx-real is installed as well as python3-dolfinx.

1 Like

The output of dpkg -l *dolfinx* | cat and ls -l /usr/lib/python3/dist-packages/dolfinx.pth /usr/lib/petscdir/petsc3.12/x86_64-linux-gnu-real/lib/python3/dist-packages/dolfinx/ looks like fine.And I found the version of python is 3.9 .Should I reinstall it as 3.8 ?

Yes, you need use the default version of python3 (i.e. python3.8) to access the dolfinx packages built for ubuntu. You’ll want to work out why your python3 is pointing at python3.9 instead of python3.8.

1 Like

Thank you very much:)