stranskyjan / dem-fem-coupling

Open source codes for coupling of Finite Element Method and Discrete Element Method using YADE, and OOFEM softwares.
43 stars 23 forks source link

Running problem #25

Open Algernon-git opened 2 years ago

Algernon-git commented 2 years ago

Dear Jan When i try to run the example of 'contact1' by 'make all' in Ubuntu18.4, it occurs a problem showing that no module named 'liboofem'. I have installed the yade and oofem in my system, and the file liboofem is located in ./usr/lib/liboofem.so. And then I try to specify an absolute path, but another problem occurs 'ImportError: Dynamic Module does not define Module export Function (PyInit_liboofem) '.

what should i do next?

Sincerely, Tang bug.txt

stranskyjan commented 2 years ago

Hello,

how did you install Yade and Oofem?

is located in ./usr/lib/liboofem.so

what is ./usr? /usr? or really ./usr, where a dot represents current folder?

In the bug report, I see python3, but (unfortunatelly) the current approach works only with python2.. (I have no time to update). Try python2

Cheers Jan

Algernon-git commented 2 years ago

Dear Jan, Thank you very much for your reply. I have tried to run the script by using python2, but it went wrong again. The file liboofem is located in '/usr/lib/liboofem.so', and it still tints that there is no such module named 'liboofem' when i run 'make all'. I also try to add the file into system path, but it shows the same bug. When I put the file 'liboofem.so' in the same directory as the file ‘contact1’, it occurs another problem showing that 'dynamic module does not define init function (initliboofem)'.

what should i do next, and what is the potential problem?

If possible, can you kindly upload a video of how to run your script, which might be helpful for novices.

Sincerely, Tang

Algernon-git commented 2 years ago

This is the bug file, thank you again.

bug2.txt

stranskyjan commented 2 years ago

how did you install Yade and Oofem?

Algernon-git commented 2 years ago

I installed the yade through the command 'sudo apt install yade'. It is the stable release version of 'yade'. For oofem, i install it by the command '$ sudo apt install oofem_2.5_x86_64.deb', whcih gets resource from the Debian package.

stranskyjan commented 2 years ago

thanks, that explains it.

This project works only with specific versions of Yade and Oofem and also adds its own changes. As (maybe too briefly) explained in README, you should use this Makefile, i.e. (how I run it):

cd /path/where/you/have/downloaded/this/project
cd installation/
make help # if needed, there is also mentioned the following command
make all top-dir=$HOME/programs/demfem j-oofem=4 # takes some time...
kgiannis3 commented 2 years ago

Dear Jan, I am facing the same problem no module named 'liboofem'. After reading the forum I did the followings (everything with python 2 and ubuntu 18.04): sudo apt install python-dev python-ipython python-numpy python-tk python-xlib python-pyqt5 python-minieigen python-pyqt5.qtwebkit python-gts

sudo apt install cmake git freeglut3-dev libloki-dev libboost-all-dev fakeroot \ dpkg-dev build-essential g++ python-dev python-ipython python-matplotlib \ libsqlite3-dev python-numpy python-tk gnuplot libgts-dev python-pygraphviz \ libvtk6-dev libeigen3-dev python-xlib python-pyqt5 pyqt5-dev-tools python-mpi4py \ python-pyqt5.qtwebkit gtk2-engines-pixbuf python-pyqt5.qtsvg libqglviewer-dev-qt5 \ python-pil libjs-jquery python-sphinx python-git libxmu-dev libxi-dev libcgal-dev \ help2man libbz2-dev zlib1g-dev libopenblas-dev libsuitesparse-dev \ libmetis-dev python-bibtexparser python-future coinor-clp coinor-libclp-dev \ python-mpmath libmpfr-dev libmpfrc++-dev libmpc-dev

Thank you in advance. Best, Kostas

stranskyjan commented 2 years ago

@kgiannis3 have you followed the "make" steps from this answer?

kgiannis3 commented 2 years ago

Yes exactly. Compilation was successful. But the library is missing or is not linked properly.

stranskyjan commented 2 years ago

what exact make command did you use?

what is the result of terminal command echo $PYTHONPATH?

kgiannis3 commented 2 years ago

Hey Jan thanks for trying to help us. Ubuntu 18.04 and python 2 ( I hope). I did the followings and now I have this error Input error on line 0: "Bad format", field keyword "f(t)":

