precice / fenics-adapter

preCICE-adapter for the open source computing platform FEniCS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Installation issues for fenics version (2:0.4.1.2)

davidscn opened this issue · comments

I followed the installation instructions while trying to install fenicsprecice and faced the following issue

pip3 install --user fenicsprecice
Collecting fenicsprecice
  Using cached fenicsprecice-1.3.0.tar.gz (37 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [24 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-0gyp_j_i/fenicsprecice_91477d1d26174fb8919a99fd2ed81df1/setup.py", line 18, in <module>
          from fenics import *
        File "/usr/lib/python3/dist-packages/fenics/__init__.py", line 7, in <module>
          from dolfin import *
        File "/usr/lib/petsc/lib/python3/dist-packages/dolfin/__init__.py", line 138, in <module>
          from . import parameter
        File "/usr/lib/petsc/lib/python3/dist-packages/dolfin/parameter/__init__.py", line 11, in <module>
          from ffc import default_jit_parameters
        File "~/.local/lib/python3.10/site-packages/ffc/__init__.py", line 24, in <module>
          from ffc.compiler import compile_form, compile_element
        File "~/.local/lib/python3.10/site-packages/ffc/compiler.py", line 129, in <module>
          from ffc.codegeneration import generate_code
        File "~/.local/lib/python3.10/site-packages/ffc/codegeneration.py", line 37, in <module>
          import ffc.uflacs.language.cnodes as L
        File "~/.local/lib/python3.10/site-packages/ffc/uflacs/__init__.py", line 23, in <module>
          from ffc.uflacs.uflacsrepresentation import compute_integral_ir
        File "~/.local/lib/python3.10/site-packages/ffc/uflacs/uflacsrepresentation.py", line 26, in <module>
          from ffc.representationutils import initialize_integral_ir
        File "~/.local/lib/python3.10/site-packages/ffc/representationutils.py", line 28, in <module>
          from ufl.cell import cellname2facetname
      ImportError: cannot import name 'cellname2facetname' from 'ufl.cell' (/usr/lib/python3/dist-packages/ufl/cell.py)
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

I'm using Ubuntu 22.04 and the provided fenics version version (2:0.4.1.2~ppa1~jammy1).

Given a clean jammy container

docker run --rm -it ubuntu:jammy

The following commands succeeded:

apt update
apt-get install software-properties-common
add-apt-repository ppa:fenics-packages/fenics
apt-get update
apt-get install fenics

apt install wget
wget https://github.com/precice/precice/releases/download/v2.5.0/libprecice2_2.5.0_jammy.deb
apt install ./libprecice2_2.5.0_jammy.deb

apt install git pip
git clone https://github.com/precice/fenics-adapter.git
cd fenics-adapter
pip install .
python3 -c "import fenicsprecice"
cd ..

git clone --depth=1 https://github.com/precice/tutorials.git
cd tutorials/partitioned-heat-conduction/fenics
./run.sh -d & ./run.sh -n

I also tried out the commands stated above by @fsimonis in a clean Ubuntu 22.04 container and the adapter seems to work. The adapter also works if fenicsprecice is installed directly via pip.

I (unintentionally) reproduced the problem on my Ubuntu 20.04 system. After a lot of very messy back and forth I think I got things working now. The solution is similar to the suggestion in this post. There might be some residuals of ffc in /home/username/.local/lib/python3.8/site-packages. Removing them via rm -r ufl ffc should do the trick.

💥 💀 💥
If you want to bring yourself into trouble: Run $ pip3 install --user fenics_ffc==2019.1.0.post0. This should reproduce the error above.
💥 💀 💥

If the pip packages are such a nightmare, couldn't we define conflicts in the setup.py of the fenics adapter?

Would be great to improve the situation with technical means, but I don't have the time to work on this at the moment. But I will reopen this issue and attach the help wanted label.