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

Cannot use fastmat with numpy 2.1.3 on python 3.12, cannot install from source either #124

Open
3ddP opened this issue Nov 6, 2024 · 0 comments

Comments

@3ddP
Copy link

3ddP commented Nov 6, 2024

The following problem has been experienced in WSL Ubuntu 22.04.03 LTS and WSL Ubuntu 22.04.05 LTS, with conda and with venv. The issue also occurs if numpy is installed via conda before pip installing fastmat.

  • In a clean environment in which only pip install fastmat has been run, attempting to import Toeplitz from fastmat results in the following error:
Python 3.12.7 | packaged by Anaconda, Inc. | (main, Oct  4 2024, 13:27:36) [GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy as np
>>> from fastmat import Toeplitz
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/edd/anaconda3/envs/fm/lib/python3.12/site-packages/fastmat/__init__.py", line 53, in <module>
    from .Matrix import Matrix, Hermitian, Conjugate, Transpose, flags
  File "fastmat/Matrix.pyx", line 1, in init fastmat.Matrix
ValueError: numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject
  • Attempting to instead download the source and install via pip install . as per the instructions in the README results in a huge number of warnings and errors. A small excerpt is included at the end of the issue.
Error compiling Cython file:
      ------------------------------------------------------------
      ...


      ################################################## type handling

      cdef INFO_TYPE_s typeInfo[NUM_TYPES]
      cdef ftype typeSelection[<int> np.NPY_NTYPES]
                                       ^
      ------------------------------------------------------------

      fastmat/core/types.pxd:161:33: Not allowed in a constant expression

      Error compiling Cython file:
      ------------------------------------------------------------
      ...


      ################################################## type handling

      cdef INFO_TYPE_s typeInfo[NUM_TYPES]
      cdef ftype typeSelection[<int> np.NPY_NTYPES]
                              ^
      ------------------------------------------------------------

      fastmat/core/types.pxd:161:24: Variable type 'ftype []' is incomplete
      Traceback (most recent call last):
        File "/home/edd/fastmat-stable/.eggs/Cython-3.0.11-py3.12-linux-x86_64.egg/Cython/Build/Dependencies.py", line 1345, in cythonize_one_helper
          return cythonize_one(*m)
                 ^^^^^^^^^^^^^^^^^
        File "/home/edd/fastmat-stable/.eggs/Cython-3.0.11-py3.12-linux-x86_64.egg/Cython/Build/Dependencies.py", line 1321, in cythonize_one
          raise CompileError(None, pyx_file)
      Cython.Compiler.Errors.CompileError: fastmat/BlockDiag.pyx
      Traceback (most recent call last):
        File "/home/edd/fastmat-stable/.eggs/Cython-3.0.11-py3.12-linux-x86_64.egg/Cython/Build/Dependencies.py", line 1345, in cythonize_one_helper
          return cythonize_one(*m)
                 ^^^^^^^^^^^^^^^^^
        File "/home/edd/fastmat-stable/.eggs/Cython-3.0.11-py3.12-linux-x86_64.egg/Cython/Build/Dependencies.py", line 1321, in cythonize_one
          raise CompileError(None, pyx_file)
      Cython.Compiler.Errors.CompileError: fastmat/Circulant.pyx
      Traceback (most recent call last):
        File "/home/edd/fastmat-stable/.eggs/Cython-3.0.11-py3.12-linux-x86_64.egg/Cython/Build/Dependencies.py", line 1345, in cythonize_one_helper
          return cythonize_one(*m)
                 ^^^^^^^^^^^^^^^^^
        File "/home/edd/fastmat-stable/.eggs/Cython-3.0.11-py3.12-linux-x86_64.egg/Cython/Build/Dependencies.py", line 1321, in cythonize_one
          raise CompileError(None, pyx_file)
      Cython.Compiler.Errors.CompileError: fastmat/Diag.pyx
      Traceback (most recent call last):
        File "/home/edd/fastmat-stable/.eggs/Cython-3.0.11-py3.12-linux-x86_64.egg/Cython/Build/Dependencies.py", line 1345, in cythonize_one_helper
          return cythonize_one(*m)
                 ^^^^^^^^^^^^^^^^^
        File "/home/edd/fastmat-stable/.eggs/Cython-3.0.11-py3.12-linux-x86_64.egg/Cython/Build/Dependencies.py", line 1321, in cythonize_one
          raise CompileError(None, pyx_file)
      Cython.Compiler.Errors.CompileError: fastmat/Blocks.pyx
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

1 participant