enthought / chaco

Chaco is a Python package for building interactive and custom 2-D plots.
http://docs.enthought.com/chaco/
Other
292 stars 99 forks source link

Chaco 6.0.0 installation failed with Numpy 1.26.4 #910

Open henridbr opened 6 months ago

henridbr commented 6 months ago

Problem Description Failing to build wheel for chaco due to numpy version check. With Python 3.12.2, numpy 1.26.4, chaco 6.0.0 installation failed. Script chaco/plots/contour/cntr.c is calling for files which does not exist in numpy anymore.

Reproduction Steps:

pip install chaco 
[...]
creating build\temp.win-amd64-cpython-312\Release\chaco\plots\contour
      "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.39.33519\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -DNUMPY -IC:\Users\henri\AppData\Local\Temp\pip-build-env-yp634vpe\overlay\Lib\site-packages\numpy\core\include "-IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.752.0_x64__qbz5n2kfra8p0\include" "-IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.752.0_x64__qbz5n2kfra8p0\Include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.39.33519\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\cppwinrt" /Tcchaco/plots/contour/cntr.c /Fobuild\temp.win-amd64-cpython-312\Release\chaco/plots/contour/cntr.obj
      cntr.c
      C:\Users\henri\AppData\Local\Temp\pip-build-env-yp634vpe\overlay\Lib\site-packages\numpy\core\include\numpy\npy_1_7_deprecated_api.h(14) : Warning Msg: Using deprecated NumPy API, disable it with #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
      chaco/plots/contour/cntr.c(35): fatal error C1083: Impossible d'ouvrir le fichier includeÿ: 'numpy/oldnumeric.h'ÿ: No such file or directory
      error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.39.33519\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for chaco
Failed to build chaco
ERROR: Could not build wheels for chaco, which is required to install pyproject.toml-based `projects`

Expected behavior: To get chaco installed, chaco/plots/contour/cntr.c might be corrected.

OS, Python version: [Win 11, Visual Studio Code and Python 3.12.2]

limpkin commented 5 months ago

I'm also experiencing this issue... did you manage to find a local fix?

henridbr commented 5 months ago

Hi limpkin,

I wanted to use the GUI of your CDM324 Doppler Speed Sensor, but was stopped by this issue. I failed to correct it.

Numpy version is 1.26.4 right now and chaco has not been maintained since last year.

Regards. Henri

limpkin commented 5 months ago

Yup, another customer reported that issue to me so I'm trying to see what I can do... I'm going to experiment and report back

limpkin commented 5 months ago

so I innocently copy pasted the contents of https://github.com/huggingface/neuralcoref/blob/master/include/numpy/oldnumeric.h into the #ifdef but am now getting a whole new bunch of issues...

` Error compiling Cython file:

  ...
  # Thanks for using Enthought open source!
  import cython
  import numpy as np
  from numpy cimport uint8_t

  cimport _marker_renderer
          ^
  ------------------------------------------------------------

  kiva\_marker_renderer.pyx:14:8: '_marker_renderer.pxd' not found

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

  import numpy as np
  from numpy cimport uint8_t

  cimport _marker_renderer

  ctypedef _marker_renderer.marker_renderer_base renderer_base_t
           ^
  ------------------------------------------------------------

  kiva\_marker_renderer.pyx:16:9: 'marker_renderer_base' is not a type identifier

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

          self._this.transform(_sx, _sy, _shx, _shy, _tx, _ty)

  # Template specializations
  ctypedef _marker_renderer.marker_renderer[_marker_renderer.pixfmt_abgr32] renderer_abgr32_t
           ^
  ------------------------------------------------------------

  kiva\_marker_renderer.pyx:91:9: 'marker_renderer' is not a type identifier

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
          self._this.transform(_sx, _sy, _shx, _shy, _tx, _ty)

  # Template specializations
  ctypedef _marker_renderer.marker_renderer[_marker_renderer.pixfmt_abgr32] renderer_abgr32_t
  ctypedef _marker_renderer.marker_renderer[_marker_renderer.pixfmt_argb32] renderer_argb32_t
           ^`
limpkin commented 5 months ago

ok so I managed to install everything but that wasn't straight forward. In short, I found a previous version of the missing oldnumeric.h file, and pasted its contents into the cntr.ch You'll need to:

henridbr commented 5 months ago

Thank you for this trick, it works fine for me. Sorry for my mistake when answering, I quoted a wrong script.

capn-freako commented 4 months ago

https://github.com/enthought/chaco/pull/913

limpkin commented 4 months ago

that looks easier...