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

Installation not compatible with Setuptools>65 #1

Closed
psobot opened this issue Aug 28, 2024 · 5 comments
Closed

Installation not compatible with Setuptools>65 #1

psobot opened this issue Aug 28, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@psobot
Copy link

psobot commented Aug 28, 2024

Thanks for this great package, @jodhus!

Unfortunately, the setup.py in this project doesn't seem to be compatible with newer versions of Setuptools; failing at installation time with:

Traceback (most recent call last):
  File "<string>", line 14, in <module>
  File "/Users/psobot/Library/Caches/uv/builds-v0/.tmpfwaiHS/lib/python3.10/site-packages/setuptools/build_meta.py", line 332, in get_requires_for_build_wheel
    return self._get_build_requires(config_settings, requirements=[])
  File "/Users/psobot/Library/Caches/uv/builds-v0/.tmpfwaiHS/lib/python3.10/site-packages/setuptools/build_meta.py", line 302, in _get_build_requires
    self.run_setup()
  File "/Users/psobot/Library/Caches/uv/builds-v0/.tmpfwaiHS/lib/python3.10/site-packages/setuptools/build_meta.py", line 318, in run_setup
    exec(code, locals())
  File "<string>", line 7, in <module>
ModuleNotFoundError: No module named 'distutils.msvccompiler'

Downgrading Setuptools works, but is not compatible with PEP 517 build isolation and causes installation to fail with newer tools like uv.

@jodhus
Copy link
Owner

jodhus commented Aug 30, 2024

Thanks for catching this! Unfortunately I have not looked at this code in a very long time so it's not surprising something broke.

If I remember correctly, the only reason I needed that specific class was to make sure that I included the math library for those using the MSVC compiler since it didn't add it automatically at compile time. I'll have to see if there's a new way to detect that and/or if it's still needed with the newer versions of MSVC.

@jodhus
Copy link
Owner

jodhus commented Aug 30, 2024

@psobot:

Well, I got it compiling on Windows 11, VS 2022, Python 3.12.5, setuptools 74.0.0 by modifying the imports in the setup.py file:

from setuptools import setup, find_packages, Extension
from setuptools._distutils.ccompiler import new_compiler
from setuptools._distutils._msvccompiler import MSVCCompiler

However, after scouring the setuptools issues log on GitHub it appears that they don't particularly like anyone using that due to how they are slowly merging distutils functionality into the main module. So far, there isn't a real good replacement/migration for the new_compiler function and the MSVCCompiler class. See pypa/setuptools#2806

I'm going to look to see if there's a better way to detect MSVC to avoid this mess altogether before I update the code with the above hack.

@jodhus jodhus added the bug Something isn't working label Aug 30, 2024
@jodhus
Copy link
Owner

jodhus commented Sep 7, 2024

@psobot:

After lots of cleanup and refactoring the GitHub automation, I released 0.1.1 which should fix the issue. I'm basically forcing the _USE_MATH_DEFINE macro on all compilers for now since all the other compilers besides MSVC ignore it. Not particularly happy with it, but it's what works until setuptools reimplements compiler detection functions from distutils.

I'll leave this open for a few more days in case you have any other suggestions/concerns. Otherwise, I'll go ahead and close it then.

@jodhus
Copy link
Owner

jodhus commented Sep 10, 2024

Fixed with version 0.1.1.

@jodhus jodhus closed this as completed Sep 10, 2024
@psobot
Copy link
Author

psobot commented Sep 10, 2024

Thank you @jodhus! Looks great to me and I appreciate the quick response. 🙌🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants