FEnicS Adapter Installation

Hello Everyone

i am trying to install FEniCS adapter and i have several problems trying to install it; let’s start with the first problem, when i run pip3 uninstall -y fenics-ufl, i get a permission error like this

Uninstalling fenics-ufl-2019.1.0:
ERROR: Exception:
Traceback (most recent call last):
  File "/usr/lib/python3.6/shutil.py", line 550, in move
    os.rename(src, real_dst)
PermissionError: [Errno 13] Permission denied: '/usr/local/lib/python3.6/dist-packages/fenics_ufl-2019.1.0.dist-info/' -> '/tmp/pip-uninstall-704m9jfp'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/hisham/.local/lib/python3.6/site-packages/pip/_internal/cli/base_command.py", line 180, in _main
    status = self.run(options, args)
  File "/home/hisham/.local/lib/python3.6/site-packages/pip/_internal/commands/uninstall.py", line 86, in run
    auto_confirm=options.yes, verbose=self.verbosity > 0,
  File "/home/hisham/.local/lib/python3.6/site-packages/pip/_internal/req/req_install.py", line 658, in uninstall
    uninstalled_pathset.remove(auto_confirm, verbose)
  File "/home/hisham/.local/lib/python3.6/site-packages/pip/_internal/req/req_uninstall.py", line 386, in remove
  File "/home/hisham/.local/lib/python3.6/site-packages/pip/_internal/req/req_uninstall.py", line 275, in stash
    renames(path, new_path)
  File "/home/hisham/.local/lib/python3.6/site-packages/pip/_internal/utils/misc.py", line 324, in renames
    shutil.move(old, new)
  File "/usr/lib/python3.6/shutil.py", line 562, in move
  File "/usr/lib/python3.6/shutil.py", line 486, in rmtree
    _rmtree_safe_fd(fd, path, onerror)
  File "/usr/lib/python3.6/shutil.py", line 444, in _rmtree_safe_fd
    onerror(os.unlink, fullname, sys.exc_info())
  File "/usr/lib/python3.6/shutil.py", line 442, in _rmtree_safe_fd
    os.unlink(name, dir_fd=topfd)
PermissionError: [Errno 13] Permission denied: 'REQUESTED'```, it only works if i used sudo with it

Can you please describe all the steps you did concerning installing FEniCS and the FEniCS-Adapter?

*cloned python binding
python3 setup.py install --user
*check if bindings are installed by running pip3 list, and found pyprecice in the list
*install fenics by running

sudo add-apt-repository ppa:fenics-packages/fenics
sudo apt-get update
sudo apt-get install fenics```
 from https://fenicsproject.org/download/ under section install on Ubuntu
* clone adapter repository , inside it i run pip3 install --user ., it builds normally
* then trying to import 
```python3 -c "import fenicsprecice"```
From here starts the problems, first it gave me an error
 ```ImportError: cannot import name 'sub_forms_by_domain'```
fixed it by running ```pip3 uninstall -y fenics-ufl```
then try to run the tests, it gave me
```est_version (tests.integration.test_fenicsprecice.TestAdapter) ... /usr/lib/python3.6/importlib/_bootstrap.py:219: RuntimeWarning: numpy.ufunc size changed, may indicate binary incompatibility. Expected 192 from C header, got 216 from PyObject
return f(args, **kwds)
/usr/lib/python3.6/importlib/_bootstrap.py:219: RuntimeWarning: numpy.ufunc size changed, may indicate binary incompatibility. Expected 192 from C header, got 216 from PyObject
return f(args, **kwds)
test_checkpoint_mechanism (tests.integration.test_fenicsprecice.TestCheckpointing) ... ERROR
test_update_expression_scalar (tests.integration.test_fenicsprecice.TestExpressionHandling) ... ERROR
test_update_expression_vector (tests.integration.test_fenicsprecice.TestExpressionHandling) ... ERROR
test_scalar_read (tests.integration.test_write_read.TestWriteandReadData) ... ERROR
test_scalar_write (tests.integration.test_write_read.TestWriteandReadData) ... ERROR
test_vector_read (tests.integration.test_write_read.TestWriteandReadData) ... ERROR
test_vector_write (tests.integration.test_write_read.TestWriteandReadData) ... ERROR
test_convert_fenics_to_precice (tests.unit.test_adapter_core.TestAdapterCore) ... ERROR

test_get_coupling_boundary_edges (tests.unit.test_adapter_core.TestAdapterCore) ... ok```
tried to fixed it by downgrading numpy as i googled, started to give me the error of 
```ModuleNotFoundError: No module named 'ufl'```.
* i uninstalled everything and did the same steps, currently when i keep fenics-ufl installed it gives me 
```ImportError: cannot import name 'sub_forms_by_domain'``` and when i uninstall it, it gives me 
```ModuleNotFoundError: No module named 'ufl'```. In addition when i try to run ```pip3 uninstall -y fenics-ufl``` it gives me permission error as you see in the post


Could you try to “start from scratch” by removing the binding, then reinstalling FEniCS and then reinstalling the FEniCS adapter again?

So basically

  1. Uninstall the adapter pip3 uninstall -y fenicsprecice.
  2. Reinstall FEniCS by running
    • sudo apt-get install --reinstall fenics
  3. Check that FEniCS is working again by running python3 -c "import dolfin; print(dolfin.__version__)". You might have to open a new terminal for that.
  4. If FEniCS still does not work try to reinstall it again making sure to remove FEniCS’ dependencies
    sudo apt-get remove fenics
    sudo apt-get autoremove 
    sudo apt-get install fenics
  5. Check that FEniCS works again as explained in 3.
  6. Open a new terminal and reinstall the fenicsadapter.
  7. Test the fenicsadapter the way you did before.

Please monitor the output of the procedure and provide it to us in case it fails again so we have better chances at debugging what is going wrong.

Edit: You could also try if your preCICE-Python bindings work correctly.



i did the same steps you said and the problem still exist, i made a video of my installation process, it is in the link, try to download it and see it because, it is with bad quality online. until the import step everything works fine, but trying to clone adapter repository and run tests, everything crashes.

thanks for your help


I think you can ignore these failing tests and are good to go. I assume that for running the tests you would need to build the bindings yourself (which can also be done via pip) instead of installing them via PyPI.

Maybe @IshaanDesai knows more about this. :slight_smile:

HI @HishamSaeed

Lets reduce the complexities and try to figure out why the tests are not working. Firstly I would suggest just work on a normal terminal (open it using Ctrl + Alt + T) rather than the terminal in VS Code. Secondly clone the fenics-adapter and install it from source before running the tests. To install from source, go to the fenics-adapter folder after cloning and run pip3 install --user .. If then the ufl package is not found, try to install it manually via pip.

And of course as @ajaust has already suggested, just try to run a case or use the adapter, perhaps the failing tests are really independent of the adapter installation and the adapter itself has been installed correctly.

Possibly relevant to the failing tests here: Adds a warning, if python 3.6.8 is used by BenjaminRodenberg · Pull Request #134 · precice/fenics-adapter · GitHub. @HishamSaeed can you please check your python version?


i tried running the tests with ubuntu terminal and installing adapter form repository still same problem, but the partitioned heat equation works fine and give me results. Regarding my python version is 3.6.9, and my scipy is a little bit old 1.4.1 i will try to upgrade it and see what happens

1 Like

The python version 3.6.9 is known to have problems, so this explains the failing tests. More details can be found here. For now the way ahead would be to just continue using the adapter without testing it.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.