Problem with runnig the test line for fenicsprecice

Hi all,

I am having issue running the test line

sudo python3 -c "import fenicsprecice"

I have a linux machine with a working FEniCS 2019.2.0.dev0 installed on it. I have successfully sudo installed all the dependencies including, precice, pyprecice, scipy without any errors. Installing fenicsprecice also did not produce any error for me. However, when I test it through the import line above it produces the following error:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/root/.local/lib/python3.8/site-packages/fenicsprecice/__init__.py", line 9, in <module>
    from .fenicsprecice import Adapter
  File "/root/.local/lib/python3.8/site-packages/fenicsprecice/fenicsprecice.py", line 8, in <module>
    import precice
  File "/root/.local/lib/python3.8/site-packages/precice/__init__.py", line 4, in <module>
    from cyprecice import Interface, action_read_iteration_checkpoint, action_write_iteration_checkpoint, action_write_initial_data, get_version_information
ImportError: libboost_log_setup.so.1.74.0: cannot open shared object file: No such file or directory

I’d really appreciate it if you could help me solve this issue.

Hi @nmirzaei

I have seen such type of an error before. It can happen if suddenly preCICE cannot access the Boost installation that you pointed it to during its build. Are you sure that preCICE is built correctly? Are you using a preCICE package or an installation from source? In general the Boost dependency comes from the preCICE core library. If you have a source installation, can you go to the build folder and run ctest and check if all tests pass or not?

Hi @IshaanDesai ,
Thanks for the response. I used the binary installation through the quickstart instruction here here.

I re-installed preCICE and it solved the problem. However, now I am receiving an error from OpenFOAM, which used to work fine. It says, “blockmesh not found”.
There were solutions in the OpenFOAM community which all said I need to include

"source /usr/lib/openfoam/openfoam2206/etc/bashrc"

to my bashrc. But I checked it was already there. It seems I cannot get OpenFoam and Fenics work simultaneously. Do you know what is going on here?

Firstly good to know that the original issue is resolved. The problem regarding OpenFOAM seems like a classic case of the environment variable not being set properly. Are you sure the path is included properly? What happens if you open a new terminal and try to use OpenFOAM?

Just to make sure that the fenicsprecice issue has been resolved, can you try to import it in a Python shell or script? If that works then we can be sure that the original issue has been resolved.

Dear @IshaanDesai Thank you so much for following up so patiently.
To check whether fenicsprecice works I used the following line in my Linux terminal:

sudo python3 -c "import fenicsprecice"

I also used the import in a Fenics script and it ran with no issues.
As for the path this is what I see at the bottom of my .bashrc file when I type nano ~/.bashrc:

if ! shopt -oq posix; then
  if [ -f /usr/share/bash-completion/bash_completion ]; then
    . /usr/share/bash-completion/bash_completion
  elif [ -f /etc/bash_completion ]; then
    . /etc/bash_completion
  fi
fi
export PATH=$PATH:$HOME/opt/openmpi/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/opt/openmpi/lib
source /usr/lib/openfoam/openfoam2206/etc/bashrc
source /usr/lib/openfoam/openfoam2206/etc/bashrc

There are not one but two of them added. Also, doesn’t make any difference if I delete one of them.

Dear @IshaanDesai. I was able to resolve the issue by deleting all the lines and sourcing again. It is working and is coupling with Fenics just fine. Thank you for your help.

1 Like

Great to know that everything is working now! :+1:

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