question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

scanpy sc.pp.calculate_qc_metrics(adata, qc_vars=["mt"], inplace=True)

See original GitHub issue

After I use function

adata = sc.read_visium(
    './', count_file='V1_Human_Lymph_Node_filtered_feature_bc_matrix.h5',
    genome=None, library_id=None, load_images=True,
)

I use sc.pp.calculate_qc_metrics(adata, qc_vars=["mt"], inplace=True) and got an error message:

RuntimeError                              Traceback (most recent call last)
~\AppData\Local\Continuum\anaconda3\lib\site-packages\numba\core\errors.py in new_error_context(fmt_, *args, **kwargs)
    744     try:
--> 745         yield
    746     except NumbaError as e:

~\AppData\Local\Continuum\anaconda3\lib\site-packages\numba\core\lowering.py in lower_block(self, block)
    272                                    loc=self.loc, errcls_=defaulterrcls):
--> 273                 self.lower_inst(inst)
    274         self.post_block(block)

~\AppData\Local\Continuum\anaconda3\lib\site-packages\numba\core\lowering.py in lower_inst(self, inst)
    485                 if isinstance(inst, _class):
--> 486                     func(self, inst)
    487                     return

~\AppData\Local\Continuum\anaconda3\lib\site-packages\numba\parfors\parfor_lowering.py in _lower_parfor_parallel(lowerer, parfor)
    239             lowerer, parfor, typemap, typingctx, targetctx, flags, {},
--> 240             bool(alias_map), index_var_typ, parfor.races)
    241     finally:

~\AppData\Local\Continuum\anaconda3\lib\site-packages\numba\parfors\parfor_lowering.py in _create_gufunc_for_parfor_body(lowerer, parfor, typemap, typingctx, targetctx, flags, locals, has_aliases, index_var_typ, races)
   1326         flags,
-> 1327         locals)
   1328 

~\AppData\Local\Continuum\anaconda3\lib\site-packages\numba\core\compiler.py in compile_ir(typingctx, targetctx, func_ir, args, return_type, flags, locals, lifted, lifted_from, is_lifted_loop, library, pipeline_class)
    666         return pipeline.compile_ir(func_ir=func_ir, lifted=lifted,
--> 667                                    lifted_from=lifted_from)
    668 

~\AppData\Local\Continuum\anaconda3\lib\site-packages\numba\core\compiler.py in compile_ir(self, func_ir, lifted, lifted_from)
    348         FixupArgs().run_pass(self.state)
--> 349         return self._compile_ir()
    350 

~\AppData\Local\Continuum\anaconda3\lib\site-packages\numba\core\compiler.py in _compile_ir(self)
    407         assert self.state.func_ir is not None
--> 408         return self._compile_core()
    409 

~\AppData\Local\Continuum\anaconda3\lib\site-packages\numba\core\compiler.py in _compile_core(self)
    380                 if is_final_pipeline:
--> 381                     raise e
    382         else:

~\AppData\Local\Continuum\anaconda3\lib\site-packages\numba\core\compiler.py in _compile_core(self)
    371             try:
--> 372                 pm.run(self.state)
    373                 if self.state.cr is not None:

~\AppData\Local\Continuum\anaconda3\lib\site-packages\numba\core\compiler_machinery.py in run(self, state)
    340                 patched_exception = self._patch_error(msg, e)
--> 341                 raise patched_exception
    342 

~\AppData\Local\Continuum\anaconda3\lib\site-packages\numba\core\compiler_machinery.py in run(self, state)
    331                 if isinstance(pass_inst, CompilerPass):
--> 332                     self._runPass(idx, pass_inst, state)
    333                 else:

~\AppData\Local\Continuum\anaconda3\lib\site-packages\numba\core\compiler_lock.py in _acquire_compile_lock(*args, **kwargs)
     31             with self:
---> 32                 return func(*args, **kwargs)
     33         return _acquire_compile_lock

