Skip to content

Fix import errors if setuptools is too old #483

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

Merged
merged 5 commits into from
Nov 8, 2023
Merged

Fix import errors if setuptools is too old #483

merged 5 commits into from
Nov 8, 2023

Conversation

ferrine
Copy link
Member

@ferrine ferrine commented Nov 7, 2023

fix #481 when setuptools is too old

@ferrine ferrine changed the title add fallback class Fix import errors if setuptools is too new Nov 7, 2023
@ferrine ferrine changed the title Fix import errors if setuptools is too new Fix import errors if setuptools is too old Nov 7, 2023
@@ -1,4 +1,7 @@
from setuptools.errors import CompileError as BaseCompileError
try:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a comment?

Copy link
Contributor

@maresb maresb Nov 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to instead add a warning here. I'm tracking down the various relevant setuptools versions to cite.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ferrine, @twiecki, I added a warning. Does this look helpful?

In [1]: import pytensor
~/repos/pytensor/pytensor/link/c/exceptions.py:14: UserWarning: You appear to be using an ancient
version of setuptools: v57.4.0. Please upgrade to at least v59.0.0. Support for this version of
setuptools is provisionary and may be removed without warning in the future.
  warnings.warn(

In [2]:

I'm not sure what the dangling warnings.warn( is about, but I'm not sure we should care.

@maresb
Copy link
Contributor

maresb commented Nov 7, 2023

@ricardoV94, any idea what this error is about?

FAILED tests/tensor/test_blockwise.py::TestMatrixInverse::test_grad - AssertionError: 
Not equal to tolerance rtol=1e-07, atol=1e-05

Mismatched elements: 6 / 49 (12.2%)
Max absolute difference: 256.
Max relative difference: 1.1633778e-07
 x: array([[[-7.521472e+06, -7.038032e+07,  7.009835e+07,  1.882100e+08,
          8.302121e+07,  9.111284e+07, -2.939551e+07],
        [-7.038031e+07, -6.585663e+08,  6.559279e+08,  1.761128e+09,...
 y: array([[[-7.521472e+06, -7.038032e+07,  7.009834e+07,  1.882100e+08,
          8.302120e+07,  9.111284e+07, -2.939550e+07],
        [-7.038031e+07, -6.585663e+08,  6.559280e+08,  1.761128e+09,...
FAILED tests/tensor/test_blockwise.py::TestSolveMatrix::test_grad - AssertionError: 
Not equal to tolerance rtol=1e-07, atol=1e-05

Mismatched elements: 3 / 245 (1.22%)
Max absolute difference: 6.1035156e-05
Max relative difference: 4.040853e-06
 x: array([[[-2.208488e+00,  5.503439e+00,  1.240619e+01, -6.283111e+00,
          1.377477e+01,  1.137324e+01,  2.236404e+00],
        [ 1.198226e+00, -2.985918e+00, -6.731038e+00,  3.408931e+00,...
 y: array([[[-2.208488e+00,  5.503440e+00,  1.240619e+01, -6.283111e+00,
          1.377477e+01,  1.137324e+01,  2.236404e+00],
        [ 1.198226e+00, -2.985918e+00, -6.731038e+00,  3.408931e+00,...
= 2 failed, 2295 passed, 9 skipped, 2 xfailed, 80 xpassed, 15 warnings in 748.25s (0:12:28) =
Error: Process completed with exit code 1.

I can't imagine that this was caused by anything in this PR.

Also, this PR does what I want, but I feel it's very inelegant. Any suggestions?

@ricardoV94
Copy link
Member

Yeah that test is flaky on float32, some operations that are not actually deterministic on some machines. Feel free to ignore.

Regarding the hoops, you can just type ignore it ;) If mypy is dumb why should we make our code worse for it?

@maresb
Copy link
Contributor

maresb commented Nov 7, 2023

Ya, thanks. I was tying myself in knots trying to satisfy both mypy and Pyright. I think I have a good solution now.

@ricardoV94 ricardoV94 merged commit c9159b2 into main Nov 8, 2023
@maresb maresb deleted the fix-481 branch November 8, 2023 08:46
@maresb maresb mentioned this pull request Jun 9, 2024
11 tasks
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

Successfully merging this pull request may close these issues.

The setuptools requirement is inconsistent and sometimes breaks
4 participants