scipy.spatial.sKDTree does not have a keyword argument 'n_jobs'
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.6k
- Forks
- 779
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 27
Description
- 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 master branch of scanpy.
Note: Please read this guide detailing how to provide the necessary information for us to reproduce your bug.
Minimal code sample (that we can copy&paste without having any data)
sce.pp.mnn_correct(adata_ref_batch0, adata_ref_batch1, adata_ref_batch2, batch_categories = ['batch0', 'batch1', 'batch2'])

---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
/tmp/ipykernel_1797574/3779544909.py in <module>
----> 1 sce.pp.mnn_correct(adata_ref_batch0, adata_ref_batch1, adata_ref_batch2, batch_categories = ['batch0', 'batch1', 'batch2'])
/mnt/md0/jin/anaconda3/lib/python3.9/site-packages/scanpy/external/pp/_mnn_correct.py in mnn_correct(var_index, var_subset, batch_key, index_unique, batch_categories, k, sigma, cos_norm_in, cos_norm_out, svd_dim, var_adj, compute_angle, mnn_order, svd_mode, do_concatenate, save_raw, n_jobs, *datas, **kwargs)
133
134 n_jobs = settings.n_jobs if n_jobs is None else n_jobs
--> 135 datas, mnn_list, angle_list = mnn_correct(
136 *datas,
137 var_index=var_index,
/mnt/md0/jin/anaconda3/lib/python3.9/site-packages/mnnpy/mnn.py in mnn_correct(var_index, var_subset, batch_key, index_unique, batch_categories, k, sigma, cos_norm_in, cos_norm_out, svd_dim, var_adj, compute_angle, mnn_order, svd_mode, do_concatenate, save_raw, n_jobs, *datas, **kwargs)
120 if var_subset is not None and set(adata_vars) == set(var_subset):
121 var_subset = None
--> 122 corrected = mnn_correct(*(adata.X for adata in datas), var_index=adata_vars,
123 var_subset=var_subset, k=k, sigma=sigma, cos_norm_in=cos_norm_in,
124 cos_norm_out=cos_norm_out, svd_dim=svd_dim, var_adj=var_adj,
/mnt/md0/jin/anaconda3/lib/python3.9/site-packages/mnnpy/mnn.py in mnn_correct(var_index, var_subset, batch_key, index_unique, batch_categories, k, sigma, cos_norm_in, cos_norm_out, svd_dim, var_adj, compute_angle, mnn_order, svd_mode, do_concatenate, save_raw, n_jobs, *datas, **kwargs)
176 new_batch_out = out_batches[target]
177 print(' Looking for MNNs...')
--> 178 mnn_ref, mnn_new = find_mutual_nn(data1=ref_batch_in, data2=new_batch_in, k1=k, k2=k,
179 n_jobs=n_jobs)
180 print(' Computing correction vectors...')
_ckdtree.pyx in scipy.spatial._ckdtree.cKDTree.query()
_ckdtree.pyx in scipy.spatial._ckdtree.get_num_workers()
TypeError: Unexpected keyword argument {'n_jobs': 48}
---------------------------------------------------------------------------
Versions
python 3.9
[Paste the output of scanpy.logging.print_versions() leaving a blank line after the details tag]
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with scanpy/external/pp/_mnn_correct.py and the mnnpy/mnn.py call shown in the traceback, then reproduce the provided sce.pp.mnn_correct example with the relevant SciPy version. Check how n_jobs reaches scipy.spatial.sKDTree and identify the compatibility boundary. Done means the example no longer raises this keyword-argument error and regression coverage verifies the supported behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- bioinformatics
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100