Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PEP 517 support #34

Open
christian-rauch opened this issue Mar 22, 2024 · 1 comment
Open

PEP 517 support #34

christian-rauch opened this issue Mar 22, 2024 · 1 comment

Comments

@christian-rauch
Copy link

I am trying to use fast-slic via a poetry dependency. This fails because it is not compatible with PEP 517.

This can be reproduced via pip install --no-cache-dir --use-pep517 fast-slic.

@a-mruiz
Copy link

a-mruiz commented Sep 23, 2024

Hi there,
I was able to fix it by applying the following changes:

  1. Create a pyproject.toml with the following:
requires = ["setuptools", "wheel", "Cython", "numpy"]
build-backend = "setuptools.build_meta"
  1. Modify the setup.py with:
    Remove the:
dist.Distribution().fetch_build_eggs(['cython', 'numpy'])
This is now handled by pyproject.toml

Also need to adjust the _check_avx2() method to not crash if no cpuid found as :

    try:
        from cpuid.cpuid import CPUID
        # Invoke CPUID instruction with eax 0x7
        input_eax = 0x7
        output_eax, output_ebx, output_ecx, output_edx = CPUID()(input_eax)
        bits = bin(output_ebx)[::-1]
        avx2_support = bits[5]
        return avx2_support == '1'
    except (ImportError, Exception) as e:
        # If cpuid is not available or there's an issue, assume no AVX2 support
        return False

Finally, in setup, remove the setup_requires line (you can also add cpuid to install_requires if you like.

Then just pip install .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants