Unable to use python package due to OSError: cannot enable executable stack as shared object requires: Invalid argument

Summary

I previously used NumbaMinpack on Fedora 34 with Python 3.11 without any issues. After upgrading to Fedora 42, I am unable to install or import the package successfully on a clean system with Python 3.13.


Environment

  • OS: Fedora 42 (fresh install)
  • Python: 3.13 (inside a clean virtualenv)
  • Packages:
    • cmake: 3.31.6
    • llvmlite: 0.44.0
    • numba: 0.61.2
    • numpy: 2.2.6
    • packaging: 25.0
    • scikit-build: 0.18.1
    • setuptools: 80.9.0
    • wheel: 0.45.1

Steps to Reproduce

  1. Create a fresh Python 3.13 virtual environment.
  2. Install required dependencies (listed above)
  3. Run:
pip install NumbaMinpack

Problem encountered

  • The build fails with a CMake configuration error:
  CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
    Compatibility with CMake < 3.10 will be removed from a future version of
    CMake.
...
  CMake Error at CMakeLists.txt:1 (cmake_minimum_required):
    Compatibility with CMake < 3.5 has been removed from CMake.
...
  An error occurred while configuring with CMake.
    Command:
      /tmp/pip-build-env-0c0w1llb/overlay/lib64/python3.13/site-packages/cmake/data/bin/cmake /tmp/pip-install-6svpjrw2/numbaminpack_6c843040739d4851ab386035fd4601c7 -G Ninja -DCMAKE_MAKE_PROGRAM:FILEPATH=ninja --no-warn-unused-cli -DCMAKE_INSTALL_PREFIX:PATH=/tmp/pip-install-6svpjrw2/numbaminpack_6c843040739d4851ab386035fd4601c7/_skbuild/linux-x86_64-3.13/cmake-install -DPYTHON_VERSION_STRING:STRING=3.13.5 -DSKBUILD:INTERNAL=TRUE -DCMAKE_MODULE_PATH:PATH=/tmp/pip-build-env-0c0w1llb/overlay/lib/python3.13/site-packages/skbuild/resources/cmake -DPYTHON_EXECUTABLE:PATH=/home/probitjk/.virtualenvs/general/bin/python -DPYTHON_INCLUDE_DIR:PATH=/usr/include/python3.13 -DPYTHON_LIBRARY:PATH=/usr/lib64/libpython3.13.so -DPython_EXECUTABLE:PATH=/home/probitjk/.virtualenvs/general/bin/python -DPython_ROOT_DIR:PATH=/home/probitjk/.virtualenvs/general -DPython_FIND_REGISTRY:STRING=NEVER -DPython_INCLUDE_DIR:PATH=/usr/include/python3.13 -DPython3_EXECUTABLE:PATH=/home/probitjk/.virtualenvs/general/bin/python -DPython3_ROOT_DIR:PATH=/home/probitjk/.virtualenvs/general -DPython3_FIND_REGISTRY:STRING=NEVER -DPython3_INCLUDE_DIR:PATH=/usr/include/python3.13 -DCMAKE_MAKE_PROGRAM:FILEPATH=ninja -DSKBUILD=ON -DCMAKE_BUILD_TYPE:STRING=Release
    Source directory:
      /tmp/pip-install-6svpjrw2/numbaminpack_6c843040739d4851ab386035fd4601c7
    Working directory:
      /tmp/pip-install-6svpjrw2/numbaminpack_6c843040739d4851ab386035fd4601c7/_skbuild/linux-x86_64-3.13/cmake-build
  Please see CMake's output for more information.
  • The build failure was bypassed by installing with:
pip install --no-build-isolation NumbaMinpack

which leads to successful installation

  • However importing the package using python -c "import NumbaMinpack" results in:
OSError: /home/probitjk/.virtualenvs/general/lib/python3.13/site-packages/NumbaMinpack/libminpack.so: cannot enable executable stack as shared object requires: Invalid argument
  • Using execstack -c <path/to/installed/.so/file> (as suggested for similar issues on StackOverflow) allows for the package to get imported, but any call to lmdif or hybrd (following the example in README) causes an immediate segmentation fault.

Installing from source


I have also installed Python 3.11 and 3.10 but that was unable to resolve the issue. Using Conda has also failed to fix the issue.

The error seems to mean that the version of cmake you have is too old.
On f42 I have:

$ rpm -q cmake
cmake-3.31.6-2.fc42.x86_64

If you have the same version then I think there is a bug in the Numba code when checking the version.

3.31.6 is > 3.5 if checked numerically, but not if checked as a string.

If that is the problem you will need to patch get a fix from the Numba maintainer of patch the source code yourself.

What is the first line of CMakeLists.txt in the version of the package you have installed?

In the latest version on Github it’s:

cmake_minimum_required(VERSION 3.14)

But previously (before ~2 months ago) it was

cmake_minimum_required(VERSION 3.4.0)

which would give the error you’re seeing.

The old version caused this issue (for a Windows user) and resulted in this fix.

The package on PyPI hasn’t been updated since November 2021, so that’s what you’d get from a normal pip install. However, if you pulled the latest source from Github and did pip install -e then it seems strange to get the same error.

I have cmake 3.31.6 from the Fedora repositories and cmake 3.31.6 in the python virtual environment from pip.
As far as I can see, Numba is not creating any issues as it is getting installed without any hassles, and it is NumbaMinpack itself which is creating the issue.
I will have to verify if numba on its own is working

What is the first line of CMakeLists.txt in the version of the package you have installed?

I pulled it from github and it is

cmake_minimum_required(VERSION 3.14)

I can understand that installing from PyPI could be causing issues due to the version error, but that should not have been the case when building from source.

Is it possible to install it from the wheel of an existing install? I checked and found that I have the package installed on my personal device, and the package wheel is also available in the ~/.cache/pip/ directory. However my personal device is on f40 with Python 3.12.

Hmm, yes I agree.

I’m not sure, but it seems worth trying! Though you should probably stick to Python 3.12 for it on the f42 system.

Tried using the .whl file from my personal device with Python 3.12 on the f42 device. Did manage to get the package installed but using the package still leads to the OSError.

Fedora 42 uses python3.13 by default so that should be what is used.
f41 used python3.12