precice / python-bindings

Python language bindings for preCICE
https://precice.org
GNU Lesser General Public License v3.0
22 stars 12 forks source link

Python-bindings with Python2 #88

Closed alicezanella closed 3 years ago

alicezanella commented 3 years ago

Hello,

I was wondering if the preCICE python bindings could work with python2. I'm working with a mbdyn adapter and I cannot work with python3, but if I write "import precice" and run the script with python it gives "No module named precice".

Thank you!

Alice

BenjaminRodenberg commented 3 years ago

Hi Alice,

first of all the bad news: we do not and (as much as I can say today) will not support python2 with the python bindings. The main reason for this is that python2 is officially not supported anymore since 2020. See https://python3statement.org/ or https://mail.python.org/archives/list/python-announce-list@python.org/thread/OFCIETIXLX34X7FVK5B5WPZH22HXV342/.

Our mbdyn adapter is currently quite outdated and needs maintainment (see https://github.com/precice/mbdyn-adapter/issues/2 and https://github.com/precice/mbdyn-adapter/issues/3). The long-range plan is to get it working (again) with the most recent preCICE and python version. We would be very very grateful for any contribution in this direction and will, of course, provide as much help as we can.

You say that you "cannot work with python3". What's the exact reason? If it is the mbdyn adapter, see above. If it is mbdyn itself: I've never used mbdyn, but if mbdyn does not support python3 (yet), it might already help opening an issue and pointing to the guidelines. I could not find any related issue after a quick search, but like I said: I'm definitely no mbdyn expert.

I hope that this helps. Will close this issue now, since we will not fix it. You can still comment below, if you want.

Benjamin

precice-bot commented 3 years ago

This issue has been mentioned on preCICE Forum on Discourse. There might be relevant details there:

https://precice.discourse.group/t/python-bindings-error-solver-dummy/502/7

alicezanella commented 3 years ago

Hi @BenjaminRodenberg

I finally found what the problem was. It was entirely due to my MBDyn installation. I had installeld the latest version (1.7.3) which works perfectly with python2, but fails to work with python3 (in the configuration it couldn't see the numpy headers). So I tried the develop branch of MBDyn git folder and it did the trick! I will inform MBDyn developers of this issue.

Thank you for your help!

BenjaminRodenberg commented 3 years ago

Thanks for the feedback @alicezanella! Glad to hear everything seems to work. Did you already see the discussion in https://github.com/precice/mbdyn-adapter/issues/3 ? There seems to be a C++-based version of the adapter around. I think the information that the python-based version is working for you is very important.

By the way: If you have any test cases using the adapter that you could contribute to https://github.com/precice/tutorials this would be great. For us as MBdyn non-experts it's always difficult to come up with cases. Anything that illustrates correct usage and helps to verify the functionality helps.