~\AppData\Local\Continuum\anaconda3\lib\site-packages\numba\core\compiler_machinery.py in _runPass(self, index, pss, internal_state)
    290         with SimpleTimer() as pass_time:
--> 291             mutated |= check(pss.run_pass, internal_state)
    292         with SimpleTimer() as finalize_time:

~\AppData\Local\Continuum\anaconda3\lib\site-packages\numba\core\compiler_machinery.py in check(func, compiler_state)
    263         def check(func, compiler_state):
--> 264             mangled = func(compiler_state)
    265             if mangled not in (True, False):

~\AppData\Local\Continuum\anaconda3\lib\site-packages\numba\core\typed_passes.py in run_pass(self, state)
    441         # TODO: Pull this out into the pipeline
--> 442         NativeLowering().run_pass(state)
    443         lowered = state['cr']

~\AppData\Local\Continuum\anaconda3\lib\site-packages\numba\core\typed_passes.py in run_pass(self, state)
    369                                        metadata=metadata)
--> 370                 lower.lower()
    371                 if not flags.no_cpython_wrapper:

~\AppData\Local\Continuum\anaconda3\lib\site-packages\numba\core\lowering.py in lower(self)
    216         # Materialize LLVM Module
--> 217         self.library.add_ir_module(self.module)
    218 

~\AppData\Local\Continuum\anaconda3\lib\site-packages\numba\core\codegen.py in add_ir_module(self, ir_module)
    205         ir = cgutils.normalize_ir_text(str(ir_module))
--> 206         ll_module = ll.parse_assembly(ir)
    207         ll_module.name = ir_module.name

~\AppData\Local\Continuum\anaconda3\lib\site-packages\llvmlite\binding\module.py in parse_assembly(llvmir, context)
     24             mod.close()
---> 25             raise RuntimeError("LLVM IR parsing error\n{0}".format(errmsg))
     26     return mod

RuntimeError: Failed in nopython mode pipeline (step: nopython mode backend)
LLVM IR parsing error
<string>:4079:36: error: '%.2747' defined with type 'i64' but expected 'i32'
  %".2748" = icmp eq i32 %".2746", %".2747"
                                   ^

During handling of the above exception, another exception occurred:

LoweringError                             Traceback (most recent call last)
<ipython-input-10-a83dc5279093> in <module>
----> 1 sc.pp.calculate_qc_metrics(adata, qc_vars=["mt"], inplace=True)

~\AppData\Local\Continuum\anaconda3\lib\site-packages\scanpy\preprocessing\_qc.py in calculate_qc_metrics(adata, expr_type, var_type, qc_vars, percent_top, layer, use_raw, inplace, log1p, parallel)
    294         inplace=inplace,
    295         X=X,
