Untyped global name 'nearest_neighbors'
See original GitHub issueWith the most recent version of scanpy, I’m getting the above mentioned warning, which causes the dynverse/ti_paga
builds to fail.
The problem can be replicated by building the dynverse/ti_paga
container manually and trying to run it. For the sake of simplicity, I have built the container for you and pushed it to dynverse/ti_paga_issue
.
Minimum reproducible example
Inside terminal:
# fetch newest dynverse/ti_paga container in which this problem occurs
docker pull dynverse/ti_paga_issue
# enter the container
docker run --entrypoint bash -it dynverse/ti_paga_issue
# create an example dataset and save it at /input.h5
/code/example.sh /input.h5
# enter python
python
Inside python
import dynclipy
task = dynclipy.main(["--dataset", "/input.h5", "--output", "/output.h5"])
import scanpy.api as sc
import anndata
counts = task["counts"]
adata = anndata.AnnData(counts)
sc.pp.recipe_zheng17(adata, n_top_genes=101)
sc.tl.pca(adata, n_comps=50)
sc.pp.neighbors(adata, n_neighbors=15)
Which generates the following warning:
/usr/local/lib/python3.7/site-packages/umap/umap_.py:349: NumbaWarning:
Compilation is falling back to object mode WITH looplifting enabled because Function "fuzzy_simplicial_set" failed type inference due to: Untyped global name 'nearest_neighbors': cannot determine Numba type of <class 'function'>
File "usr/local/lib/python3.7/site-packages/umap/umap_.py", line 467:
def fuzzy_simplicial_set(
<source elided>
if knn_indices is None or knn_dists is None:
knn_indices, knn_dists, _ = nearest_neighbors(
^
@numba.jit()
/usr/local/lib/python3.7/site-packages/numba/compiler.py:725: NumbaWarning: Function "fuzzy_simplicial_set" was compiled in object mode without forceobj=True.
File "usr/local/lib/python3.7/site-packages/umap/umap_.py", line 350:
@numba.jit()
def fuzzy_simplicial_set(
^
self.func_ir.loc))
/usr/local/lib/python3.7/site-packages/numba/compiler.py:734: NumbaDeprecationWarning:
Fall-back from the nopython compilation path to the object mode compilation path has been detected, this is deprecated behaviour.
For more information visit http://numba.pydata.org/numba-doc/latest/reference/deprecation.html#deprecation-of-object-mode-fall-back-behaviour-when-using-jit
File "usr/local/lib/python3.7/site-packages/umap/umap_.py", line 350:
@numba.jit()
def fuzzy_simplicial_set(
^
warnings.warn(errors.NumbaDeprecationWarning(msg, self.func_ir.loc))
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:6 (5 by maintainers)
Top Results From Across the Web
Untyped global name 'nearest_neighbors' · Issue #688 - GitHub
The problem can be replicated by building the dynverse/ti_paga container manually and trying to run it. For the sake of simplicity, I have...
Read more >sklearn.neighbors.NearestNeighbors
Algorithm used to compute the nearest neighbors: ... This works for Scipy's metrics, but is less efficient than passing the metric name as...
Read more >can't import nearest neighbors in scikit-learn 0.16
I will give it a try. I am using sklearn 0.14 with python2.7 with no problems. – xhm7. May 8, 2015 at 12:59....
Read more >Numba: How to solve "Untyped global name 'object' - Reddit
I read a post about numba and tried to implement it in my code to accelerate it. But I encountered a problem that...
Read more >K-Nearest-Neighbors in 6 steps. With scikit-learn in python
This aims to be an applied guide to utilizing the K-Nearest-Neighbors (KNN) method for ... X_fruits = fruits[feature_names_fruits] #setting the col names
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thanks @flying-sheep! I will suppress the warning this way.
Makes sense, thanks for clarifying. This issue is then related to lmcinnes/umap#252.
@flying-sheep @lmcinnes Is there any way I can turn these specific warnings off?