Blosc / python-blosc

A Python wrapper for the extremely fast Blosc compression library
https://www.blosc.org/python-blosc/python-blosc.html
Other
353 stars 73 forks source link

Numpy 2 compatibility #327

Closed bnavigator closed 4 months ago

bnavigator commented 6 months ago

In line with https://github.com/Blosc/python-blosc/issues/325#issuecomment-2074321136

Ok. It looks like a new release is needed soon. Thanks for the hint.

We need an update for the soon to be released numpy 2 as well, or have to pin to numpy < 2:

[   23s] + python3.10 -m blosc.test
[   23s] /usr/lib64/python3.10/runpy.py:126: RuntimeWarning: 'blosc.test' found in sys.modules after import of package 'blosc', but prior to execution of 'blosc.test'; this may result in unpredictable behaviour
[   23s]   warn(RuntimeWarning(msg))
[   23s] test_all_compressors (__main__.TestCodec) ... ok
[   23s] test_all_filters (__main__.TestCodec) ... ok
[   23s] test_basic_codec (__main__.TestCodec) ... ok
[   23s] test_bithuffle_leftovers (__main__.TestCodec) ... ok
[   23s] test_bitshuffle_not_multiple (__main__.TestCodec) ... ok
[   23s] test_cbuffer_validate (__main__.TestCodec) ... ok
[   23s] test_cbuffer_validate_failures (__main__.TestCodec) ... ok
[   23s] test_compress_exceptions (__main__.TestCodec) ... ok
[   23s] test_compress_input_types (__main__.TestCodec) ... ok
[   23s] test_compress_ptr_exceptions (__main__.TestCodec) ... ok
[   23s] test_decompress_exceptions (__main__.TestCodec) ... ok
[   23s] test_decompress_input_types (__main__.TestCodec) ... ok
[   23s] test_decompress_input_types_as_bytearray (__main__.TestCodec) ... ok
[   23s] test_decompress_ptr_exceptions (__main__.TestCodec) ... ok
[   23s] test_decompress_ptr_input_types (__main__.TestCodec) ... ok
[   23s] test_decompress_releasegil (__main__.TestCodec) ... ok
[   23s] test_get_blocksize (__main__.TestCodec) ... ok
[   23s] test_get_cbuffer_sizes (__main__.TestCodec) ... ok
[   23s] test_get_clib (__main__.TestCodec) ... ok
[   26s] test_no_leaks (__main__.TestCodec) ... ok
[   26s] test_pack_array_exceptions (__main__.TestCodec) ... ok
[   26s] test_set_nthreads_exceptions (__main__.TestCodec) ... ok
[   26s] test_unpack_array_exceptions (__main__.TestCodec) ... ok
[   26s] test_unpack_array_with_from_py27_exceptions (__main__.TestCodec) ... ok
[   26s] test_unpack_array_with_unicode_characters (__main__.TestCodec) ... ok
[   26s] test_unpack_array_with_unicode_characters_from_py27 (__main__.TestCodec) ... ok
[   26s] cbuffer_validate (blosc.toplevel)
[   26s] Doctest: blosc.toplevel.cbuffer_validate ... ok
[   26s] compress (blosc.toplevel)
[   26s] Doctest: blosc.toplevel.compress ... ok
[   26s] compress_ptr (blosc.toplevel)
[   26s] Doctest: blosc.toplevel.compress_ptr ... FAIL
[   26s] decompress (blosc.toplevel)
[   26s] Doctest: blosc.toplevel.decompress ... ok
[   26s] decompress_ptr (blosc.toplevel)
[   26s] Doctest: blosc.toplevel.decompress_ptr ... FAIL
[   26s] free_resources (blosc.toplevel)
[   26s] Doctest: blosc.toplevel.free_resources ... ok
[   26s] get_blocksize (blosc.toplevel)
[   26s] Doctest: blosc.toplevel.get_blocksize ... ok
[   26s] get_cbuffer_sizes (blosc.toplevel)
[   26s] Doctest: blosc.toplevel.get_cbuffer_sizes ... ok
[   26s] pack_array (blosc.toplevel)
[   26s] Doctest: blosc.toplevel.pack_array ... ok
[   26s] set_blocksize (blosc.toplevel)
[   26s] Doctest: blosc.toplevel.set_blocksize ... ok
[   26s] set_nthreads (blosc.toplevel)
[   26s] Doctest: blosc.toplevel.set_nthreads ... ok
[   26s] set_releasegil (blosc.toplevel)
[   26s] Doctest: blosc.toplevel.set_releasegil ... ok
[   26s] unpack_array (blosc.toplevel)
[   26s] Doctest: blosc.toplevel.unpack_array ... FAIL
[   26s] 
[   26s] ======================================================================
[   26s] FAIL: compress_ptr (blosc.toplevel)
[   26s] Doctest: blosc.toplevel.compress_ptr
[   26s] ----------------------------------------------------------------------
[   26s] Traceback (most recent call last):
[   26s]   File "/usr/lib64/python3.10/doctest.py", line 2221, in runTest
[   26s]     raise self.failureException(self.format_failure(new.getvalue()))
[   26s] AssertionError: Failed doctest test for blosc.toplevel.compress_ptr
[   26s]   File "/home/abuild/rpmbuild/BUILD/blosc-1.11.1/blosc/toplevel.py", line 455, in compress_ptr
[   26s] 
[   26s] ----------------------------------------------------------------------
[   26s] File "/home/abuild/rpmbuild/BUILD/blosc-1.11.1/blosc/toplevel.py", line 516, in blosc.toplevel.compress_ptr
[   26s] Failed example:
[   26s]     (np_array == np_ans).all()
[   26s] Expected:
[   26s]     True
[   26s] Got:
[   26s]     np.True_
[   26s] 
[   26s] 
[   26s] ======================================================================
[   26s] FAIL: decompress_ptr (blosc.toplevel)
[   26s] Doctest: blosc.toplevel.decompress_ptr
[   26s] ----------------------------------------------------------------------
[   26s] Traceback (most recent call last):
[   26s]   File "/usr/lib64/python3.10/doctest.py", line 2221, in runTest
[   26s]     raise self.failureException(self.format_failure(new.getvalue()))
[   26s] AssertionError: Failed doctest test for blosc.toplevel.decompress_ptr
[   26s]   File "/home/abuild/rpmbuild/BUILD/blosc-1.11.1/blosc/toplevel.py", line 597, in decompress_ptr
[   26s] 
[   26s] ----------------------------------------------------------------------
[   26s] File "/home/abuild/rpmbuild/BUILD/blosc-1.11.1/blosc/toplevel.py", line 642, in blosc.toplevel.decompress_ptr
[   26s] Failed example:
[   26s]     (np_array == np_ans).all()
[   26s] Expected:
[   26s]     True
[   26s] Got:
[   26s]     np.True_
[   26s] 
[   26s] 
[   26s] ======================================================================
[   26s] FAIL: unpack_array (blosc.toplevel)
[   26s] Doctest: blosc.toplevel.unpack_array
[   26s] ----------------------------------------------------------------------
[   26s] Traceback (most recent call last):
[   26s]   File "/usr/lib64/python3.10/doctest.py", line 2221, in runTest
[   26s]     raise self.failureException(self.format_failure(new.getvalue()))
[   26s] AssertionError: Failed doctest test for blosc.toplevel.unpack_array
[   26s]   File "/home/abuild/rpmbuild/BUILD/blosc-1.11.1/blosc/toplevel.py", line 739, in unpack_array
[   26s] 
[   26s] ----------------------------------------------------------------------
[   26s] File "/home/abuild/rpmbuild/BUILD/blosc-1.11.1/blosc/toplevel.py", line 772, in blosc.toplevel.unpack_array
[   26s] Failed example:
[   26s]     numpy.alltrue(a == a2)
[   26s] Exception raised:
[   26s]     Traceback (most recent call last):
[   26s]       File "/usr/lib64/python3.10/doctest.py", line 1350, in __run
[   26s]         exec(compile(example.source, filename, "single",
[   26s]       File "<doctest blosc.toplevel.unpack_array[5]>", line 1, in <module>
[   26s]         numpy.alltrue(a == a2)
[   26s]       File "/usr/lib64/python3.10/site-packages/numpy/__init__.py", line 410, in __getattr__
[   26s]         raise AttributeError("module {!r} has no attribute "
[   26s]     AttributeError: module 'numpy' has no attribute 'alltrue'
[   26s] ----------------------------------------------------------------------
[   26s] File "/home/abuild/rpmbuild/BUILD/blosc-1.11.1/blosc/toplevel.py", line 777, in blosc.toplevel.unpack_array
[   26s] Failed example:
[   26s]     numpy.alltrue(a == a2)
[   26s] Exception raised:
[   26s]     Traceback (most recent call last):
[   26s]       File "/usr/lib64/python3.10/doctest.py", line 1350, in __run
[   26s]         exec(compile(example.source, filename, "single",
[   26s]       File "<doctest blosc.toplevel.unpack_array[9]>", line 1, in <module>
[   26s]         numpy.alltrue(a == a2)
[   26s]       File "/usr/lib64/python3.10/site-packages/numpy/__init__.py", line 410, in __getattr__
[   26s]         raise AttributeError("module {!r} has no attribute "
[   26s]     AttributeError: module 'numpy' has no attribute 'alltrue'
[   26s] 
[   26s] 
[   26s] ----------------------------------------------------------------------
[   26s] Ran 39 tests in 2.636s
[   26s] 
[   26s] FAILED (failures=3)
[   26s] Traceback (most recent call last):
[   26s]   File "/usr/lib64/python3.10/runpy.py", line 196, in _run_module_as_main
[   26s]     return _run_code(code, main_globals, None,
[   26s]   File "/usr/lib64/python3.10/runpy.py", line 86, in _run_code
[   26s]     exec(code, run_globals)
[   26s]   File "/home/abuild/rpmbuild/BUILD/blosc-1.11.1/blosc/test.py", line 369, in <module>
[   26s]     run()
[   26s]   File "/home/abuild/rpmbuild/BUILD/blosc-1.11.1/blosc/test.py", line 364, in run
[   26s]     assert unittest.TextTestRunner(verbosity=verbosity).\
[   26s] AssertionError
[   26s] -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[   26s] python-blosc version: 1.11.1
[   26s] Blosc version: 1.21.5 ($Date:: 2023-05-16 #$)
[   26s] Compressors available: ['blosclz', 'lz4', 'lz4hc', 'snappy', 'zlib', 'zstd']
[   26s] Compressor library versions:
[   26s]   BloscLZ: 2.5.1
[   26s]   LZ4: 1.9.4
[   26s]   Snappy: unknown
[   26s]   Zlib: 1.3.1
[   26s]   Zstd: 1.5.5
[   26s] Python version: 3.10.14 (main, Mar 21 2024, 16:45:28) [GCC]
[   26s] Platform: Linux-6.8.7-1-default-x86_64 (#1 SMP PREEMPT_DYNAMIC Thu Apr 18 07:12:38 UTC 2024 (5c0cf23))
[   26s] Processor: x86_64
[   26s] Byte-ordering: little
[   26s] Detected cores: 4
[   26s] Number of threads to use by default: 4
[   26s] -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=