scverse/pertpy

Unable to import package.

thomasgaudelet opened this issue · 2 comments

Report

I am unable to import pertpy package. The error message is linked to numpa/numpy interplay

Python 3.10.12 (main, Jun 21 2024, 10:35:36) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pertpy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/pyenv/versions/3.10.12/lib/python3.10/site-packages/pertpy/__init__.py", line 18, in <module>
    from . import plot as pl
  File "/opt/pyenv/versions/3.10.12/lib/python3.10/site-packages/pertpy/plot/__init__.py", line 2, in <module>
    from pertpy.plot._coda import CodaPlot as coda
  File "/opt/pyenv/versions/3.10.12/lib/python3.10/site-packages/pertpy/plot/_coda.py", line 13, in <module>
    from pertpy.tools._coda._base_coda import CompositionalModel2
  File "/opt/pyenv/versions/3.10.12/lib/python3.10/site-packages/pertpy/tools/__init__.py", line 6, in <module>
    from pertpy.tools._differential_gene_expression import DifferentialGeneExpression
  File "/opt/pyenv/versions/3.10.12/lib/python3.10/site-packages/pertpy/tools/_differential_gene_expression.py", line 5, in <module>
    import decoupler as dc
  File "/opt/pyenv/versions/3.10.12/lib/python3.10/site-packages/decoupler/__init__.py", line 17, in <module>
    from .method_gsva import run_gsva  # noqa: F401
  File "/opt/pyenv/versions/3.10.12/lib/python3.10/site-packages/decoupler/method_gsva.py", line 84, in <module>
    def nb_get_D_I(mat):
  File "/opt/pyenv/versions/3.10.12/lib/python3.10/site-packages/numba/core/decorators.py", line 232, in wrapper
    disp.compile(sig)
  File "/opt/pyenv/versions/3.10.12/lib/python3.10/site-packages/numba/core/dispatcher.py", line 905, in compile
    cres = self._compiler.compile(args, return_type)
  File "/opt/pyenv/versions/3.10.12/lib/python3.10/site-packages/numba/core/dispatcher.py", line 84, in compile
    raise retval
  File "/opt/pyenv/versions/3.10.12/lib/python3.10/site-packages/numba/core/dispatcher.py", line 94, in _compile_cached
    retval = self._compile_core(args, return_type)
  File "/opt/pyenv/versions/3.10.12/lib/python3.10/site-packages/numba/core/dispatcher.py", line 107, in _compile_core
    cres = compiler.compile_extra(self.targetdescr.typing_context,
  File "/opt/pyenv/versions/3.10.12/lib/python3.10/site-packages/numba/core/compiler.py", line 744, in compile_extra
    return pipeline.compile_extra(func)
  File "/opt/pyenv/versions/3.10.12/lib/python3.10/site-packages/numba/core/compiler.py", line 438, in compile_extra
    return self._compile_bytecode()
  File "/opt/pyenv/versions/3.10.12/lib/python3.10/site-packages/numba/core/compiler.py", line 506, in _compile_bytecode
    return self._compile_core()
  File "/opt/pyenv/versions/3.10.12/lib/python3.10/site-packages/numba/core/compiler.py", line 485, in _compile_core
    raise e
  File "/opt/pyenv/versions/3.10.12/lib/python3.10/site-packages/numba/core/compiler.py", line 472, in _compile_core
    pm.run(self.state)
  File "/opt/pyenv/versions/3.10.12/lib/python3.10/site-packages/numba/core/compiler_machinery.py", line 368, in run
    raise patched_exception
  File "/opt/pyenv/versions/3.10.12/lib/python3.10/site-packages/numba/core/compiler_machinery.py", line 356, in run
    self._runPass(idx, pass_inst, state)
  File "/opt/pyenv/versions/3.10.12/lib/python3.10/site-packages/numba/core/compiler_lock.py", line 35, in _acquire_compile_lock
    return func(*args, **kwargs)
  File "/opt/pyenv/versions/3.10.12/lib/python3.10/site-packages/numba/core/compiler_machinery.py", line 311, in _runPass
    mutated |= check(pss.run_pass, internal_state)
  File "/opt/pyenv/versions/3.10.12/lib/python3.10/site-packages/numba/core/compiler_machinery.py", line 273, in check
    mangled = func(compiler_state)
  File "/opt/pyenv/versions/3.10.12/lib/python3.10/site-packages/numba/core/typed_passes.py", line 112, in run_pass
    typemap, return_type, calltypes, errs = type_inference_stage(
  File "/opt/pyenv/versions/3.10.12/lib/python3.10/site-packages/numba/core/typed_passes.py", line 93, in type_inference_stage
    errs = infer.propagate(raise_errors=raise_errors)
  File "/opt/pyenv/versions/3.10.12/lib/python3.10/site-packages/numba/core/typeinfer.py", line 1091, in propagate
    raise errors[0]
numba.core.errors.TypingError: Failed in nopython mode pipeline (step: nopython frontend)
No implementation of function Function(<built-in function arange>) found for signature:
 
 >>> arange(start=int64, stop=Literal[int](0), step=Literal[int](-1), dtype=class(float32))
 
There are 2 candidate implementations:
  - Of which 2 did not match due to:
  Overload in function 'np_arange': File: numba/np/arrayobj.py: Line 4760.
    With argument(s): '(start=int64, stop=int64, step=int64, dtype=class(float32))':
   Rejected as the implementation raised a specific error:
     TypingError: 'start' parameter is positional only, but was passed as a keyword
  raised from /opt/pyenv/versions/3.10.12/lib/python3.10/site-packages/numba/core/typing/templates.py:783

During: resolving callee type: Function(<built-in function arange>)
During: typing of call at /opt/pyenv/versions/3.10.12/lib/python3.10/site-packages/decoupler/method_gsva.py (86)


File "../../../opt/pyenv/versions/3.10.12/lib/python3.10/site-packages/decoupler/method_gsva.py", line 86:
def nb_get_D_I(mat):
    <source elided>
    n = mat.shape[1]
    rev_idx = np.abs(np.arange(start=n, stop=0, step=-1, dtype=nb.f4) - n / 2)
    ^

Version information


session_info 1.0.0

Python 3.10.12 (main, Jun 21 2024, 10:35:36) [GCC 11.4.0]
Linux-5.4.0-162-generic-x86_64-with-glibc2.35

Session information updated at 2024-07-02 16:28

But since I can't load the package this is not really useful...
Here are the versions from pip freeze, (let me know if you'd need more packages)
pertpy==0.7.0 (got the same with 0.6.0)
numpy==1.26.4
numba==0.60.0

Thanks, that was it. Enjoy your holidays!