chriscainx / mnnpy

An implementation of MNN (Mutual Nearest Neighbors) correct in python.
BSD 3-Clause "New" or "Revised" License
71 stars 31 forks source link

scipy cKDTree: `n_jobs` has been renamed `workers` #49

Open alexlenail opened 2 years ago

alexlenail commented 2 years ago
File ~/.conda/envs/py39/lib/python3.9/site-packages/mnnpy/mnn.py:178, 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...')
    181 correction_in = compute_correction(ref_batch_in, new_batch_in, mnn_ref, mnn_new,
    182                                    new_batch_in, sigma)

File _ckdtree.pyx:786, in scipy.spatial._ckdtree.cKDTree.query()

File _ckdtree.pyx:390, in scipy.spatial._ckdtree.get_num_workers()

TypeError: Unexpected keyword argument {'n_jobs': 96}

From https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.cKDTree.query.html

The “n_jobs” argument was renamed “workers”. The old name “n_jobs” was deprecated in SciPy 1.6.0 and was removed in SciPy 1.9.0.

CowanCS1 commented 1 year ago

Yeah, just hit this as well. Temporarily switching to scipy=1.8.1, which I can confirm works fine, but this should be an easy quick fix and pull request if someone has a moment.