Skip to content

Instantly share code, notes, and snippets.

@samuela
Created June 20, 2025 22:14
Show Gist options
  • Save samuela/cb1e21408c78ff89726fcb2caf213532 to your computer and use it in GitHub Desktop.
Save samuela/cb1e21408c78ff89726fcb2caf213532 to your computer and use it in GitHub Desktop.
❯ nix-build -A python3Packages.anndata
this derivation will be built:
/nix/store/swwnk1mhz2wfxy75asx67zjg2qkhi8di-python3.12-anndata-0.11.4.drv
building '/nix/store/swwnk1mhz2wfxy75asx67zjg2qkhi8di-python3.12-anndata-0.11.4.drv'...
Sourcing python-remove-tests-dir-hook
Sourcing python-catch-conflicts-hook.sh
Sourcing python-remove-bin-bytecode-hook.sh
Sourcing pypa-build-hook
Using pypaBuildPhase
Sourcing python-runtime-deps-check-hook
Using pythonRuntimeDepsCheckHook
Sourcing pypa-install-hook
Using pypaInstallPhase
Sourcing python-imports-check-hook.sh
Using pythonImportsCheckPhase
Sourcing python-namespaces-hook
Sourcing python-catch-conflicts-hook.sh
Sourcing pytest-check-hook
Using pytestCheckPhase
Running phase: unpackPhase
unpacking source archive /nix/store/wdby4rb7pmhjlxp92j9w7al7p7l0cckh-source
source root is source
setting SOURCE_DATE_EPOCH to timestamp 315619200 of file "source/tests/test_x.py"
Running phase: patchPhase
Running phase: updateAutotoolsGnuConfigScriptsPhase
Running phase: configurePhase
no configure script, doing nothing
Running phase: buildPhase
Executing pypaBuildPhase
Setting SETUPTOOLS_SCM_PRETEND_VERSION to 0.11.4
Including all tracked files automatically
Creating a wheel...
pypa build flags: --no-isolation --outdir dist/ --wheel
* Getting build dependencies for wheel...
* Building wheel...
Successfully built anndata-0.11.4-py3-none-any.whl
Finished creating a wheel...
Finished executing pypaBuildPhase
Running phase: pythonRuntimeDepsCheckHook
Executing pythonRuntimeDepsCheck
Checking runtime dependencies for anndata-0.11.4-py3-none-any.whl
Finished executing pythonRuntimeDepsCheck
Running phase: installPhase
Executing pypaInstallPhase
Successfully installed anndata-0.11.4-py3-none-any.whl
Finished executing pypaInstallPhase
Running phase: pythonOutputDistPhase
Executing pythonOutputDistPhase
Finished executing pythonOutputDistPhase
Running phase: fixupPhase
shrinking RPATHs of ELF executables and libraries in /nix/store/gx8cg2bcsqrpf6xdn1y97b440vzg7a98-python3.12-anndata-0.11.4
checking for references to /build/ in /nix/store/gx8cg2bcsqrpf6xdn1y97b440vzg7a98-python3.12-anndata-0.11.4...
patching script interpreter paths in /nix/store/gx8cg2bcsqrpf6xdn1y97b440vzg7a98-python3.12-anndata-0.11.4
stripping (with command strip and flags -S -p) in /nix/store/gx8cg2bcsqrpf6xdn1y97b440vzg7a98-python3.12-anndata-0.11.4/lib
shrinking RPATHs of ELF executables and libraries in /nix/store/9vq4kv4g8z89jnp61vkvws66g117cwzn-python3.12-anndata-0.11.4-dist
checking for references to /build/ in /nix/store/9vq4kv4g8z89jnp61vkvws66g117cwzn-python3.12-anndata-0.11.4-dist...
patching script interpreter paths in /nix/store/9vq4kv4g8z89jnp61vkvws66g117cwzn-python3.12-anndata-0.11.4-dist
Executing pythonRemoveTestsDir
Finished executing pythonRemoveTestsDir
Running phase: installCheckPhase
no Makefile or custom installCheckPhase, doing nothing
Running phase: pythonCatchConflictsPhase
Running phase: pythonRemoveBinBytecodePhase
Running phase: pythonImportsCheckPhase
Executing pythonImportsCheckPhase
Check whether the following modules can be imported: anndata
Running phase: pytestCheckPhase
Executing pytestCheckPhase
pytest flags: -m pytest --ignore-glob=src/anndata/_core/anndata.py --ignore-glob=src/anndata/_core/merge.py --ignore-glob=src/anndata/_core/sparse_dataset.py --ignore-glob=src/anndata/_io/specs/registry.py --ignore-glob=src/anndata/_io/utils.py --ignore-glob=src/anndata/_warnings.py --ignore-glob=src/anndata/experimental/merge.py --ignore-glob=src/anndata/experimental/multi_files/_anncollection.py --ignore-glob=src/anndata/utils.py -k not\ \(anndata._core.anndata.AnnData.concatenate\)\ and\ not\ \(anndata._core.anndata.AnnData.obs_names_make_unique\)\ and\ not\ \(anndata._core.anndata.AnnData.var_names_make_unique\)\ and\ not\ \(anndata._core.merge.concat\)\ and\ not\ \(anndata._core.merge.gen_reindexer\)\ and\ not\ \(anndata._core.sparse_dataset.sparse_dataset\)\ and\ not\ \(anndata._io.specs.registry.read_elem_as_dask\)\ and\ not\ \(anndata._io.utils.report_read_key_on_error\)\ and\ not\ \(anndata._io.utils.report_write_key_on_error\)\ and\ not\ \(anndata._warnings.ImplicitModificationWarning\)\ and\ not\ \(anndata.experimental.merge.concat_on_disk\)\ and\ not\ \(anndata.experimental.multi_files._anncollection.AnnCollection\)\ and\ not\ \(anndata.utils.make_index_unique\)\ and\ not\ \(ci.scripts.min-deps.min_dep\)\ and\ not\ \(concatenation.rst\)\ and\ not\ \(test_adata_raw_gpu\)\ and\ not\ \(test_as_cupy_dask\)\ and\ not\ \(test_as_dask_functions\)\ and\ not\ \(test_concat_different_types_dask\)\ and\ not\ \(test_concatenate_layers\)\ and\ not\ \(test_concatenate_layers_misaligned\)\ and\ not\ \(test_concatenate_layers_outer\)\ and\ not\ \(test_concatenate_roundtrip\)\ and\ not\ \(test_concat_on_var_outer_join\)\ and\ not\ \(test_dask_to_memory_unbacked\)\ and\ not\ \(test_ellipsis_index\)\ and\ not\ \(test_error_on_mixed_device\)\ and\ not\ \(test_gpu\)\ and\ not\ \(test_io_spec_cupy\)\ and\ not\ \(test_modify_view_component\)\ and\ not\ \(test_nan_merge\)\ and\ not\ \(test_pairwise_concat\)\ and\ not\ \(test_raw_gpu\)\ and\ not\ \(test_set_scalar_subset_X\)\ and\ not\ \(test_transposed_concat\)\ and\ not\ \(test_view_different_type_indices\)\ and\ not\ \(test_view_of_view\) --numprocesses=12
============================= test session starts ==============================
platform linux -- Python 3.12.10, pytest-8.3.5, pluggy-1.5.0
rootdir: /build/source
configfile: pyproject.toml
testpaths: anndata, ./tests, ./ci/scripts, ./docs/concatenation.rst
plugins: mock-3.14.0, xdist-3.6.1
12 workers [3366 items]
........................................................................ [ 2%]
.................................................xx..x........x.......xx [ 4%]
...x.......x............................................................ [ 6%]
..x............xxxx.xx...x......x.......x.x..x....x..x....x....x.x....xx [ 8%]
x..x......x.x...x......x......xx...x..x..x.xx.....x.........x..x......x. [ 10%]
x....xxx...x.........x.....xx...x..x.x..x...x.....xx..x.....xx.....x.... [ 12%]
........................................................................ [ 14%]
.....x.................................................................. [ 17%]
........................................................................ [ 19%]
........................................................................ [ 21%]
........................................................................ [ 23%]
....s..s................................................................ [ 25%]
........................................................................ [ 27%]
........................................................................ [ 29%]
........................................................................ [ 32%]
........................................................................ [ 34%]
........................................................................ [ 36%]
....x............x...x.FFFFF............................................ [ 38%]
........................................................................ [ 40%]
........................................................................ [ 42%]
........................................................................ [ 44%]
........................................................................ [ 47%]
........................................................................ [ 49%]
........................................................................ [ 51%]
............................................ss..........s........s...... [ 53%]
......................x....x............................................ [ 55%]
.................ssss..............s...s..................s.sssxsss.s... [ 57%]
.......s....s........................................................... [ 59%]
........................................................................ [ 62%]
........................................................................ [ 64%]
........................................................................ [ 66%]
........................................................................ [ 68%]
........................................................................ [ 70%]
........................................................................ [ 72%]
........................................................................ [ 74%]
........................................................................ [ 77%]
........................................................................ [ 79%]
........................................................................ [ 81%]
........................................................................ [ 83%]
........................................................................ [ 85%]
........................................................................ [ 87%]
........................................................................ [ 89%]
........................................................................ [ 91%]
........................................................................ [ 94%]
........................................................................ [ 96%]
........................................................................ [ 98%]
..............x....x........x.............x........... [100%]
=================================== FAILURES ===================================
______________ test_concat_dask_sparse_matches_memory[outer-only] ______________
[gw8] linux -- Python 3.12.10 /nix/store/8w718rm43x7z73xhw9d6vh8s4snrq67h-python3-3.12.10/bin/python3.12
join_type = 'outer', merge_strategy = 'only'
def test_concat_dask_sparse_matches_memory(join_type, merge_strategy):
import dask.array as da
X = sparse.random(50, 20, density=0.5, format="csr")
X_dask = da.from_array(X, chunks=(5, 20))
var_names_1 = [f"gene_{i}" for i in range(20)]
var_names_2 = [f"gene_{i}{'_foo' if (i % 2) else ''}" for i in range(20, 40)]
ad1 = AnnData(X=X, var=pd.DataFrame(index=var_names_1))
ad2 = AnnData(X=X, var=pd.DataFrame(index=var_names_2))
ad1_dask = AnnData(X=X_dask, var=pd.DataFrame(index=var_names_1))
ad2_dask = AnnData(X=X_dask, var=pd.DataFrame(index=var_names_2))
res_in_memory = concat([ad1, ad2], join=join_type, merge=merge_strategy)
res_dask = concat([ad1_dask, ad2_dask], join=join_type, merge=merge_strategy)
> assert_equal(res_in_memory, res_dask)
tests/test_concatenate.py:1698:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/nix/store/8w718rm43x7z73xhw9d6vh8s4snrq67h-python3-3.12.10/lib/python3.12/functools.py:912: in wrapper
return dispatch(args[0].__class__)(*args, **kw)
/nix/store/gx8cg2bcsqrpf6xdn1y97b440vzg7a98-python3.12-anndata-0.11.4/lib/python3.12/site-packages/anndata/tests/helpers.py:763: in assert_adata_equal
assert_equal(
/nix/store/8w718rm43x7z73xhw9d6vh8s4snrq67h-python3-3.12.10/lib/python3.12/functools.py:912: in wrapper
return dispatch(args[0].__class__)(*args, **kw)
/nix/store/gx8cg2bcsqrpf6xdn1y97b440vzg7a98-python3.12-anndata-0.11.4/lib/python3.12/site-packages/anndata/tests/helpers.py:603: in assert_equal_sparse
assert_equal(b, a, exact, elem_name=elem_name)
/nix/store/8w718rm43x7z73xhw9d6vh8s4snrq67h-python3-3.12.10/lib/python3.12/functools.py:912: in wrapper
return dispatch(args[0].__class__)(*args, **kw)
/nix/store/gx8cg2bcsqrpf6xdn1y97b440vzg7a98-python3.12-anndata-0.11.4/lib/python3.12/site-packages/anndata/tests/helpers.py:626: in assert_equal_dask_array
assert_equal(b, a.compute(), exact, elem_name)
/nix/store/8w718rm43x7z73xhw9d6vh8s4snrq67h-python3-3.12.10/lib/python3.12/functools.py:912: in wrapper
return dispatch(args[0].__class__)(*args, **kw)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
a = array([[0.49185692, 0.80075152, 0. , ..., 0.44680008, 0.45132325,
0.75241679],
[0. , 0.36... ],
[0. , 0. , 0. , ..., 0. , 0. ,
0. ]], shape=(100, 40))
b = array([[0.49185692, 0.80075152, 0. , ..., 0.44680008, 0.45132325,
0.75241679],
[0. , 0.36... ],
[0. , 0. , 0. , ..., 0. , 0. ,
0. ]], shape=(100, 40))
exact = False, elem_name = 'X'
@assert_equal.register(np.ndarray)
def assert_equal_ndarray(a, b, exact=False, elem_name=None):
b = asarray(b)
if not exact and is_numeric_dtype(a) and is_numeric_dtype(b):
assert a.shape == b.shape, format_msg(elem_name)
> np.testing.assert_allclose(a, b, equal_nan=True, err_msg=format_msg(elem_name))
E AssertionError:
E Not equal to tolerance rtol=1e-07, atol=0
E Error raised from element 'X'.
E Mismatched elements: 960 / 4000 (24%)
E Max absolute difference among violations: 0.98685819
E Max relative difference among violations: 1.
E ACTUAL: array([[0.491857, 0.800752, 0. , ..., 0.4468 , 0.451323, 0.752417],
E [0. , 0.363121, 0.167096, ..., 0.658385, 0. , 0. ],
E [0.978123, 0. , 0.048467, ..., 0.402111, 0.972809, 0. ],...
E DESIRED: array([[0.491857, 0.800752, 0. , ..., 0.4468 , 0.451323, 0.752417],
E [0. , 0.363121, 0.167096, ..., 0.658385, 0. , 0. ],
E [0.978123, 0. , 0.048467, ..., 0.402111, 0.972809, 0. ],...
/nix/store/gx8cg2bcsqrpf6xdn1y97b440vzg7a98-python3.12-anndata-0.11.4/lib/python3.12/site-packages/anndata/tests/helpers.py:577: AssertionError
_____________ test_concat_dask_sparse_matches_memory[outer-first] ______________
[gw6] linux -- Python 3.12.10 /nix/store/8w718rm43x7z73xhw9d6vh8s4snrq67h-python3-3.12.10/bin/python3.12
join_type = 'outer', merge_strategy = 'first'
def test_concat_dask_sparse_matches_memory(join_type, merge_strategy):
import dask.array as da
X = sparse.random(50, 20, density=0.5, format="csr")
X_dask = da.from_array(X, chunks=(5, 20))
var_names_1 = [f"gene_{i}" for i in range(20)]
var_names_2 = [f"gene_{i}{'_foo' if (i % 2) else ''}" for i in range(20, 40)]
ad1 = AnnData(X=X, var=pd.DataFrame(index=var_names_1))
ad2 = AnnData(X=X, var=pd.DataFrame(index=var_names_2))
ad1_dask = AnnData(X=X_dask, var=pd.DataFrame(index=var_names_1))
ad2_dask = AnnData(X=X_dask, var=pd.DataFrame(index=var_names_2))
res_in_memory = concat([ad1, ad2], join=join_type, merge=merge_strategy)
res_dask = concat([ad1_dask, ad2_dask], join=join_type, merge=merge_strategy)
> assert_equal(res_in_memory, res_dask)
tests/test_concatenate.py:1698:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/nix/store/8w718rm43x7z73xhw9d6vh8s4snrq67h-python3-3.12.10/lib/python3.12/functools.py:912: in wrapper
return dispatch(args[0].__class__)(*args, **kw)
/nix/store/gx8cg2bcsqrpf6xdn1y97b440vzg7a98-python3.12-anndata-0.11.4/lib/python3.12/site-packages/anndata/tests/helpers.py:763: in assert_adata_equal
assert_equal(
/nix/store/8w718rm43x7z73xhw9d6vh8s4snrq67h-python3-3.12.10/lib/python3.12/functools.py:912: in wrapper
return dispatch(args[0].__class__)(*args, **kw)
/nix/store/gx8cg2bcsqrpf6xdn1y97b440vzg7a98-python3.12-anndata-0.11.4/lib/python3.12/site-packages/anndata/tests/helpers.py:603: in assert_equal_sparse
assert_equal(b, a, exact, elem_name=elem_name)
/nix/store/8w718rm43x7z73xhw9d6vh8s4snrq67h-python3-3.12.10/lib/python3.12/functools.py:912: in wrapper
return dispatch(args[0].__class__)(*args, **kw)
/nix/store/gx8cg2bcsqrpf6xdn1y97b440vzg7a98-python3.12-anndata-0.11.4/lib/python3.12/site-packages/anndata/tests/helpers.py:626: in assert_equal_dask_array
assert_equal(b, a.compute(), exact, elem_name)
/nix/store/8w718rm43x7z73xhw9d6vh8s4snrq67h-python3-3.12.10/lib/python3.12/functools.py:912: in wrapper
return dispatch(args[0].__class__)(*args, **kw)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
a = array([[0. , 0. , 0.19887049, ..., 0. , 0.7312403 ,
0.64490901],
[0.62128482, 0.81... ],
[0. , 0. , 0. , ..., 0. , 0. ,
0. ]], shape=(100, 40))
b = array([[0. , 0. , 0.19887049, ..., 0. , 0.7312403 ,
0.64490901],
[0.62128482, 0.81...26854],
[0.41690112, 0.41690112, 0.41690112, ..., 0.41690112, 0.41690112,
0.41690112]], shape=(100, 40))
exact = False, elem_name = 'X'
@assert_equal.register(np.ndarray)
def assert_equal_ndarray(a, b, exact=False, elem_name=None):
b = asarray(b)
if not exact and is_numeric_dtype(a) and is_numeric_dtype(b):
assert a.shape == b.shape, format_msg(elem_name)
> np.testing.assert_allclose(a, b, equal_nan=True, err_msg=format_msg(elem_name))
E AssertionError:
E Not equal to tolerance rtol=1e-07, atol=0
E Error raised from element 'X'.
E Mismatched elements: 1000 / 4000 (25%)
E Max absolute difference among violations: 0.98371358
E Max relative difference among violations: 1.
E ACTUAL: array([[0. , 0. , 0.19887 , ..., 0. , 0.73124 , 0.644909],
E [0.621285, 0.811838, 0. , ..., 0. , 0. , 0. ],
E [0.334827, 0. , 0.761426, ..., 0. , 0. , 0.569355],...
E DESIRED: array([[0. , 0. , 0.19887 , ..., 0. , 0.73124 , 0.644909],
E [0.621285, 0.811838, 0. , ..., 0. , 0. , 0. ],
E [0.334827, 0. , 0.761426, ..., 0. , 0. , 0.569355],...
/nix/store/gx8cg2bcsqrpf6xdn1y97b440vzg7a98-python3.12-anndata-0.11.4/lib/python3.12/site-packages/anndata/tests/helpers.py:577: AssertionError
______________ test_concat_dask_sparse_matches_memory[outer-same] ______________
[gw3] linux -- Python 3.12.10 /nix/store/8w718rm43x7z73xhw9d6vh8s4snrq67h-python3-3.12.10/bin/python3.12
join_type = 'outer', merge_strategy = 'same'
def test_concat_dask_sparse_matches_memory(join_type, merge_strategy):
import dask.array as da
X = sparse.random(50, 20, density=0.5, format="csr")
X_dask = da.from_array(X, chunks=(5, 20))
var_names_1 = [f"gene_{i}" for i in range(20)]
var_names_2 = [f"gene_{i}{'_foo' if (i % 2) else ''}" for i in range(20, 40)]
ad1 = AnnData(X=X, var=pd.DataFrame(index=var_names_1))
ad2 = AnnData(X=X, var=pd.DataFrame(index=var_names_2))
ad1_dask = AnnData(X=X_dask, var=pd.DataFrame(index=var_names_1))
ad2_dask = AnnData(X=X_dask, var=pd.DataFrame(index=var_names_2))
res_in_memory = concat([ad1, ad2], join=join_type, merge=merge_strategy)
res_dask = concat([ad1_dask, ad2_dask], join=join_type, merge=merge_strategy)
> assert_equal(res_in_memory, res_dask)
tests/test_concatenate.py:1698:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/nix/store/8w718rm43x7z73xhw9d6vh8s4snrq67h-python3-3.12.10/lib/python3.12/functools.py:912: in wrapper
return dispatch(args[0].__class__)(*args, **kw)
/nix/store/gx8cg2bcsqrpf6xdn1y97b440vzg7a98-python3.12-anndata-0.11.4/lib/python3.12/site-packages/anndata/tests/helpers.py:763: in assert_adata_equal
assert_equal(
/nix/store/8w718rm43x7z73xhw9d6vh8s4snrq67h-python3-3.12.10/lib/python3.12/functools.py:912: in wrapper
return dispatch(args[0].__class__)(*args, **kw)
/nix/store/gx8cg2bcsqrpf6xdn1y97b440vzg7a98-python3.12-anndata-0.11.4/lib/python3.12/site-packages/anndata/tests/helpers.py:603: in assert_equal_sparse
assert_equal(b, a, exact, elem_name=elem_name)
/nix/store/8w718rm43x7z73xhw9d6vh8s4snrq67h-python3-3.12.10/lib/python3.12/functools.py:912: in wrapper
return dispatch(args[0].__class__)(*args, **kw)
/nix/store/gx8cg2bcsqrpf6xdn1y97b440vzg7a98-python3.12-anndata-0.11.4/lib/python3.12/site-packages/anndata/tests/helpers.py:626: in assert_equal_dask_array
assert_equal(b, a.compute(), exact, elem_name)
/nix/store/8w718rm43x7z73xhw9d6vh8s4snrq67h-python3-3.12.10/lib/python3.12/functools.py:912: in wrapper
return dispatch(args[0].__class__)(*args, **kw)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
a = array([[0. , 0. , 0. , ..., 0.11113551, 0. ,
0. ],
[0. , 0. ... ],
[0. , 0. , 0. , ..., 0. , 0. ,
0. ]], shape=(100, 40))
b = array([[0. , 0. , 0. , ..., 0.11113551, 0. ,
0. ],
[0. , 0. ... ],
[0. , 0. , 0. , ..., 0. , 0. ,
0. ]], shape=(100, 40))
exact = False, elem_name = 'X'
@assert_equal.register(np.ndarray)
def assert_equal_ndarray(a, b, exact=False, elem_name=None):
b = asarray(b)
if not exact and is_numeric_dtype(a) and is_numeric_dtype(b):
assert a.shape == b.shape, format_msg(elem_name)
> np.testing.assert_allclose(a, b, equal_nan=True, err_msg=format_msg(elem_name))
E AssertionError:
E Not equal to tolerance rtol=1e-07, atol=0
E Error raised from element 'X'.
E Mismatched elements: 1200 / 4000 (30%)
E Max absolute difference among violations: 0.91071644
E Max relative difference among violations: 1.
E ACTUAL: array([[0. , 0. , 0. , ..., 0.111136, 0. , 0. ],
E [0. , 0. , 0. , ..., 0.0323 , 0. , 0.686444],
E [0. , 0. , 0.329796, ..., 0. , 0. , 0.711879],...
E DESIRED: array([[0. , 0. , 0. , ..., 0.111136, 0. , 0. ],
E [0. , 0. , 0. , ..., 0.0323 , 0. , 0.686444],
E [0. , 0. , 0.329796, ..., 0. , 0. , 0.711879],...
/nix/store/gx8cg2bcsqrpf6xdn1y97b440vzg7a98-python3.12-anndata-0.11.4/lib/python3.12/site-packages/anndata/tests/helpers.py:577: AssertionError
_____________ test_concat_dask_sparse_matches_memory[outer-unique] _____________
[gw10] linux -- Python 3.12.10 /nix/store/8w718rm43x7z73xhw9d6vh8s4snrq67h-python3-3.12.10/bin/python3.12
join_type = 'outer', merge_strategy = 'unique'
def test_concat_dask_sparse_matches_memory(join_type, merge_strategy):
import dask.array as da
X = sparse.random(50, 20, density=0.5, format="csr")
X_dask = da.from_array(X, chunks=(5, 20))
var_names_1 = [f"gene_{i}" for i in range(20)]
var_names_2 = [f"gene_{i}{'_foo' if (i % 2) else ''}" for i in range(20, 40)]
ad1 = AnnData(X=X, var=pd.DataFrame(index=var_names_1))
ad2 = AnnData(X=X, var=pd.DataFrame(index=var_names_2))
ad1_dask = AnnData(X=X_dask, var=pd.DataFrame(index=var_names_1))
ad2_dask = AnnData(X=X_dask, var=pd.DataFrame(index=var_names_2))
res_in_memory = concat([ad1, ad2], join=join_type, merge=merge_strategy)
res_dask = concat([ad1_dask, ad2_dask], join=join_type, merge=merge_strategy)
> assert_equal(res_in_memory, res_dask)
tests/test_concatenate.py:1698:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/nix/store/8w718rm43x7z73xhw9d6vh8s4snrq67h-python3-3.12.10/lib/python3.12/functools.py:912: in wrapper
return dispatch(args[0].__class__)(*args, **kw)
/nix/store/gx8cg2bcsqrpf6xdn1y97b440vzg7a98-python3.12-anndata-0.11.4/lib/python3.12/site-packages/anndata/tests/helpers.py:763: in assert_adata_equal
assert_equal(
/nix/store/8w718rm43x7z73xhw9d6vh8s4snrq67h-python3-3.12.10/lib/python3.12/functools.py:912: in wrapper
return dispatch(args[0].__class__)(*args, **kw)
/nix/store/gx8cg2bcsqrpf6xdn1y97b440vzg7a98-python3.12-anndata-0.11.4/lib/python3.12/site-packages/anndata/tests/helpers.py:603: in assert_equal_sparse
assert_equal(b, a, exact, elem_name=elem_name)
/nix/store/8w718rm43x7z73xhw9d6vh8s4snrq67h-python3-3.12.10/lib/python3.12/functools.py:912: in wrapper
return dispatch(args[0].__class__)(*args, **kw)
/nix/store/gx8cg2bcsqrpf6xdn1y97b440vzg7a98-python3.12-anndata-0.11.4/lib/python3.12/site-packages/anndata/tests/helpers.py:626: in assert_equal_dask_array
assert_equal(b, a.compute(), exact, elem_name)
/nix/store/8w718rm43x7z73xhw9d6vh8s4snrq67h-python3-3.12.10/lib/python3.12/functools.py:912: in wrapper
return dispatch(args[0].__class__)(*args, **kw)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
a = array([[0. , 0.07460714, 0.99435318, ..., 0.27412182, 0.94525043,
0. ],
[0.72860887, 0.82... ],
[0. , 0. , 0. , ..., 0. , 0. ,
0. ]], shape=(100, 40))
b = array([[0. , 0.07460714, 0.99435318, ..., 0.27412182, 0.94525043,
0. ],
[0.72860887, 0.82... ],
[0. , 0. , 0. , ..., 0. , 0. ,
0. ]], shape=(100, 40))
exact = False, elem_name = 'X'
@assert_equal.register(np.ndarray)
def assert_equal_ndarray(a, b, exact=False, elem_name=None):
b = asarray(b)
if not exact and is_numeric_dtype(a) and is_numeric_dtype(b):
assert a.shape == b.shape, format_msg(elem_name)
> np.testing.assert_allclose(a, b, equal_nan=True, err_msg=format_msg(elem_name))
E AssertionError:
E Not equal to tolerance rtol=1e-07, atol=0
E Error raised from element 'X'.
E Mismatched elements: 1080 / 4000 (27%)
E Max absolute difference among violations: 0.98764861
E Max relative difference among violations: 1.
E ACTUAL: array([[0. , 0.074607, 0.994353, ..., 0.274122, 0.94525 , 0. ],
E [0.728609, 0.823608, 0.024851, ..., 0. , 0. , 0.762479],
E [0.133786, 0. , 0. , ..., 0.431116, 0.621803, 0. ],...
E DESIRED: array([[0. , 0.074607, 0.994353, ..., 0.274122, 0.94525 , 0. ],
E [0.728609, 0.823608, 0.024851, ..., 0. , 0. , 0.762479],
E [0.133786, 0. , 0. , ..., 0.431116, 0.621803, 0. ],...
/nix/store/gx8cg2bcsqrpf6xdn1y97b440vzg7a98-python3.12-anndata-0.11.4/lib/python3.12/site-packages/anndata/tests/helpers.py:577: AssertionError
______________ test_concat_dask_sparse_matches_memory[outer-None] ______________
[gw4] linux -- Python 3.12.10 /nix/store/8w718rm43x7z73xhw9d6vh8s4snrq67h-python3-3.12.10/bin/python3.12
join_type = 'outer', merge_strategy = None
def test_concat_dask_sparse_matches_memory(join_type, merge_strategy):
import dask.array as da
X = sparse.random(50, 20, density=0.5, format="csr")
X_dask = da.from_array(X, chunks=(5, 20))
var_names_1 = [f"gene_{i}" for i in range(20)]
var_names_2 = [f"gene_{i}{'_foo' if (i % 2) else ''}" for i in range(20, 40)]
ad1 = AnnData(X=X, var=pd.DataFrame(index=var_names_1))
ad2 = AnnData(X=X, var=pd.DataFrame(index=var_names_2))
ad1_dask = AnnData(X=X_dask, var=pd.DataFrame(index=var_names_1))
ad2_dask = AnnData(X=X_dask, var=pd.DataFrame(index=var_names_2))
res_in_memory = concat([ad1, ad2], join=join_type, merge=merge_strategy)
res_dask = concat([ad1_dask, ad2_dask], join=join_type, merge=merge_strategy)
> assert_equal(res_in_memory, res_dask)
tests/test_concatenate.py:1698:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/nix/store/8w718rm43x7z73xhw9d6vh8s4snrq67h-python3-3.12.10/lib/python3.12/functools.py:912: in wrapper
return dispatch(args[0].__class__)(*args, **kw)
/nix/store/gx8cg2bcsqrpf6xdn1y97b440vzg7a98-python3.12-anndata-0.11.4/lib/python3.12/site-packages/anndata/tests/helpers.py:763: in assert_adata_equal
assert_equal(
/nix/store/8w718rm43x7z73xhw9d6vh8s4snrq67h-python3-3.12.10/lib/python3.12/functools.py:912: in wrapper
return dispatch(args[0].__class__)(*args, **kw)
/nix/store/gx8cg2bcsqrpf6xdn1y97b440vzg7a98-python3.12-anndata-0.11.4/lib/python3.12/site-packages/anndata/tests/helpers.py:603: in assert_equal_sparse
assert_equal(b, a, exact, elem_name=elem_name)
/nix/store/8w718rm43x7z73xhw9d6vh8s4snrq67h-python3-3.12.10/lib/python3.12/functools.py:912: in wrapper
return dispatch(args[0].__class__)(*args, **kw)
/nix/store/gx8cg2bcsqrpf6xdn1y97b440vzg7a98-python3.12-anndata-0.11.4/lib/python3.12/site-packages/anndata/tests/helpers.py:626: in assert_equal_dask_array
assert_equal(b, a.compute(), exact, elem_name)
/nix/store/8w718rm43x7z73xhw9d6vh8s4snrq67h-python3-3.12.10/lib/python3.12/functools.py:912: in wrapper
return dispatch(args[0].__class__)(*args, **kw)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
a = array([[0.1670273 , 0.13994276, 0. , ..., 0. , 0.52708125,
0.47794564],
[0.69553034, 0.35... ],
[0. , 0. , 0. , ..., 0. , 0. ,
0. ]], shape=(100, 40))
b = array([[0.1670273 , 0.13994276, 0. , ..., 0. , 0.52708125,
0.47794564],
[0.69553034, 0.35... ],
[0. , 0. , 0. , ..., 0. , 0. ,
0. ]], shape=(100, 40))
exact = False, elem_name = 'X'
@assert_equal.register(np.ndarray)
def assert_equal_ndarray(a, b, exact=False, elem_name=None):
b = asarray(b)
if not exact and is_numeric_dtype(a) and is_numeric_dtype(b):
assert a.shape == b.shape, format_msg(elem_name)
> np.testing.assert_allclose(a, b, equal_nan=True, err_msg=format_msg(elem_name))
E AssertionError:
E Not equal to tolerance rtol=1e-07, atol=0
E Error raised from element 'X'.
E Mismatched elements: 800 / 4000 (20%)
E Max absolute difference among violations: 0.97629641
E Max relative difference among violations: 1.
E ACTUAL: array([[0.167027, 0.139943, 0. , ..., 0. , 0.527081, 0.477946],
E [0.69553 , 0.355393, 0.331071, ..., 0. , 0.360402, 0. ],
E [0. , 0.906914, 0. , ..., 0. , 0. , 0. ],...
E DESIRED: array([[0.167027, 0.139943, 0. , ..., 0. , 0.527081, 0.477946],
E [0.69553 , 0.355393, 0.331071, ..., 0. , 0.360402, 0. ],
E [0. , 0.906914, 0. , ..., 0. , 0. , 0. ],...
/nix/store/gx8cg2bcsqrpf6xdn1y97b440vzg7a98-python3.12-anndata-0.11.4/lib/python3.12/site-packages/anndata/tests/helpers.py:577: AssertionError
=============================== warnings summary ===============================
tests/test_backed_dense.py::test_assign_x_subset[h5ad]
tests/test_backed_dense.py::test_assign_x_subset[zarr]
/build/source/tests/test_backed_dense.py:88: ImplicitModificationWarning: Modifying `X` on a view results in data being overridden
view.X = np.zeros((4, 2))
tests/test_base.py: 5 warnings
tests/test_readwrite.py: 12 warnings
tests/test_views.py: 1 warning
/nix/store/gx8cg2bcsqrpf6xdn1y97b440vzg7a98-python3.12-anndata-0.11.4/lib/python3.12/site-packages/anndata/_core/aligned_df.py:68: ImplicitModificationWarning: Transforming to str index.
warnings.warn("Transforming to str index.", ImplicitModificationWarning)
tests/test_concatenate.py: 43 warnings
tests/test_concatenate_disk.py: 104 warnings
tests/test_utils.py: 1 warning
/nix/store/gx8cg2bcsqrpf6xdn1y97b440vzg7a98-python3.12-anndata-0.11.4/lib/python3.12/site-packages/anndata/_core/anndata.py:1756: UserWarning: Observation names are not unique. To make them unique, call `.obs_names_make_unique`.
utils.warn_names_duplicates("obs")
tests/test_concatenate.py::test_concatenate_obsm_outer[3.141592653589793]
tests/test_concatenate.py::test_concatenate_obsm_outer[nan]
tests/test_concatenate.py::test_concatenate_fill_value[3.141592653589793]
tests/test_concatenate.py::test_concatenate_fill_value[nan]
/nix/store/8f9zfpbmybfl09aq4a9nzp8a9gwgqjbf-python3.12-scipy-1.15.3/lib/python3.12/site-packages/scipy/sparse/_index.py:210: SparseEfficiencyWarning: Changing the sparsity structure of a csc_matrix is expensive. lil and dok are more efficient.
self._set_arrayXarray(i, j, x)
tests/test_concatenate.py: 9 warnings
tests/test_concatenate_disk.py: 96 warnings
tests/test_utils.py: 1 warning
/nix/store/gx8cg2bcsqrpf6xdn1y97b440vzg7a98-python3.12-anndata-0.11.4/lib/python3.12/site-packages/anndata/_core/anndata.py:1758: UserWarning: Variable names are not unique. To make them unique, call `.var_names_make_unique`.
utils.warn_names_duplicates("var")
tests/test_concatenate.py::test_concatenate_fill_value[3.141592653589793]
tests/test_concatenate.py::test_concatenate_fill_value[nan]
/nix/store/8f9zfpbmybfl09aq4a9nzp8a9gwgqjbf-python3.12-scipy-1.15.3/lib/python3.12/site-packages/scipy/sparse/_index.py:210: SparseEfficiencyWarning: Changing the sparsity structure of a csc_array is expensive. lil and dok are more efficient.
self._set_arrayXarray(i, j, x)
tests/test_helpers.py::test_assert_equal_raw
/nix/store/8f9zfpbmybfl09aq4a9nzp8a9gwgqjbf-python3.12-scipy-1.15.3/lib/python3.12/site-packages/scipy/sparse/_index.py:168: SparseEfficiencyWarning: Changing the sparsity structure of a csr_matrix is expensive. lil and dok are more efficient.
self._set_intXint(row, col, x.flat[0])
tests/test_views.py::test_views
/build/source/tests/test_views.py:114: ImplicitModificationWarning: Modifying `X` on a view results in data being overridden
adata[:2, 0].X = [0, 0]
tests/test_x.py::test_repeat_indices_view
/build/source/tests/test_x.py:53: ImplicitModificationWarning: Modifying `X` on a view results in data being overridden
subset.X = mat
tests/test_x.py: 21 warnings
/build/source/tests/test_x.py:66: ImplicitModificationWarning: Modifying `X` on a view results in data being overridden
view.X = to_assign
tests/test_x.py::test_setter_view[csr-csr]
tests/test_x.py::test_setter_view[csr_array-csr]
tests/test_x.py::test_setter_view[csc-csr]
tests/test_x.py::test_setter_view[ndarray-csr]
tests/test_x.py::test_setter_view[csc_array-csr]
/nix/store/8f9zfpbmybfl09aq4a9nzp8a9gwgqjbf-python3.12-scipy-1.15.3/lib/python3.12/site-packages/scipy/sparse/_index.py:201: SparseEfficiencyWarning: Changing the sparsity structure of a csr_matrix is expensive. lil and dok are more efficient.
self._set_arrayXarray_sparse(i, j, x)
tests/test_x.py::test_setter_view[csc-csc_array]
tests/test_x.py::test_setter_view[csr-csc_array]
tests/test_x.py::test_setter_view[csr_array-csc_array]
tests/test_x.py::test_setter_view[csc_array-csc_array]
tests/test_x.py::test_setter_view[ndarray-csc_array]
/nix/store/8f9zfpbmybfl09aq4a9nzp8a9gwgqjbf-python3.12-scipy-1.15.3/lib/python3.12/site-packages/scipy/sparse/_index.py:201: SparseEfficiencyWarning: Changing the sparsity structure of a csc_array is expensive. lil and dok are more efficient.
self._set_arrayXarray_sparse(i, j, x)
tests/test_x.py::test_setter_view[csr-csr_array]
tests/test_x.py::test_setter_view[csc-csr_array]
tests/test_x.py::test_setter_view[csc_array-csr_array]
tests/test_x.py::test_setter_view[ndarray-csr_array]
tests/test_x.py::test_setter_view[csr_array-csr_array]
/nix/store/8f9zfpbmybfl09aq4a9nzp8a9gwgqjbf-python3.12-scipy-1.15.3/lib/python3.12/site-packages/scipy/sparse/_index.py:201: SparseEfficiencyWarning: Changing the sparsity structure of a csr_array is expensive. lil and dok are more efficient.
self._set_arrayXarray_sparse(i, j, x)
tests/test_x.py::test_setter_view[csc_array-csc]
tests/test_x.py::test_setter_view[ndarray-csc]
tests/test_x.py::test_setter_view[csr_array-csc]
tests/test_x.py::test_setter_view[csc-csc]
tests/test_x.py::test_setter_view[csr-csc]
/nix/store/8f9zfpbmybfl09aq4a9nzp8a9gwgqjbf-python3.12-scipy-1.15.3/lib/python3.12/site-packages/scipy/sparse/_index.py:201: SparseEfficiencyWarning: Changing the sparsity structure of a csc_matrix is expensive. lil and dok are more efficient.
self._set_arrayXarray_sparse(i, j, x)
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
FAILED tests/test_concatenate.py::test_concat_dask_sparse_matches_memory[outer-only] - AssertionError:
FAILED tests/test_concatenate.py::test_concat_dask_sparse_matches_memory[outer-first] - AssertionError:
FAILED tests/test_concatenate.py::test_concat_dask_sparse_matches_memory[outer-same] - AssertionError:
FAILED tests/test_concatenate.py::test_concat_dask_sparse_matches_memory[outer-unique] - AssertionError:
FAILED tests/test_concatenate.py::test_concat_dask_sparse_matches_memory[outer-None] - AssertionError:
= 5 failed, 3265 passed, 23 skipped, 74 xfailed, 324 warnings in 89.90s (0:01:29) =
error: builder for '/nix/store/swwnk1mhz2wfxy75asx67zjg2qkhi8di-python3.12-anndata-0.11.4.drv' failed with exit code 1;
last 25 log lines:
>
> tests/test_x.py::test_setter_view[csr-csr_array]
> tests/test_x.py::test_setter_view[csc-csr_array]
> tests/test_x.py::test_setter_view[csc_array-csr_array]
> tests/test_x.py::test_setter_view[ndarray-csr_array]
> tests/test_x.py::test_setter_view[csr_array-csr_array]
> /nix/store/8f9zfpbmybfl09aq4a9nzp8a9gwgqjbf-python3.12-scipy-1.15.3/lib/python3.12/site-packages/scipy/sparse/_index.py:201: SparseEfficiencyWarning: Changing the sparsity structure of a csr_array is expensive. lil and dok are more efficient.
> self._set_arrayXarray_sparse(i, j, x)
>
> tests/test_x.py::test_setter_view[csc_array-csc]
> tests/test_x.py::test_setter_view[ndarray-csc]
> tests/test_x.py::test_setter_view[csr_array-csc]
> tests/test_x.py::test_setter_view[csc-csc]
> tests/test_x.py::test_setter_view[csr-csc]
> /nix/store/8f9zfpbmybfl09aq4a9nzp8a9gwgqjbf-python3.12-scipy-1.15.3/lib/python3.12/site-packages/scipy/sparse/_index.py:201: SparseEfficiencyWarning: Changing the sparsity structure of a csc_matrix is expensive. lil and dok are more efficient.
> self._set_arrayXarray_sparse(i, j, x)
>
> -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
> =========================== short test summary info ============================
> FAILED tests/test_concatenate.py::test_concat_dask_sparse_matches_memory[outer-only] - AssertionError:
> FAILED tests/test_concatenate.py::test_concat_dask_sparse_matches_memory[outer-first] - AssertionError:
> FAILED tests/test_concatenate.py::test_concat_dask_sparse_matches_memory[outer-same] - AssertionError:
> FAILED tests/test_concatenate.py::test_concat_dask_sparse_matches_memory[outer-unique] - AssertionError:
> FAILED tests/test_concatenate.py::test_concat_dask_sparse_matches_memory[outer-None] - AssertionError:
> = 5 failed, 3265 passed, 23 skipped, 74 xfailed, 324 warnings in 89.90s (0:01:29) =
For full logs, run:
nix log /nix/store/swwnk1mhz2wfxy75asx67zjg2qkhi8di-python3.12-anndata-0.11.4.drv
nixpkgs on  samuela/scanpy [!?] took 1m49s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment