KrisKennaway / ii-pix

Convert images to Apple II graphics formats
BSD 2-Clause "Simplified" License
36 stars 0 forks source link

np.complex was a deprecated #14

Closed b3rsrk0 closed 1 year ago

b3rsrk0 commented 1 year ago

When I'm doing python precompute_conversion.py it gives me the following error:

Traceback (most recent call last):
  File "C:\Program Files\ii-pix\precompute_conversion.py", line 11, in <module>
    import colour
  File "C:\Program Files\Python312\Lib\site-packages\colour\__init__.py", line 67, in <module>
    from .colorimetry import (
  File "C:\Program Files\Python312\Lib\site-packages\colour\colorimetry\__init__.py", line 10, in <module>
    from .spectrum import (SpectralShape, SPECTRAL_SHAPE_DEFAULT,
  File "C:\Program Files\Python312\Lib\site-packages\colour\colorimetry\spectrum.py", line 487, in <module>
    SPECTRAL_SHAPE_DEFAULT = SpectralShape(360, 780, 1)
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python312\Lib\site-packages\colour\colorimetry\spectrum.py", line 100, in __init__
    self.start = start
    ^^^^^^^^^^
  File "C:\Program Files\Python312\Lib\site-packages\colour\colorimetry\spectrum.py", line 129, in start
    assert is_numeric(value), (
           ^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python312\Lib\site-packages\colour\utilities\common.py", line 613, in is_numeric
    [float, complex, np.integer, np.floating, np.complex]))
                                              ^^^^^^^^^^
  File "C:\Program Files\Python312\Lib\site-packages\numpy\__init__.py", line 338, in __getattr__
    raise AttributeError(__former_attrs__[attr])
AttributeError: module 'numpy' has no attribute 'complex'.
`np.complex` was a deprecated alias for the builtin `complex`. To avoid this error in existing code, use `complex` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.complex128` here.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
    https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations. Did you mean: 'complex_'?

The source is a clone of the current main branch.

How do I resolve this?

KrisKennaway commented 1 year ago

It looks like recent versions of colour-science resolve this (e.g. 0.4.3) but are not yet marked as available for python 3.12

Can you try reinstalling dependencies using python 3.11 and confirm whether you are still seeing this? e.g. I did the following in a fresh clone of the repo:

% python3.11 -m venv venv
% source venv/bin/activate  # not sure what is the requivalent on windows
% pip install -r requirements.txt
% python3.11 precompute_conversion.py
Precomputing conversion matrix from 24-bit RGB to CAM16UCS colour space
Precomputing conversion matrix from 12-bit //gs RGB to CAM16UCS colour space
b3rsrk0 commented 1 year ago

It works now. Thanks @KrisKennaway !