Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 867520 - sci-libs/gmsh-4.10.3 python bindings not found
Summary: sci-libs/gmsh-4.10.3 python bindings not found
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal normal
Assignee: Matthias Maier
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-08-30 16:35 UTC by Fredrik Lingvall
Modified: 2025-03-10 23:03 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Fredrik Lingvall 2022-08-30 16:35:04 UTC
When building sci-libs/gmsh-4.10.3 with the python use flag the module in not found

Reproducible: Always

Steps to Reproduce:
1.# USE=python emerge sci-libs/gmsh

2. $ python
Python 3.10.5 (main, Aug 17 2022, 13:01:32) [GCC 12.1.1 20220625] on linux
Type "help", "copyright", "credits" or "license" for more information.

3. >>> import gmsh

Actual Results:  
>>> import gmsh
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'gmsh'

Expected Results:  
>>> import gmsh
Comment 1 Fredrik Lingvall 2022-10-09 17:06:00 UTC
It looks like the gmsh.py file is installed in /usr/lib64/ (by cmake) and not where python can find it. I tried something like:

<pre>
src_install() {
	
-snip-

	# The gmsh.py file is installed in /usr/lib64/ (by cmake)
	# and not where Python can find it
	if use shared ; then
		insinto /usr/lib/python3.10/site-packages
		doins api/gmsh.py
	fi
}
</pre>
in an modified ebuild (I guess one should not hardcode the install paths but I do now how to set the site-packages path for the current Python version).

NB. The api/gmsh.py is build when setting USE=shared and the python stuff which is enabled when gmsh is build with USE=python is the private (undocumented) python API which is a bit confusing. My guess is that USE=python should imply enabling the api/gmsh.py (and not internal python APIs used mainly for the developers of gmsh?).
Comment 2 Alex Wranovsky 2025-02-15 16:52:04 UTC
Hello,

I have the following patch for the ebuild that appears to fix this. I had to make the `python`
Comment 3 Alex Wranovsky 2025-02-15 16:57:14 UTC
Let's try this again. I have the following patch that fixes this bug for me. The Python API seems to require the shared library, so I've added "shared" to the required use flags.



--- a/sci-libs/gmsh-4.13.1-r1.ebuild
+++ b/sci-libs/gmsh-4.13.1-r1.ebuild
@@ -5,7 +5,7 @@
 
 PYTHON_COMPAT=( python3_{10..12} )
 
-inherit cmake desktop fortran-2 python-any-r1 toolchain-funcs xdg-utils
+inherit cmake desktop fortran-2 python-r1 toolchain-funcs xdg-utils
 
 DESCRIPTION="Three-dimensional finite element mesh generator"
 HOMEPAGE="https://gmsh.info https://gitlab.onelab.info/gmsh/gmsh"
@@ -29,6 +29,7 @@
        ^^ ( blas eigen )
        mumps? ( blas )
        slepc? ( petsc )
+       python? ( shared )
        "
 
 RDEPEND="
@@ -113,6 +114,10 @@
 src_install() {
        cmake_src_install
 
+       if use python; then
+               python_foreach_impl python_domodule api/gmsh.py
+       fi
+
        if use examples ; then
                dodoc -r examples tutorials
                docompress -x /usr/share/doc/${PF}/{examples,tutorials}
Comment 4 Renato 2025-03-10 21:53:10 UTC
I'm seeing the same problem. Would the maintainer(s) please at least mark this as confirmed?
Comment 5 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2025-03-10 22:46:47 UTC
Gentoo generally doesn't do UNCONFIRMED vs CONFIRMED. Anyway, I'll take a look.
Comment 6 Larry the Git Cow gentoo-dev 2025-03-10 23:03:37 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=dd23c721e57d589da48232fb656fc59ae0ccb7a9

commit dd23c721e57d589da48232fb656fc59ae0ccb7a9
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2025-03-10 23:03:11 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2025-03-10 23:03:17 +0000

    sci-libs/gmsh: fix USE=python
    
    Thanks to Alex Wranovsky.
    
    Closes: https://bugs.gentoo.org/867520
    Signed-off-by: Sam James <sam@gentoo.org>

 sci-libs/gmsh/gmsh-4.13.1-r2.ebuild | 143 ++++++++++++++++++++++++++++++++++++
 1 file changed, 143 insertions(+)