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

Install fails with Cython 3.0.2 #332

Open
dwfmarchant opened this issue Aug 30, 2023 · 1 comment
Open

Install fails with Cython 3.0.2 #332

dwfmarchant opened this issue Aug 30, 2023 · 1 comment

Comments

@dwfmarchant
Copy link
Contributor

Looks like the install crashes with Cython 3 that was released last month. Downgrading to the previous Cython release (v0.29.35) fixes things.

(simpeg) ➜  ~ pip list
Package           Version
----------------- -------
Cython            3.0.2
geoana            0.5.0
libdlf            0.2.0
numpy             1.25.2
packaging         23.1
pip               23.2.1
scipy             1.11.2
setuptools        68.0.0
setuptools-scm    7.1.0
tomli             2.0.1
typing_extensions 4.7.1
wheel             0.40.0
(simpeg) ➜  ~ pip install discretize
Collecting discretize
  Using cached discretize-0.9.0.tar.gz (1.1 MB)
  Preparing metadata (setup.py) ... done
Requirement already satisfied: numpy>=1.20 in ./.virtualenvs/simpeg/lib/python3.10/site-packages (from discretize) (1.25.2)
Requirement already satisfied: cython>=0.29 in ./.virtualenvs/simpeg/lib/python3.10/site-packages (from discretize) (3.0.2)
Requirement already satisfied: setuptools_scm in ./.virtualenvs/simpeg/lib/python3.10/site-packages (from discretize) (7.1.0)
Requirement already satisfied: scipy>=1.8 in ./.virtualenvs/simpeg/lib/python3.10/site-packages (from discretize) (1.11.2)
Requirement already satisfied: packaging>=20.0 in ./.virtualenvs/simpeg/lib/python3.10/site-packages (from setuptools_scm->discretize) (23.1)
Requirement already satisfied: setuptools in ./.virtualenvs/simpeg/lib/python3.10/site-packages (from setuptools_scm->discretize) (68.0.0)
Requirement already satisfied: typing-extensions in ./.virtualenvs/simpeg/lib/python3.10/site-packages (from setuptools_scm->discretize) (4.7.1)
Requirement already satisfied: tomli>=1.0.0 in ./.virtualenvs/simpeg/lib/python3.10/site-packages (from setuptools_scm->discretize) (2.0.1)
Building wheels for collected packages: discretize
  Building wheel for discretize (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [67 lines of output]
      Compiling discretize/_extensions/interputils_cython.pyx because it changed.
      Compiling discretize/_extensions/tree_ext.pyx because it changed.
      Compiling discretize/_extensions/simplex_helpers.pyx because it changed.
      [1/3] Cythonizing discretize/_extensions/interputils_cython.pyx
      /Users/dmarchant/.virtualenvs/simpeg/lib/python3.10/site-packages/Cython/Compiler/Main.py:384: FutureWarning: Cython directive 'language_level' not set, using '3str' for now (Py3). This has changed from earlier releases! File: /private/var/folders/vv/bfm07t4x54s2y2bf10ls0tr40000gn/T/pip-install-dsjxa4xy/discretize_3fb1281a136c459cafe6b1e44807860c/discretize/_extensions/interputils_cython.pxd
        tree = Parsing.p_module(s, pxd, full_module_name)
      [2/3] Cythonizing discretize/_extensions/simplex_helpers.pyx
      [3/3] Cythonizing discretize/_extensions/tree_ext.pyx
      warning: discretize/_extensions/tree_ext.pyx:5357:19: Non-trivial type declarators in shared declaration (e.g. mix of pointers and values). Each pointer declaration should be on its own line.
      warning: discretize/_extensions/tree_ext.pyx:5357:24: Non-trivial type declarators in shared declaration (e.g. mix of pointers and values). Each pointer declaration should be on its own line.
      warning: discretize/_extensions/tree_ext.pyx:5358:17: Non-trivial type declarators in shared declaration (e.g. mix of pointers and values). Each pointer declaration should be on its own line.
      warning: discretize/_extensions/tree_ext.pyx:5358:24: Non-trivial type declarators in shared declaration (e.g. mix of pointers and values). Each pointer declaration should be on its own line.
      warning: discretize/_extensions/tree_ext.pyx:5358:31: Non-trivial type declarators in shared declaration (e.g. mix of pointers and values). Each pointer declaration should be on its own line.
      warning: discretize/_extensions/tree_ext.pyx:5358:38: Non-trivial type declarators in shared declaration (e.g. mix of pointers and values). Each pointer declaration should be on its own line.
      warning: discretize/_extensions/tree_ext.pyx:5358:45: Non-trivial type declarators in shared declaration (e.g. mix of pointers and values). Each pointer declaration should be on its own line.
      warning: discretize/_extensions/tree_ext.pyx:5358:52: Non-trivial type declarators in shared declaration (e.g. mix of pointers and values). Each pointer declaration should be on its own line.
      warning: discretize/_extensions/tree_ext.pyx:5358:59: Non-trivial type declarators in shared declaration (e.g. mix of pointers and values). Each pointer declaration should be on its own line.
      warning: discretize/_extensions/tree_ext.pyx:5358:66: Non-trivial type declarators in shared declaration (e.g. mix of pointers and values). Each pointer declaration should be on its own line.
      warning: discretize/_extensions/tree_ext.pyx:5488:19: Non-trivial type declarators in shared declaration (e.g. mix of pointers and values). Each pointer declaration should be on its own line.
      warning: discretize/_extensions/tree_ext.pyx:5488:25: Non-trivial type declarators in shared declaration (e.g. mix of pointers and values). Each pointer declaration should be on its own line.
      warning: discretize/_extensions/tree_ext.pyx:5488:31: Non-trivial type declarators in shared declaration (e.g. mix of pointers and values). Each pointer declaration should be on its own line.
      warning: discretize/_extensions/tree_ext.pyx:5488:37: Non-trivial type declarators in shared declaration (e.g. mix of pointers and values). Each pointer declaration should be on its own line.
      warning: discretize/_extensions/tree_ext.pyx:5489:17: Non-trivial type declarators in shared declaration (e.g. mix of pointers and values). Each pointer declaration should be on its own line.
      warning: discretize/_extensions/tree_ext.pyx:5489:24: Non-trivial type declarators in shared declaration (e.g. mix of pointers and values). Each pointer declaration should be on its own line.
      warning: discretize/_extensions/tree_ext.pyx:5489:31: Non-trivial type declarators in shared declaration (e.g. mix of pointers and values). Each pointer declaration should be on its own line.
      warning: discretize/_extensions/tree_ext.pyx:5489:38: Non-trivial type declarators in shared declaration (e.g. mix of pointers and values). Each pointer declaration should be on its own line.
      warning: discretize/_extensions/tree_ext.pyx:5489:45: Non-trivial type declarators in shared declaration (e.g. mix of pointers and values). Each pointer declaration should be on its own line.
      warning: discretize/_extensions/tree_ext.pyx:5489:52: Non-trivial type declarators in shared declaration (e.g. mix of pointers and values). Each pointer declaration should be on its own line.
      warning: discretize/_extensions/tree_ext.pyx:5489:59: Non-trivial type declarators in shared declaration (e.g. mix of pointers and values). Each pointer declaration should be on its own line.
      warning: discretize/_extensions/tree_ext.pyx:5489:66: Non-trivial type declarators in shared declaration (e.g. mix of pointers and values). Each pointer declaration should be on its own line.
      warning: discretize/_extensions/tree_ext.pyx:5490:17: Non-trivial type declarators in shared declaration (e.g. mix of pointers and values). Each pointer declaration should be on its own line.
      warning: discretize/_extensions/tree_ext.pyx:5490:23: Non-trivial type declarators in shared declaration (e.g. mix of pointers and values). Each pointer declaration should be on its own line.
      warning: discretize/_extensions/tree_ext.pyx:5490:29: Non-trivial type declarators in shared declaration (e.g. mix of pointers and values). Each pointer declaration should be on its own line.
      warning: discretize/_extensions/tree_ext.pyx:5490:35: Non-trivial type declarators in shared declaration (e.g. mix of pointers and values). Each pointer declaration should be on its own line.
      warning: discretize/_extensions/tree_ext.pyx:5752:19: Non-trivial type declarators in shared declaration (e.g. mix of pointers and values). Each pointer declaration should be on its own line.
      warning: discretize/_extensions/tree_ext.pyx:5752:26: Non-trivial type declarators in shared declaration (e.g. mix of pointers and values). Each pointer declaration should be on its own line.
      warning: discretize/_extensions/tree_ext.pyx:5752:33: Non-trivial type declarators in shared declaration (e.g. mix of pointers and values). Each pointer declaration should be on its own line.
      warning: discretize/_extensions/tree_ext.pyx:5752:40: Non-trivial type declarators in shared declaration (e.g. mix of pointers and values). Each pointer declaration should be on its own line.
      warning: discretize/_extensions/tree_ext.pyx:5752:47: Non-trivial type declarators in shared declaration (e.g. mix of pointers and values). Each pointer declaration should be on its own line.
      warning: discretize/_extensions/tree_ext.pyx:5752:54: Non-trivial type declarators in shared declaration (e.g. mix of pointers and values). Each pointer declaration should be on its own line.
      warning: discretize/_extensions/tree_ext.pyx:5752:61: Non-trivial type declarators in shared declaration (e.g. mix of pointers and values). Each pointer declaration should be on its own line.
      warning: discretize/_extensions/tree_ext.pyx:5752:68: Non-trivial type declarators in shared declaration (e.g. mix of pointers and values). Each pointer declaration should be on its own line.

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                  diagonal_balance = self._diagonal_balance
              cdef bool diag_balance = diagonal_balance

              #Wrapping function so it can be called in c++
              cdef void * func_ptr = <void *> function
              self.wrapper.set(func_ptr, _evaluate_func)
                                         ^
      ------------------------------------------------------------

      discretize/_extensions/tree_ext.pyx:505:35: Cannot assign type 'int (void *, Cell *) except? -1 nogil' to 'int (*)(void *, Cell *) noexcept'. Exception values are incompatible. Suggest adding 'noexcept' to type 'int (void *, Cell *) except? -1 nogil'.
      warning: discretize/_extensions/tree_ext.pyx:754:19: Index should be typed for more efficient access
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/private/var/folders/vv/bfm07t4x54s2y2bf10ls0tr40000gn/T/pip-install-dsjxa4xy/discretize_3fb1281a136c459cafe6b1e44807860c/setup.py", line 127, in <module>
          metadata["ext_modules"] = cythonize(extensions)
        File "/Users/dmarchant/.virtualenvs/simpeg/lib/python3.10/site-packages/Cython/Build/Dependencies.py", line 1134, in cythonize
          cythonize_one(*args)
        File "/Users/dmarchant/.virtualenvs/simpeg/lib/python3.10/site-packages/Cython/Build/Dependencies.py", line 1301, in cythonize_one
          raise CompileError(None, pyx_file)
      Cython.Compiler.Errors.CompileError: discretize/_extensions/tree_ext.pyx
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for discretize
  Running setup.py clean for discretize
Failed to build discretize
ERROR: Could not build wheels for discretize, which is required to install pyproject.toml-based projects
@omid-b
Copy link

omid-b commented Sep 8, 2023

I think it is the time to move to a more modern metadata and setup configuration format to avoid these issues and make discretize more OS-independent and future-proof. I opened #336 that will address this one too...

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