l install fenics on ubuntu 22.04, I get the version 2019.2 but I want 2019.1. How can I change the version ?
You could recompile from source, but it is not going to be fun because you would need to be extra sure that you have versions dated 2019 of all dependencies in a system that ships packages from the year 2022+.
For instance, the following patches have been introduced after 2019 to ensure compatibility with newer versions of the dependecies:
- you would need an ancient gcc, because gcc 13 requires Bitbucket which is post 2019.1.0
- you would need a 2019 version of boost, because newer ones requires Bitbucket which is post 2019.1.0
Considering that the dolfin version currently on ubuntu is backward compatible with 2019.1.0 (at least, to the best of my knowledge) I canât think of a reason why anyone would want to do all of that work to downgrade. Please elaborate on why you need that.
Thanks for your help.
I want to use cashocs is a software for solving PDE constrained optimization problems in the fields of shape optimization and optimal control.
Than l need to have fenics 2019.1.
https://cashocs.readthedocs.io/en/stable/about/installation/#installation-instructions
I install cashocs with fenics 2019.2⊠I have a problem
I install cashocs with fenics 2019.2⊠I have a problem
It would have been helpful to post which problem.
Regardless, you can use conda, as they do to in
Your installation seems wrong to me.
From your opening message I guessed you had installed FEniCS from apt. Yet, ufl is getting loaded from $HOME/.local/lib.
If you did install FEniCS from apt, you must not have any other FEniCS libraries in $HOME/.local/lib.
I check and yes I have tow : dolfin: /usr/include/dolfin /usr/share/dolfin
How can I solve this problem ?
Something like
cd $HOME/.local/lib/python3.10/site-packages
rm -rI *ufl*
This will remove every component of ufl
from $HOME/.local
. The capital i in the rm
command will ask you for confirmation before removal.
While you are in that folder, you may want to double check that there are no other fenics-*
packages.
I do this but it is still say that I have two fenics than I auto-remove fenics and I will install know
I check and yes I have tow : dolfin: /usr/include/dolfin /usr/share/dolfin
Those are not two separate installs, they are part of the same installation.
I still have the same problem
It canât be exactly the same, if you have removed the ufl
package as instructed.
Messages like
I still have the same problem
arenât very helpful. It would have been more helpful to copy the error message from the terminal, and paste it here within triple backquotes (```) to have the error nicely formatted as
in this box
Prefer that over posting a screenshot.
ModuleNotFoundError: No module named âuflâ
How did you actually install FEniCS?
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:fenics-packages/fenics
sudo apt-get update
sudo apt-get install fenics
Can you post the output of
apt list --installed | grep fenics
apt list --installed | grep ufl
?
I suspect that the latter is something like
python-ufl-legacy-doc/jammy,now 1:2022.3.0-2~ppa1~jammy1 all [installed,automatic]
python3-ufl-legacy/jammy,now 1:2022.3.0-2~ppa1~jammy1 all [installed,automatic]
If that is the case, then the issue is related to
Try the following
cd $HOME/.local/lib.python3.10/site-packages/cashocs
find ./ -type f -exec sed -i 's|import ufl|import ufl_legacy|g' {} \;
find ./ -type f -exec sed -i 's|ufl.Form|ufl_legacy.Form|g' {} \;
find ./ -type f -exec sed -i 's|ufl.core|ufl_legacy.core|g' {} \;
find ./ -type f -exec sed -i 's|ufl.form.Form|ufl_legacy.form.Form|g' {} \;
find ./ -type f -exec sed -i 's|ufl.replace|ufl_legacy.replace|g' {} \;
find ./ -type f -exec sed -i 's|ufl.Measure|ufl_legacy.Measure|g' {} \;
find ./ -type f -exec sed -i 's|ufl.algorithms|ufl_legacy.algorithms|g' {} \;
find ./ -type f -exec sed -i 's|ufl.log|ufl_legacy.log|g' {} \;
find ./ -type f -exec sed -i 's|ufl.Jacobian|ufl_legacy.Jacobian|g' {} \;
where I am trying to replace every instance of ufl
in the code with ufl_legacy
.
With these changes, I was able to run the demo you are intersted in.
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
fenics/jammy,now 2:0.7.0.2~ppa1~jammy1 amd64 [installé]
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
python-ufl-legacy-doc/jammy,jammy,now 1:2022.3.0-2~ppa1~jammy1 all [installé, automatique]
python3-ufl-legacy/jammy,jammy,now 1:2022.3.0-2~ppa1~jammy1 all [installé, automatique]
OK, then you may proceed as in the second part of the above message.
(The code below âTry the followingâ, I mean)
Reported upstream as a feature request at [Feature Request] Consider supporting FEniCS > 2019.1.0 · Issue #358 · sblauth/cashocs · GitHub
Thanks, youâve solved my problem