Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

`ingest` fails with pynndescent 0.7

Aperta Adatta ai principianti
#4,450 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@eroell ci sta già lavorando.

Dal 28/10/2026.

  • #4451 di @eroell — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
68/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
numpy, python

Direzione di ricerca

Inizia da scanpy/tools/_ingest.py, in particolare da Ingest._init_pynndescent, e segui come passa NNDescent.n_search_trees a make_forest. Riproduci il problema con lo script minimo fornito usando pynndescent 0.7.0, poi verifica che sc.tl.ingest venga eseguito correttamente e che i test ingest esistenti continuino a passare.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Triage 🩺
Please make sure these conditions are met
  • I have checked that this issue has not already been reported.
  • I have confirmed this bug exists on the latest version of scanpy.
  • (optional) I have confirmed this bug exists on the main branch of scanpy.
What happened?

pynndescent 0.7.0 deprecated NNDescent.n_search_trees (now None), and the make_forest workaround in Ingest._init_pynndescent passes it on. Works with pynndescent 0.6.0. Related: #4444

Minimal code sample
# /// script
# requires-python = ">=3.13"
# dependencies = [
#   "scanpy@git+https://github.com/scverse/scanpy.git@main",
# ]
# ///
#
# This script automatically imports the development branch of scanpy to check for issues

import anndata as ad
import numpy as np
import scanpy as sc

adata = ad.AnnData(np.random.default_rng(0).normal(size=(300, 20)).astype(np.float32))
adata_ref, adata_new = adata[:200].copy(), adata[200:].copy()
sc.pp.pca(adata_ref)
sc.pp.neighbors(adata_ref)
sc.tl.umap(adata_ref)
sc.tl.ingest(adata_new, adata_ref)
Error output
Traceback (most recent call last):
  File "issue_repro.py", line 19, in <module>
    sc.tl.ingest(adata_new, adata_ref)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
  File ".../site-packages/scanpy/tools/_ingest.py", line 139, in ingest
    ing = Ingest(adata_ref, neighbors_key)
  File ".../site-packages/scanpy/tools/_ingest.py", line 376, in __init__
    self._init_neighbors(adata, neighbors_key)
    ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
  File ".../site-packages/scanpy/tools/_ingest.py", line 323, in _init_neighbors
    self._init_pynndescent(
    ~~~~~~~~~~~~~~~~~~~~~~^
        neighbors["distances"], rng=self._get_rng(neighbors["params"])
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File ".../site-packages/scanpy/tools/_ingest.py", line 290, in _init_pynndescent
    self._nnd_idx._rp_forest = make_forest(
                               ~~~~~~~~~~~^
        self._nnd_idx._raw_data,
        ^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
        self._nnd_idx._angular_trees,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File ".../site-packages/pynndescent/rp_trees.py", line 3020, in make_forest
    rng_states = random_state.randint(INT32_MIN, INT32_MAX, size=(n_trees, 3)).astype(
                 ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "numpy/random/mtrand.pyx", line 801, in numpy.random.mtrand.RandomState.randint
  File "numpy/random/_bounded_integers.pyx", line 1315, in numpy.random._bounded_integers._rand_int64
  File ".../site-packages/numpy/_core/fromnumeric.py", line 3442, in prod
    return _wrapreduction(a, np.multiply, 'prod', axis, dtype, out,
                          keepdims=keepdims, initial=initial, where=where)
  File ".../site-packages/numpy/_core/fromnumeric.py", line 83, in _wrapreduction
    return ufunc.reduce(obj, axis, dtype, out, **passkwargs)
           ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: unsupported operand type(s) for *: 'NoneType' and 'int'
Versions

pynndescent 0.7.0, umap-learn 0.5.12 (not listed by print_versions)

scanpy	1.14.0.dev35+g6f523e64e
----	----
pandas	3.1.0
cloudpickle	3.1.2
python-dateutil	3.0.0
pydantic_core	2.50.1
llvmlite	0.50.0
scikit-learn	1.9.1
fast-array-utils	1.5.1
anndata	0.13.4
msgspec	0.22.0
narwhals	2.28.0
scipy	1.18.1
joblib	1.6.0
zarr	3.4.2
packaging	26.3
matplotlib	3.11.2
PyYAML	6.0.3
scverse-misc	0.1.7
cycler	0.12.1
numcodecs	0.17.1
annotated-types	0.8.0
pydantic-settings	2.16.1
charset-normalizer	3.5.2
typing-inspection	0.4.4
donfig	0.8.1.post1
pyparsing	3.3.3
pillow	13.0.0
python-dotenv	1.2.4
numba	0.68.1
typing_extensions	4.16.0
google-crc32c	1.9.0
fonttools	4.68.0
pydantic	2.14.1
natsort	8.4.0
h5py	3.16.0
session-info2	0.4.2
legacy-api-wrap	1.5
threadpoolctl	3.7.0
six	1.17.0
numpy	2.5.4
kiwisolver	1.5.1
----	----
Python	3.14.3 (main, Mar 10 2026, 18:18:50) [Clang 21.1.4 ]
OS	Linux-6.12.0-211.47.1.el10_2.x86_64-x86_64-with-glibc2.39
CPU	8/96 logical CPU cores
GPU	No GPU found
Updated	2026-10-28 08:57
Lingua principale
Python
Stelle
2.6k
Fork
808
Merge medio
1g 8h
PR unite (30g)
17

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di scverse/scanpy

Tutte le issue di scverse/scanpy

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.