`sudo apt install cmake git freeglut3-dev libloki-dev libboost-all-dev fakeroot \ dpkg-dev build-essential g++ python-dev python-ipython python-matplotlib \ libsqlite3-dev python-numpy python-tk gnuplot libgts-dev python-pygraphviz \ libvtk6-dev libeigen3-dev python-xlib python-pyqt5 pyqt5-dev-tools python-mpi4py \ python-pyqt5.qtwebkit gtk2-engines-pixbuf python-pyqt5.qtsvg libqglviewer-dev-qt5 \ python-pil libjs-jquery python-sphinx python-git libxmu-dev libxi-dev libcgal-dev \ help2man libbz2-dev zlib1g-dev libopenblas-dev libsuitesparse-dev \ libmetis-dev python-bibtexparser python-future coinor-clp coinor-libclp-dev \ python-mpmath libmpfr-dev libmpfrc++-dev libmpc-dev

make all top-dir=$HOME/programs/demfem j-oofem=4 j-yade=4

sudo apt install python-minieigen

echo $PYTHONPATH :/home/kg/programs/demfem/install:

echo $PYTHONPATH :/home/kg/programs/demfem/install:

python -m cProfile -o /tmp/contact1.pro contact1.py /home/kg/programs/demfem/yade/install/lib/x86_64-linux-gnu/yade/py/yade/system.py:9: RuntimeWarning: to-Python converter for std::vector<int, std::allocator > already registered; second conversion method ignored. from yade._customConverters import /home/kg/programs/demfem/yade/install/lib/x86_64-linux-gnu/yade/py/yade/system.py:9: RuntimeWarning: to-Python converter for std::vector<double, std::allocator > already registered; second conversion method ignored. from yade._customConverters import


Error: (/home/kg/programs/demfem/oofem/source/src/oofemlib/constantfunction.C:47) Input error on line 0: "Bad format", field keyword "f(t)" In function ConstantFunction::initializeFrom Record:" f(t) 1.0"


stack trace: /home/kg/programs/demfem/install/liboofem.so : oofem::OOFEMTXTInputRecord::report_error(char const, char const, char const, oofem::IRResultType, char const, int)+0xb4 /home/kg/programs/demfem/install/liboofem.so : oofem::ConstantFunction::initializeFrom(oofem::InputRecord)+0x94 /home/kg/programs/demfem/install/liboofem.so : oofem::loadTimeFunction(boost::python::tuple, boost::python::dict)+0x353 /home/kg/programs/demfem/install/liboofem.so : boost::python::detail::raw_dispatcher<boost::python::api::object ()(boost::python::tuple, boost::python::dict)>::operator()(_object, _object)+0x7a /home/kg/programs/demfem/install/liboofem.so : boost::python::objects::full_py_function_impl<boost::python::detail::raw_dispatcher<boost::python::api::object ()(boost::python::tuple, boost::python::dict)>, boost::mpl::vector1<_object> >::operator()(_object, _object)+0x2f /usr/lib/x86_64-linux-gnu/libboost_python-py27.so.1.65.1 : boost::python::objects::function::call(_object, _object) const+0x285 /usr/lib/x86_64-linux-gnu/libboost_python-py27.so.1.65.1 : ()+0x22008 /usr/lib/x86_64-linux-gnu/libboost_python-py27.so.1.65.1 : boost::python::handle_exception_impl(boost::function0)+0x73 /usr/lib/x86_64-linux-gnu/libboost_python-py27.so.1.65.1 : ()+0x1f6c9 Total 1 error(s) and 0 warning(s) reported oofem exit code 1 Makefile:41: recipe for target 'example' failed make: *** [example] Error 1`

stranskyjan commented 2 years ago

I cannot reproduce the error, on my two computers it works OK.. Have you changed anything in the files in examples/contact1 directory?

kgiannis3 commented 2 years ago

No I did not change anything. All the examples was run with make all and giving a similar error: /dem-fem-coupling/examples/vol1$ make all

Error: (/home/kg/programs/demfem/oofem/source/src/oofemlib/piecewiselinfunction.C:163) Input error on line 0: "Bad format", field keyword "t" In function PiecewiseLinFunction::initializeFrom Record:" f(t) 2 0 1 t 2 0 0.1 nsteps 2"

is this somehow related to this?

https://github.com/stranskyjan/dem-fem-coupling/issues/15

stranskyjan commented 2 years ago

 is this somehow related to this?  https://github.com/stranskyjan/dem-fem-coupling/issues/15

no

I have no idea what could be wrong..

kgiannis3 commented 2 years ago

anyway thanks for helping.

kgiannis3 commented 2 years ago

Hey Jan one last question,

by reading this force python 2 in the cmake command line: cmake -DPYTHON_VERSION=2 -DCMAKE_INSTALL_PREFIX=../install ../trunk from : https://gitlab.com/yade-dev/trunk/-/blob/6e097e95368a9c63ce169a040f418d30c7ba307c/doc/sphinx/installation.rst

how I can force python 2 on your make file and at the end how I can validate which python version I am using?

stranskyjan commented 2 years ago

compilation with python2 is "forced" by default by used Oofem and Yade versions.

Python version probably is not the reason, because it would end much earlier with a different error.

but to be sure, what is the output of which python?

kgiannis3 commented 2 years ago

which python /usr/bin/python kg@kg-VirtualBox:~/dem-fem-coupling/examples/contact1$ python --version Python 2.7.17

kgiannis3 commented 2 years ago

Dear Jan, I manage to compile and run everything successfully in a virtual machine. Thank you again for helping.