Personal tools
You are here: Home Forum Install & build libmed python module not working out of the box

libmed python module not working out of the box

Up to Install & build

libmed python module not working out of the box

Posted by Bernd Waibel at October 20. 2018

Hi, in preparation to build salome-platform for Gentoo linux, I installed the libmed / med fichier libraries version 3.3.1 using cmake as the build system. I applied the patches from libmed 3.3.1 build failure and it compiled and installed fine.

However, when I try to use the python modules, I get an ModuleNotFoundError for `medenum`, whenever I try to `import med` from outside the directory where the python files are installed (`/usr/lib64/python3.6/site-packages/med` for me). Switching to this directory and trying again fixes this.

I found, that the python files contain a `import medenum` statement. Changing it to `from . import medenum` for all the python files solves this. Unfortunately I was not able to get a proper fix for this, mostly due to missing swig skills. I tried changing this in the swig files, but they seem to be re-created due to different swig versions in use (I'm using swig-3.0.12). Currently I have a workaround for this, where I use `sed` to replace the statements in the staging area, before they get byte-compiled and installed on the system.

I could probably add the `med` directory to `sys.path` whenever `libmed` is going to be used, however, from my understanding this should not be necessary from anything installed in the system's `site-packages` dir or subdirs of it.

For a more in-depth discussion on this topic please take a look at https://github.com/waebbl/waebbl-gentoo/issues/15

I appreciate any feedback on this topic.

Thank you!

Powered by Ploneboard
Document Actions