--> 296         log1p=log1p,
    297     )
    298     var_metrics = describe_var(

~\AppData\Local\Continuum\anaconda3\lib\site-packages\scanpy\preprocessing\_qc.py in describe_obs(adata, expr_type, var_type, qc_vars, percent_top, layer, use_raw, log1p, inplace, X, parallel)
    112     if percent_top:
    113         percent_top = sorted(percent_top)
--> 114         proportions = top_segment_proportions(X, percent_top)
    115         for i, n in enumerate(percent_top):
    116             obs_metrics[f"pct_{expr_type}_in_top_{n}_{var_type}"] = (

~\AppData\Local\Continuum\anaconda3\lib\site-packages\scanpy\preprocessing\_qc.py in top_segment_proportions(mtx, ns)
    377             mtx = csr_matrix(mtx)
    378         return top_segment_proportions_sparse_csr(
--> 379             mtx.data, mtx.indptr, np.array(ns, dtype=np.int)
    380         )
    381     else:

~\AppData\Local\Continuum\anaconda3\lib\site-packages\numba\core\dispatcher.py in _compile_for_args(self, *args, **kws)
    432                     e.patch_message('\n'.join((str(e).rstrip(), help_msg)))
    433             # ignore the FULL_TRACEBACKS config, this needs reporting!
--> 434             raise e
    435 
    436     def inspect_llvm(self, signature=None):

~\AppData\Local\Continuum\anaconda3\lib\site-packages\numba\core\dispatcher.py in _compile_for_args(self, *args, **kws)
    365                 argtypes.append(self.typeof_pyval(a))
    366         try:
--> 367             return self.compile(tuple(argtypes))
    368         except errors.ForceLiteralArg as e:
    369             # Received request for compiler re-entry with the list of arguments

~\AppData\Local\Continuum\anaconda3\lib\site-packages\numba\core\compiler_lock.py in _acquire_compile_lock(*args, **kwargs)
     30         def _acquire_compile_lock(*args, **kwargs):
     31             with self:
---> 32                 return func(*args, **kwargs)
     33         return _acquire_compile_lock
     34 

~\AppData\Local\Continuum\anaconda3\lib\site-packages\numba\core\dispatcher.py in compile(self, sig)
    806             self._cache_misses[sig] += 1
    807             try:
--> 808                 cres = self._compiler.compile(args, return_type)
    809             except errors.ForceLiteralArg as e:
    810                 def folded(args, kws):

~\AppData\Local\Continuum\anaconda3\lib\site-packages\numba\core\dispatcher.py in compile(self, args, return_type)
     76 
     77     def compile(self, args, return_type):
---> 78         status, retval = self._compile_cached(args, return_type)
     79         if status:
     80             return retval

~\AppData\Local\Continuum\anaconda3\lib\site-packages\numba\core\dispatcher.py in _compile_cached(self, args, return_type)
     90 
     91         try:
---> 92             retval = self._compile_core(args, return_type)
     93         except errors.TypingError as e:
     94             self._failed_cache[key] = e

~\AppData\Local\Continuum\anaconda3\lib\site-packages\numba\core\dispatcher.py in _compile_core(self, args, return_type)
    108                                       args=args, return_type=return_type,
    109                                       flags=flags, locals=self.locals,
--> 110                                       pipeline_class=self.pipeline_class)
    111         # Check typing error if object mode is used
    112         if cres.typing_error is not None and not flags.enable_pyobject:

~\AppData\Local\Continuum\anaconda3\lib\site-packages\numba\core\compiler.py in compile_extra(typingctx, targetctx, func, args, return_type, flags, locals, library, pipeline_class)
    601     pipeline = pipeline_class(typingctx, targetctx, library,
    602                               args, return_type, flags, locals)
--> 603     return pipeline.compile_extra(func)
    604 
    605 

~\AppData\Local\Continuum\anaconda3\lib\site-packages\numba\core\compiler.py in compile_extra(self, func)
    337         self.state.lifted = ()
    338         self.state.lifted_from = None
--> 339         return self._compile_bytecode()
    340 
    341     def compile_ir(self, func_ir, lifted=(), lifted_from=None):

~\AppData\Local\Continuum\anaconda3\lib\site-packages\numba\core\compiler.py in _compile_bytecode(self)
    399         """
    400         assert self.state.func_ir is None
--> 401         return self._compile_core()
    402 
    403     def _compile_ir(self):

~\AppData\Local\Continuum\anaconda3\lib\site-packages\numba\core\compiler.py in _compile_core(self)
    379                 self.state.status.fail_reason = e
    380                 if is_final_pipeline:
--> 381                     raise e
    382         else:
    383             raise CompilerError("All available pipelines exhausted")

~\AppData\Local\Continuum\anaconda3\lib\site-packages\numba\core\compiler.py in _compile_core(self)
    370             res = None
    371             try:
--> 372                 pm.run(self.state)
    373                 if self.state.cr is not None:
    374                     break

~\AppData\Local\Continuum\anaconda3\lib\site-packages\numba\core\compiler_machinery.py in run(self, state)
    339                     (self.pipeline_name, pass_desc)
    340                 patched_exception = self._patch_error(msg, e)
--> 341                 raise patched_exception
    342 
    343     def dependency_analysis(self):

~\AppData\Local\Continuum\anaconda3\lib\site-packages\numba\core\compiler_machinery.py in run(self, state)
    330                 pass_inst = _pass_registry.get(pss).pass_inst
    331                 if isinstance(pass_inst, CompilerPass):
--> 332                     self._runPass(idx, pass_inst, state)
    333                 else:
    334                     raise BaseException("Legacy pass in use")

~\AppData\Local\Continuum\anaconda3\lib\site-packages\numba\core\compiler_lock.py in _acquire_compile_lock(*args, **kwargs)
     30         def _acquire_compile_lock(*args, **kwargs):
     31             with self:
---> 32                 return func(*args, **kwargs)
     33         return _acquire_compile_lock
     34 

~\AppData\Local\Continuum\anaconda3\lib\site-packages\numba\core\compiler_machinery.py in _runPass(self, index, pss, internal_state)
    289             mutated |= check(pss.run_initialization, internal_state)
    290         with SimpleTimer() as pass_time:
--> 291             mutated |= check(pss.run_pass, internal_state)
    292         with SimpleTimer() as finalize_time:
    293             mutated |= check(pss.run_finalizer, internal_state)

~\AppData\Local\Continuum\anaconda3\lib\site-packages\numba\core\compiler_machinery.py in check(func, compiler_state)
    262 
    263         def check(func, compiler_state):
--> 264             mangled = func(compiler_state)
    265             if mangled not in (True, False):
    266                 msg = ("CompilerPass implementations should return True/False. "

~\AppData\Local\Continuum\anaconda3\lib\site-packages\numba\core\typed_passes.py in run_pass(self, state)
    440 
    441         # TODO: Pull this out into the pipeline
--> 442         NativeLowering().run_pass(state)
    443         lowered = state['cr']
    444         signature = typing.signature(state.return_type, *state.args)

~\AppData\Local\Continuum\anaconda3\lib\site-packages\numba\core\typed_passes.py in run_pass(self, state)
    368                 lower = lowering.Lower(targetctx, library, fndesc, interp,
    369                                        metadata=metadata)
--> 370                 lower.lower()
    371                 if not flags.no_cpython_wrapper:
    372                     lower.create_cpython_wrapper(flags.release_gil)

~\AppData\Local\Continuum\anaconda3\lib\site-packages\numba\core\lowering.py in lower(self)
    177         if self.generator_info is None:
    178             self.genlower = None
--> 179             self.lower_normal_function(self.fndesc)
    180         else:
    181             self.genlower = self.GeneratorLower(self)

~\AppData\Local\Continuum\anaconda3\lib\site-packages\numba\core\lowering.py in lower_normal_function(self, fndesc)
    231         # Init argument values
    232         self.extract_function_arguments()
--> 233         entry_block_tail = self.lower_function_body()
    234 
    235         # Close tail of entry block

~\AppData\Local\Continuum\anaconda3\lib\site-packages\numba\core\lowering.py in lower_function_body(self)
    257             bb = self.blkmap[offset]
    258             self.builder.position_at_end(bb)
--> 259             self.lower_block(block)
    260         self.post_lower()
    261         return entry_block_tail

~\AppData\Local\Continuum\anaconda3\lib\site-packages\numba\core\lowering.py in lower_block(self, block)
    271             with new_error_context('lowering "{inst}" at {loc}', inst=inst,
    272                                    loc=self.loc, errcls_=defaulterrcls):
--> 273                 self.lower_inst(inst)
    274         self.post_block(block)
    275 

~\AppData\Local\Continuum\anaconda3\lib\contextlib.py in __exit__(self, type, value, traceback)
    128                 value = type()
    129             try:
--> 130                 self.gen.throw(type, value, traceback)
    131             except StopIteration as exc:
    132                 # Suppress StopIteration *unless* it's the same exception that

~\AppData\Local\Continuum\anaconda3\lib\site-packages\numba\core\errors.py in new_error_context(fmt_, *args, **kwargs)
    750         newerr = errcls(e).add_context(_format_msg(fmt_, args, kwargs))
    751         tb = sys.exc_info()[2] if numba.core.config.FULL_TRACEBACKS else None
--> 752         reraise(type(newerr), newerr, tb)
    753 
    754 

~\AppData\Local\Continuum\anaconda3\lib\site-packages\numba\core\utils.py in reraise(tp, value, tb)
     79     if value.__traceback__ is not tb:
     80         raise value.with_traceback(tb)
---> 81     raise value
     82 
     83 

LoweringError: Failed in nopython mode pipeline (step: nopython mode backend)
Failed in nopython mode pipeline (step: nopython mode backend)
LLVM IR parsing error
<string>:4079:36: error: '%.2747' defined with type 'i64' but expected 'i32'
  %".2748" = icmp eq i32 %".2746", %".2747"
                                   ^


File "..\..\AppData\Local\Continuum\anaconda3\lib\site-packages\scanpy\preprocessing\_qc.py", line 412:
def top_segment_proportions_sparse_csr(data, indptr, ns):
    <source elided>
    partitioned = np.zeros((indptr.size - 1, maxidx), dtype=data.dtype)
    for i in numba.prange(indptr.size - 1):
    ^

During: lowering "id=13[LoopNest(index_variable = parfor_index.264, range = (0, $122binary_subtract.5, 1))]{130: <ir.Block at C:\Users\tpeng\AppData\Local\Continuum\anaconda3\lib\site-packages\scanpy\preprocessing\_qc.py (412)>, 400: <ir.Block at C:\Users\tpeng\AppData\Local\Continuum\anaconda3\lib\site-packages\scanpy\preprocessing\_qc.py (418)>, 402: <ir.Block at C:\Users\tpeng\AppData\Local\Continuum\anaconda3\lib\site-packages\scanpy\preprocessing\_qc.py (419)>, 276: <ir.Block at C:\Users\tpeng\AppData\Local\Continuum\anaconda3\lib\site-packages\scanpy\preprocessing\_qc.py (416)>, 318: <ir.Block at C:\Users\tpeng\AppData\Local\Continuum\anaconda3\lib\site-packages\scanpy\preprocessing\_qc.py (417)>}Var(parfor_index.264, _qc.py:412)" at C:\Users\tpeng\AppData\Local\Continuum\anaconda3\lib\site-packages\scanpy\preprocessing\_qc.py (412)

The package version is as follows:

scanpy==1.5.1 anndata==0.7.4 umap==0.4.6 numpy==1.18.5 scipy==1.5.0 pandas==1.0.5 scikit-learn==0.23.1 statsmodels==0.11.1 python-igraph==0.7.1+5.3b99dbf6 leidenalg==0.7.0

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:16 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
taopeng1100commented, Aug 7, 2020

It all works NOW! I appreciate your help!

0reactions
taopeng1100commented, Aug 8, 2020

It all works NOW! I appreciate your help!

Read more comments on GitHub >

github_iconTop Results From Across the Web

scanpy.pp.calculate_qc_metrics - Read the Docs
Largely based on calculateQCMetrics from scater [McCarthy17]. ... sc.pp.calculate_qc_metrics(pbmc, qc_vars=["mito"], inplace=True) sns.jointplot( ...
Read more >
scanpy sc.pp.calculate_qc_metrics(adata, qc_vars=["mt ...
After I use function adata = sc.read_visium( '. ... scanpy sc.pp.calculate_qc_metrics(adata, qc_vars=["mt"], inplace=True) #1341.
Read more >
scanpy_01_qc
First, let Scanpy calculate some general qc-stats for genes and cells with the function sc.pp.calculate_qc_metrics , similar to calculateQCmetrics in Scater ...
Read more >
Error while using sc.pp.calculate_qc_metrics - Help - Scanpy
Hi, I'm interested in your helpful tool. I'm studying to use your tool follow your tutotial. The data I use is also your...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found