OK I am going to go ahead and make a fool of myself by asking this very trivial question, hopefully you guys would forgive me
I installed FEniCS by running the following commands on my Ubuntu 20.04 Focal Fossa:
The above commands come from this page.
I checked my installation and it works fine, I also ran the ft01_poisson.py found on this page and again it works very fine.
Eventually I bumped up on this page which seems to address a whole new version of things.
For instance I tried to run the demo_poisson.py and this time I got an error saying that module dolfinx doesn't exist.
Could somebody help me out here, what am I missing?
Here are the questions that may help you understand my confusion:
Is the process of installing FEniCSx different from the installation commands I pointed out above?
Should dolfinx be installed separately or it comes with FEniCSx installation?
The tutorial on this page claims to be an adaptation of this Tutorial but the scripts are quite different. Should I just forget this and move along with this?
Hi Sou-Ren, it’s not a dumb question. You’ve installed fenics, which is the legacy version of FEniCS. It provides dolfin, not dolfinx. What you want (if you want dolfinx, not dolfin), is the fenicsx package.
Thank you dparsons,
I just ran sudo apt install fenicsx then python3 -c "import dolfinx" (given here) and I didn’t get any error message which I believe means the installation is fine. Which I suppose means I don’t need to go through the whole docker installation of dolfinx as explained here right?
Apart from above question when I run python3 demo_poisson.py (given here) it complains as follows
Traceback (most recent call last):
File "demo_poisson.py", line 84, in <module>
from dolfinx.mesh import CellType, GhostMode, locate_entities_boundary
ImportError: cannot import name 'CellType' from 'dolfinx.mesh' (/usr/lib/petsc/lib/python3/dist-packages/dolfinx/mesh.py)
docker is an alternative means for getting access to the package, maintained inside a container (a virtual machine). You might use it if you don’t have sudo access to install ubuntu packages. If you have sudo access, then you don’t need docker, since you already have the package installed.
dolfinx (fenicsx) is the new version of the package. It’s been developed rapidly over the past year and is still in development. That’s why the lastest release is v0.3 not v1.0 (check that you do have 0.3.0 installed). Your error message probably means the demo doesn’t match the installed version. Likely it got updated for the latest development version and has already lost compatibility with 0.3.0. Try dolfinx/python/demo/poisson at v0.3.0 · FEniCS/dolfinx · GitHub
Thanks again dparsons
It suns smoothly
Just another quick question though.
Before going through all modifications you suggested I had FEniCS installed using the following commands
and to get fenicsx and dolfinx I simply ran sudo apt install fenicsx meaning I only changed the last line of the above command and I got dolfinx. But what about the second line where we have ppa:fenics-packages/fenics I didn’t change fenics to fenicsx in this line and it seems not having any impact.
Why is that? any idea?
The PPA is the FEniCS repository for ubuntu packages for the latest release. It’s packages that we (I) prepare ourselves, since the official ubuntu packages don’t get updated and will be stuck at the version available at the time of the ubuntu release. The PPA address is https://launchpad.net/~fenics-packages/+archive/ubuntu/fenics, it provides both the old dolfin and new dolfinx versions.
You can compare the ubuntu versions available to you with apt-cache show fenics fenicsx, you’ll see older versions listed there (the official ubuntu packages).
@dparsons
Ah, I did not know that.
Actually I have created an environment by conda and then installed brew in the same directory.
Then I tried to install all requirements (Boost, cmake, xtensor , …) on that environment by brew and conda both. Is it possible that i install fenicsx by docker on that environment?
Or I need to create a new environment by docker and install all requirements by docker and brew?
The use of ! suggests you’re working on Google’s Colab, not ubuntu directly. Colab is broken, Google has not been willing to fix it. You can find a workaround at https://fem-on-colab.github.io/