Text2Tex icon indicating copy to clipboard operation
Text2Tex copied to clipboard

Building wheel for mathutils (setup.py) ... error

Open ew-wlee opened this issue 1 year ago • 2 comments

Thanks for your amazing work. However, an error occurs during the building of the mathutils package when running python setup.py bdist_wheel. The compilation fails due to an incompatible function call in the mathutils.c file. Specifically, the function _Py_HashDouble is called with two arguments, whereas it expects only a single double argument. This mismatch results in a gcc compilation error. So which version of mathutils package should be used ?

ew-wlee avatar Nov 17 '24 06:11 ew-wlee

same issue here

infung avatar Dec 05 '24 07:12 infung

Problem Origin: The error occurs when compiling mathutils with Python 3.9 in a Linux environment (e.g., WSL2). Specifically, the function _Py_HashDouble in src/mathutils/mathutils.c is called with two arguments (NULL and a double), but in Python 3.9, it expects only one argument (a double). This mismatch causes a compilation failure during the installation process.

Solution: To resolve this, download the mathutils source code, modify the problematic line to match Python 3.9’s API, and install it manually. Use the following steps:

pip download mathutils==3.3.0 --no-binary :all:

tar -xzf mathutils-3.3.0.tar.gz

cd mathutils-3.3.0

sed -i '79s/_Py_HashDouble(NULL,/_Py_HashDouble(/' src/mathutils/mathutils.c

cat -n src/mathutils/mathutils.c | grep -A 1 -B 1 " 79 "

python setup.py install

nitpicker55555 avatar Mar 06 '25 13:03 nitpicker55555