saezlab / decoupler-py

Python package to perform enrichment analysis from omics data.
https://decoupler-py.readthedocs.io/
GNU General Public License v3.0
168 stars 25 forks source link

TypingError Decoupler Import #34

Closed jvogenstahl closed 1 year ago

jvogenstahl commented 1 year ago

Dear Decoupler team,

I followed the PerMedCoE hands-on course on Tuesday and I'm trying to apply the analysis to my data (spatial transcriptomics) following the GoogleCollab file.

I managed to create the 'signalling' environment and I believe I managed to install all packages in Jupyter. However, I get a TypingError when importing decoupler in python and can't figure out what's wrong (see below).

Any assistance would be very welcome.

Have a great day,

Johanna

My code:

!pip install cvxpy==1.3.1 cylp==0.91.5 gurobipy==10.0.1
!pip install pypath-omnipath
!pip install omnipath
!pip install decoupler
!pip install corneto-0.9.1a0-py3-none-any.whl
!pip install --upgrade numba

import decoupler as dc

Error message:

---------------------------------------------------------------------------
TypingError                               Traceback (most recent call last)
<ipython-input-66-3ed1422ba4b9> in <module>
----> 1 import decoupler as dc

~/opt/anaconda3/lib/python3.7/site-packages/decoupler/__init__.py in <module>
     14 from .method_udt import run_udt  # noqa: F401
     15 from .method_ora import run_ora, test1r, get_ora_df  # noqa: F401
---> 16 from .method_gsva import run_gsva  # noqa: F401
     17 from .method_gsea import run_gsea  # noqa: F401
     18 from .method_viper import run_viper  # noqa: F401

~/opt/anaconda3/lib/python3.7/site-packages/decoupler/method_gsva.py in <module>
     80 
     81 
---> 82 @nb.njit(nb.types.Tuple((nb.f4[:, :], nb.i8[:, :]))(nb.f4[:, :]), parallel=True, cache=True)
     83 def nb_get_D_I(mat):
     84     n = mat.shape[1]

~/opt/anaconda3/lib/python3.7/site-packages/numba/decorators.py in wrapper(func)
    184             with typeinfer.register_dispatcher(disp):
    185                 for sig in sigs:
--> 186                     disp.compile(sig)
    187                 disp.disable_compile()
    188         return disp

~/opt/anaconda3/lib/python3.7/site-packages/numba/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 

~/opt/anaconda3/lib/python3.7/site-packages/numba/dispatcher.py in compile(self, sig)
    691 
    692             self._cache_misses[sig] += 1
--> 693             cres = self._compiler.compile(args, return_type)
    694             self.add_overload(cres)
    695             self._cache.save_overload(sig, cres)

~/opt/anaconda3/lib/python3.7/site-packages/numba/dispatcher.py in compile(self, args, return_type)
     78             return retval
     79         else:
---> 80             raise retval
     81 
     82     def _compile_cached(self, args, return_type):

~/opt/anaconda3/lib/python3.7/site-packages/numba/dispatcher.py in _compile_cached(self, args, return_type)
     88 
     89         try:
---> 90             retval = self._compile_core(args, return_type)
     91         except errors.TypingError as e:
     92             self._failed_cache[key] = e

~/opt/anaconda3/lib/python3.7/site-packages/numba/dispatcher.py in _compile_core(self, args, return_type)
    106                                       args=args, return_type=return_type,
    107                                       flags=flags, locals=self.locals,
--> 108                                       pipeline_class=self.pipeline_class)
    109         # Check typing error if object mode is used
    110         if cres.typing_error is not None and not flags.enable_pyobject:

~/opt/anaconda3/lib/python3.7/site-packages/numba/compiler.py in compile_extra(typingctx, targetctx, func, args, return_type, flags, locals, library, pipeline_class)
    970     pipeline = pipeline_class(typingctx, targetctx, library,
    971                               args, return_type, flags, locals)
--> 972     return pipeline.compile_extra(func)
    973 
    974 

~/opt/anaconda3/lib/python3.7/site-packages/numba/compiler.py in compile_extra(self, func)
    388         self.lifted = ()
    389         self.lifted_from = None
--> 390         return self._compile_bytecode()
    391 
    392     def compile_ir(self, func_ir, lifted=(), lifted_from=None):

~/opt/anaconda3/lib/python3.7/site-packages/numba/compiler.py in _compile_bytecode(self)
    901         """
    902         assert self.func_ir is None
--> 903         return self._compile_core()
    904 
    905     def _compile_ir(self):

~/opt/anaconda3/lib/python3.7/site-packages/numba/compiler.py in _compile_core(self)
    888         self.define_pipelines(pm)
    889         pm.finalize()
--> 890         res = pm.run(self.status)
    891         if res is not None:
    892             # Early pipeline completion

~/opt/anaconda3/lib/python3.7/site-packages/numba/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 

~/opt/anaconda3/lib/python3.7/site-packages/numba/compiler.py in run(self, status)
    264                     # No more fallback pipelines?
    265                     if is_final_pipeline:
--> 266                         raise patched_exception
    267                     # Go to next fallback pipeline
    268                     else:

~/opt/anaconda3/lib/python3.7/site-packages/numba/compiler.py in run(self, status)
    255                 try:
    256                     event("-- %s" % stage_name)
--> 257                     stage()
    258                 except _EarlyPipelineCompletion as e:
    259                     return e.result

~/opt/anaconda3/lib/python3.7/site-packages/numba/compiler.py in stage_nopython_frontend(self)
    513                 self.args,
    514                 self.return_type,
--> 515                 self.locals)
    516             self.typemap = typemap
    517             self.return_type = return_type

~/opt/anaconda3/lib/python3.7/site-packages/numba/compiler.py in type_inference_stage(typingctx, interp, args, return_type, locals)
   1122 
   1123         infer.build_constraint()
-> 1124         infer.propagate()
   1125         typemap, restype, calltypes = infer.unify()
   1126 

~/opt/anaconda3/lib/python3.7/site-packages/numba/typeinfer.py in propagate(self, raise_errors)
    925         if errors:
    926             if raise_errors:
--> 927                 raise errors[0]
    928             else:
    929                 return errors

TypingError: Failed in nopython mode pipeline (step: nopython frontend)
Invalid use of Function(<built-in function arange>) with argument(s) of type(s): (dtype=class(float32), start=int64, step=Literal[int](-1), stop=Literal[int](0))
 * parameterized
In definition 0:
    AssertionError: 
    raised from /Users/johannavogenstahl/opt/anaconda3/lib/python3.7/site-packages/numba/typing/npydecl.py:631
In definition 1:
    AssertionError: 
    raised from /Users/johannavogenstahl/opt/anaconda3/lib/python3.7/site-packages/numba/typing/npydecl.py:631
This error is usually caused by passing an argument of a type that is unsupported by the named function.
[1] During: resolving callee type: Function(<built-in function arange>)
[2] During: typing of call at /Users/johannavogenstahl/opt/anaconda3/lib/python3.7/site-packages/decoupler/method_gsva.py (85)

File "../../../opt/anaconda3/lib/python3.7/site-packages/decoupler/method_gsva.py", line 85:
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)
    ^
PauBadiaM commented 1 year ago

Hi @jvogenstahl

Unfortunately, this looks like a dependency issue with GoogleColab, could you try to redo the enviroment without upgrading numba? So basically:

!pip install cvxpy==1.3.1 cylp==0.91.5 gurobipy==10.0.1
!pip install pypath-omnipath
!pip install omnipath
!pip install decoupler
!pip install corneto-0.9.1a0-py3-none-any.whl

import decoupler as dc
jvogenstahl commented 1 year ago

Hi Pau,

Thanks for your help ! I just tried the code without the Numba upgrade. Please find below the new typing error.

Best,

Jo

Collecting cvxpy==1.3.1
  Using cached cvxpy-1.3.1-cp39-cp39-macosx_10_9_x86_64.whl (932 kB)
Collecting cylp==0.91.5
  Using cached cylp-0.91.5-cp39-cp39-macosx_10_9_x86_64.whl (4.4 MB)
Collecting gurobipy==10.0.1
  Using cached gurobipy-10.0.1-cp39-cp39-macosx_10_9_universal2.whl (10.3 MB)
Collecting osqp>=0.4.1
  Using cached osqp-0.6.2.post9-cp39-cp39-macosx_10_9_x86_64.whl (252 kB)
Collecting scs>=1.1.6
  Using cached scs-3.2.3-cp39-cp39-macosx_10_9_x86_64.whl (11.6 MB)
Requirement already satisfied: setuptools>65.5.1 in /Users/johannavogenstahl/miniconda3/lib/python3.9/site-packages (from cvxpy==1.3.1) (65.6.3)
Collecting scipy>=1.1.0
  Using cached scipy-1.10.1-cp39-cp39-macosx_10_9_x86_64.whl (35.2 MB)
Collecting numpy>=1.15
  Downloading numpy-1.24.3-cp39-cp39-macosx_10_9_x86_64.whl (19.8 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 19.8/19.8 MB 27.5 MB/s eta 0:00:0000:0100:01
Collecting ecos>=2
  Using cached ecos-2.0.12-cp39-cp39-macosx_10_9_x86_64.whl (90 kB)
Collecting qdldl
  Using cached qdldl-0.1.7-cp39-cp39-macosx_10_9_x86_64.whl (102 kB)
Installing collected packages: gurobipy, numpy, scipy, scs, qdldl, ecos, cylp, osqp, cvxpy
Successfully installed cvxpy-1.3.1 cylp-0.91.5 ecos-2.0.12 gurobipy-10.0.1 numpy-1.24.3 osqp-0.6.2.post9 qdldl-0.1.7 scipy-1.10.1 scs-3.2.3
Collecting pypath-omnipath
  Downloading pypath_omnipath-0.14.48-py3-none-any.whl (1.1 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.1/1.1 MB 12.9 MB/s eta 0:00:0000:0100:01
Collecting psutil
  Downloading psutil-5.9.5-cp36-abi3-macosx_10_9_x86_64.whl (245 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 245.3/245.3 kB 6.3 MB/s eta 0:00:00a 0:00:01
Collecting future
  Downloading future-0.18.3.tar.gz (840 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 840.9/840.9 kB 13.5 MB/s eta 0:00:0000:01
  Preparing metadata (setup.py) ... done
Collecting sqlparse
  Downloading sqlparse-0.4.4-py3-none-any.whl (41 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 41.2/41.2 kB 1.4 MB/s eta 0:00:00
Collecting PyYAML
  Downloading PyYAML-6.0-cp39-cp39-macosx_10_9_x86_64.whl (197 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 197.6/197.6 kB 7.0 MB/s eta 0:00:00
Collecting rdata
  Using cached rdata-0.9-py3-none-any.whl (19 kB)
Collecting beautifulsoup4
  Downloading beautifulsoup4-4.12.2-py3-none-any.whl (142 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.0/143.0 kB 5.2 MB/s eta 0:00:00
Collecting timeloop
  Using cached timeloop-1.0.2.tar.gz (2.9 kB)
  Preparing metadata (setup.py) ... done
Collecting openpyxl
  Downloading openpyxl-3.1.2-py2.py3-none-any.whl (249 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 250.0/250.0 kB 7.8 MB/s eta 0:00:00
Collecting lxml
  Downloading lxml-4.9.2-cp39-cp39-macosx_10_15_x86_64.whl (4.8 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.8/4.8 MB 24.9 MB/s eta 0:00:0000:0100:01
Requirement already satisfied: tqdm in /Users/johannavogenstahl/miniconda3/lib/python3.9/site-packages (from pypath-omnipath) (4.64.1)
Collecting dill
  Using cached dill-0.3.6-py3-none-any.whl (110 kB)
Collecting tabulate
  Using cached tabulate-0.9.0-py3-none-any.whl (35 kB)
Collecting pyreadr
  Downloading pyreadr-0.4.7-cp39-cp39-macosx_10_9_x86_64.whl (253 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 253.5/253.5 kB 7.8 MB/s eta 0:00:00
Requirement already satisfied: numpy in /Users/johannavogenstahl/miniconda3/lib/python3.9/site-packages (from pypath-omnipath) (1.24.3)
Collecting typing_extensions
  Using cached typing_extensions-4.5.0-py3-none-any.whl (27 kB)
Requirement already satisfied: requests in /Users/johannavogenstahl/miniconda3/lib/python3.9/site-packages (from pypath-omnipath) (2.28.1)
Collecting glom
  Downloading glom-23.3.0-py3-none-any.whl (101 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 101.9/101.9 kB 3.8 MB/s eta 0:00:00
Collecting xlrd
  Downloading xlrd-2.0.1-py2.py3-none-any.whl (96 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 96.5/96.5 kB 3.2 MB/s eta 0:00:00
Requirement already satisfied: scipy in /Users/johannavogenstahl/miniconda3/lib/python3.9/site-packages (from pypath-omnipath) (1.10.1)
Collecting toml
  Downloading toml-0.10.2-py2.py3-none-any.whl (16 kB)
Collecting matplotlib
  Downloading matplotlib-3.7.1-cp39-cp39-macosx_10_12_x86_64.whl (7.4 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 7.4/7.4 MB 13.6 MB/s eta 0:00:0000:0100:01
Collecting pandas
  Downloading pandas-2.0.1-cp39-cp39-macosx_10_9_x86_64.whl (11.8 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 11.8/11.8 MB 25.7 MB/s eta 0:00:0000:0100:01
Collecting pysftp<0.3.0,>=0.2.9
  Downloading pysftp-0.2.9.tar.gz (25 kB)
  Preparing metadata (setup.py) ... done
Collecting pycurl
  Downloading pycurl-7.45.2.tar.gz (234 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 234.2/234.2 kB 6.9 MB/s eta 0:00:00
  Preparing metadata (setup.py) ... done
Collecting paramiko>=1.17
  Downloading paramiko-3.1.0-py3-none-any.whl (211 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 211.2/211.2 kB 7.7 MB/s eta 0:00:00
Collecting soupsieve>1.2
  Downloading soupsieve-2.4.1-py3-none-any.whl (36 kB)
Collecting boltons>=19.3.0
  Downloading boltons-23.0.0-py2.py3-none-any.whl (194 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 194.8/194.8 kB 7.3 MB/s eta 0:00:00
Collecting face==20.1.1
  Downloading face-20.1.1-py3-none-any.whl (51 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 51.1/51.1 kB 1.7 MB/s eta 0:00:00
Collecting attrs
  Using cached attrs-23.1.0-py3-none-any.whl (61 kB)
Collecting cycler>=0.10
  Downloading cycler-0.11.0-py3-none-any.whl (6.4 kB)
Collecting python-dateutil>=2.7
  Downloading python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 247.7/247.7 kB 7.4 MB/s eta 0:00:00
Collecting contourpy>=1.0.1
  Downloading contourpy-1.0.7-cp39-cp39-macosx_10_9_x86_64.whl (244 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 244.3/244.3 kB 7.4 MB/s eta 0:00:00
Collecting kiwisolver>=1.0.1
  Downloading kiwisolver-1.4.4-cp39-cp39-macosx_10_9_x86_64.whl (65 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 65.5/65.5 kB 2.3 MB/s eta 0:00:00
Collecting pillow>=6.2.0
  Downloading Pillow-9.5.0-cp39-cp39-macosx_10_10_x86_64.whl (3.4 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.4/3.4 MB 23.6 MB/s eta 0:00:0000:0100:01
Collecting fonttools>=4.22.0
  Downloading fonttools-4.39.3-py3-none-any.whl (1.0 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.0/1.0 MB 17.2 MB/s eta 0:00:0000:01
Collecting packaging>=20.0
  Using cached packaging-23.1-py3-none-any.whl (48 kB)
Collecting pyparsing>=2.3.1
  Downloading pyparsing-3.0.9-py3-none-any.whl (98 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 98.3/98.3 kB 3.4 MB/s eta 0:00:00
Collecting importlib-resources>=3.2.0
  Downloading importlib_resources-5.12.0-py3-none-any.whl (36 kB)
Collecting et-xmlfile
  Downloading et_xmlfile-1.1.0-py3-none-any.whl (4.7 kB)
Collecting pytz>=2020.1
  Downloading pytz-2023.3-py2.py3-none-any.whl (502 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 502.3/502.3 kB 11.2 MB/s eta 0:00:0000:01
Collecting tzdata>=2022.1
  Downloading tzdata-2023.3-py2.py3-none-any.whl (341 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 341.8/341.8 kB 8.2 MB/s eta 0:00:0000:01
Collecting xarray
  Downloading xarray-2023.4.2-py3-none-any.whl (979 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 979.5/979.5 kB 14.7 MB/s eta 0:00:0000:01
Requirement already satisfied: certifi>=2017.4.17 in /Users/johannavogenstahl/miniconda3/lib/python3.9/site-packages (from requests->pypath-omnipath) (2022.12.7)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /Users/johannavogenstahl/miniconda3/lib/python3.9/site-packages (from requests->pypath-omnipath) (1.26.14)
Requirement already satisfied: idna<4,>=2.5 in /Users/johannavogenstahl/miniconda3/lib/python3.9/site-packages (from requests->pypath-omnipath) (3.4)
Requirement already satisfied: charset-normalizer<3,>=2 in /Users/johannavogenstahl/miniconda3/lib/python3.9/site-packages (from requests->pypath-omnipath) (2.0.4)
Collecting zipp>=3.1.0
  Downloading zipp-3.15.0-py3-none-any.whl (6.8 kB)
Requirement already satisfied: cryptography>=3.3 in /Users/johannavogenstahl/miniconda3/lib/python3.9/site-packages (from paramiko>=1.17->pysftp<0.3.0,>=0.2.9->pypath-omnipath) (38.0.4)
Collecting bcrypt>=3.2
  Downloading bcrypt-4.0.1-cp36-abi3-macosx_10_10_universal2.whl (473 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 473.4/473.4 kB 10.1 MB/s eta 0:00:0000:01
Collecting pynacl>=1.5
  Downloading PyNaCl-1.5.0-cp36-abi3-macosx_10_10_universal2.whl (349 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 349.9/349.9 kB 9.0 MB/s eta 0:00:0000:01
Requirement already satisfied: six>=1.5 in /Users/johannavogenstahl/miniconda3/lib/python3.9/site-packages (from python-dateutil>=2.7->matplotlib->pypath-omnipath) (1.16.0)
Requirement already satisfied: cffi>=1.12 in /Users/johannavogenstahl/miniconda3/lib/python3.9/site-packages (from cryptography>=3.3->paramiko>=1.17->pysftp<0.3.0,>=0.2.9->pypath-omnipath) (1.15.1)
Requirement already satisfied: pycparser in /Users/johannavogenstahl/miniconda3/lib/python3.9/site-packages (from cffi>=1.12->cryptography>=3.3->paramiko>=1.17->pysftp<0.3.0,>=0.2.9->pypath-omnipath) (2.21)
Building wheels for collected packages: pysftp, future, pycurl, timeloop
  Building wheel for pysftp (setup.py) ... done
  Created wheel for pysftp: filename=pysftp-0.2.9-py3-none-any.whl size=15496 sha256=11c6c0deabfd0f5e2ddc73b7a6d2a8b5f01688c3b5fd7ea9c8adc631646c0db7
  Stored in directory: /Users/johannavogenstahl/Library/Caches/pip/wheels/72/aa/b2/489b05a4c1046ccbf628cb3a4bac193d8e0531c2edb21e4426
  Building wheel for future (setup.py) ... done
  Created wheel for future: filename=future-0.18.3-py3-none-any.whl size=492025 sha256=35d191a60e80b8e55283659f5eccec2c4b286194acec6d7003e8d97165342eca
  Stored in directory: /Users/johannavogenstahl/Library/Caches/pip/wheels/0c/ff/54/efb16da5b1058114a457b3c7167904915d2e5764b637ae8d3d
  Building wheel for pycurl (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [16 lines of output]
      Using curl-config (libcurl 7.79.1)
      Warning: libcurl is configured to use SSL, but we have not been able to determine which SSL backend it is using. If your Curl is built against OpenSSL, LibreSSL, BoringSSL, GnuTLS, NSS, mbedTLS, or Secure Transport please specify the SSL backend manually. For other SSL backends please ignore this message.Not using an SSL library
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.macosx-10.9-x86_64-cpython-39
      creating build/lib.macosx-10.9-x86_64-cpython-39/curl
      copying python/curl/__init__.py -> build/lib.macosx-10.9-x86_64-cpython-39/curl
      running build_ext
      building 'pycurl' extension
      creating build/temp.macosx-10.9-x86_64-cpython-39
      creating build/temp.macosx-10.9-x86_64-cpython-39/src
      clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /Users/johannavogenstahl/miniconda3/include -arch x86_64 -I/Users/johannavogenstahl/miniconda3/include -fPIC -O2 -isystem /Users/johannavogenstahl/miniconda3/include -arch x86_64 -DPYCURL_VERSION=\"7.45.2\" -DHAVE_CURL_SSL=1 -I/Users/johannavogenstahl/miniconda3/include/python3.9 -c src/docstrings.c -o build/temp.macosx-10.9-x86_64-cpython-39/src/docstrings.o
      xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
      error: command '/usr/bin/clang' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for pycurl
  Running setup.py clean for pycurl
  Building wheel for timeloop (setup.py) ... done
  Created wheel for timeloop: filename=timeloop-1.0.2-py3-none-any.whl size=3703 sha256=474e9ffc11efdb573b21e38c699ebc91cd6fe231a77a4b9cbf2a22e2befa0263
  Stored in directory: /Users/johannavogenstahl/Library/Caches/pip/wheels/c1/32/b4/1480823224ec0df9314b4785e7c399fbb2fef7e8bc1d95ee0c
Successfully built pysftp future timeloop
Failed to build pycurl
Installing collected packages: timeloop, pytz, boltons, zipp, xlrd, tzdata, typing_extensions, toml, tabulate, sqlparse, soupsieve, PyYAML, python-dateutil, pyparsing, pycurl, psutil, pillow, packaging, lxml, kiwisolver, future, fonttools, face, et-xmlfile, dill, cycler, contourpy, bcrypt, attrs, pynacl, pandas, openpyxl, importlib-resources, glom, beautifulsoup4, xarray, pyreadr, paramiko, matplotlib, rdata, pysftp, pypath-omnipath
  Running setup.py install for pycurl ... error
  error: subprocess-exited-with-error

  × Running setup.py install for pycurl did not run successfully.
  │ exit code: 1
  ╰─> [18 lines of output]
      Using curl-config (libcurl 7.79.1)
      Warning: libcurl is configured to use SSL, but we have not been able to determine which SSL backend it is using. If your Curl is built against OpenSSL, LibreSSL, BoringSSL, GnuTLS, NSS, mbedTLS, or Secure Transport please specify the SSL backend manually. For other SSL backends please ignore this message.Not using an SSL library
      running install
      /Users/johannavogenstahl/miniconda3/lib/python3.9/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      running build
      running build_py
      creating build
      creating build/lib.macosx-10.9-x86_64-cpython-39
      creating build/lib.macosx-10.9-x86_64-cpython-39/curl
      copying python/curl/__init__.py -> build/lib.macosx-10.9-x86_64-cpython-39/curl
      running build_ext
      building 'pycurl' extension
      creating build/temp.macosx-10.9-x86_64-cpython-39
      creating build/temp.macosx-10.9-x86_64-cpython-39/src
      clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /Users/johannavogenstahl/miniconda3/include -arch x86_64 -I/Users/johannavogenstahl/miniconda3/include -fPIC -O2 -isystem /Users/johannavogenstahl/miniconda3/include -arch x86_64 -DPYCURL_VERSION=\"7.45.2\" -DHAVE_CURL_SSL=1 -I/Users/johannavogenstahl/miniconda3/include/python3.9 -c src/docstrings.c -o build/temp.macosx-10.9-x86_64-cpython-39/src/docstrings.o
      xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
      error: command '/usr/bin/clang' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> pycurl

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
Collecting omnipath
  Using cached omnipath-1.0.6-py3-none-any.whl (41 kB)
Requirement already satisfied: tqdm>=4.51.0 in /Users/johannavogenstahl/miniconda3/lib/python3.9/site-packages (from omnipath) (4.64.1)
Requirement already satisfied: urllib3>=1.26.0 in /Users/johannavogenstahl/miniconda3/lib/python3.9/site-packages (from omnipath) (1.26.14)
Collecting packaging
  Using cached packaging-23.1-py3-none-any.whl (48 kB)
Collecting wrapt>=1.12.0
  Downloading wrapt-1.15.0-cp39-cp39-macosx_10_9_x86_64.whl (35 kB)
Collecting inflect>=4.1.0
  Using cached inflect-6.0.4-py3-none-any.whl (34 kB)
Collecting attrs>=20.2.0
  Using cached attrs-23.1.0-py3-none-any.whl (61 kB)
Requirement already satisfied: typing-extensions>=3.7.4.3 in /Users/johannavogenstahl/miniconda3/lib/python3.9/site-packages (from omnipath) (4.5.0)
Requirement already satisfied: requests>=2.24.0 in /Users/johannavogenstahl/miniconda3/lib/python3.9/site-packages (from omnipath) (2.28.1)
Collecting docrep>=0.3.1
  Using cached docrep-0.3.2.tar.gz (33 kB)
  Preparing metadata (setup.py) ... done
Collecting pandas>=1.2.0
  Using cached pandas-2.0.1-cp39-cp39-macosx_10_9_x86_64.whl (11.8 MB)
Requirement already satisfied: six in /Users/johannavogenstahl/miniconda3/lib/python3.9/site-packages (from docrep>=0.3.1->omnipath) (1.16.0)
Collecting pydantic>=1.9.1
  Downloading pydantic-1.10.7-cp39-cp39-macosx_10_9_x86_64.whl (2.9 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.9/2.9 MB 20.7 MB/s eta 0:00:0000:0100:01
Requirement already satisfied: numpy>=1.20.3 in /Users/johannavogenstahl/miniconda3/lib/python3.9/site-packages (from pandas>=1.2.0->omnipath) (1.24.3)
Requirement already satisfied: python-dateutil>=2.8.2 in /Users/johannavogenstahl/miniconda3/lib/python3.9/site-packages (from pandas>=1.2.0->omnipath) (2.8.2)
Requirement already satisfied: tzdata>=2022.1 in /Users/johannavogenstahl/miniconda3/lib/python3.9/site-packages (from pandas>=1.2.0->omnipath) (2023.3)
Requirement already satisfied: pytz>=2020.1 in /Users/johannavogenstahl/miniconda3/lib/python3.9/site-packages (from pandas>=1.2.0->omnipath) (2023.3)
Requirement already satisfied: idna<4,>=2.5 in /Users/johannavogenstahl/miniconda3/lib/python3.9/site-packages (from requests>=2.24.0->omnipath) (3.4)
Requirement already satisfied: certifi>=2017.4.17 in /Users/johannavogenstahl/miniconda3/lib/python3.9/site-packages (from requests>=2.24.0->omnipath) (2022.12.7)
Requirement already satisfied: charset-normalizer<3,>=2 in /Users/johannavogenstahl/miniconda3/lib/python3.9/site-packages (from requests>=2.24.0->omnipath) (2.0.4)
Building wheels for collected packages: docrep
  Building wheel for docrep (setup.py) ... done
  Created wheel for docrep: filename=docrep-0.3.2-py3-none-any.whl size=19877 sha256=a38f24abda33c80e2645d0da2f2110bae193d8b6624b1de1662d3193716896f4
  Stored in directory: /Users/johannavogenstahl/Library/Caches/pip/wheels/2d/65/94/106d18cba8b1c40e950207578d55bb442f3131c9f3b94b2553
Successfully built docrep
Installing collected packages: wrapt, pydantic, packaging, docrep, attrs, pandas, inflect, omnipath
Successfully installed attrs-23.1.0 docrep-0.3.2 inflect-6.0.4 omnipath-1.0.6 packaging-23.1 pandas-2.0.1 pydantic-1.10.7 wrapt-1.15.0
Collecting decoupler
  Using cached decoupler-1.3.4-py3-none-any.whl (76 kB)
Collecting anndata
  Downloading anndata-0.9.1-py3-none-any.whl (102 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 103.0/103.0 kB 2.9 MB/s eta 0:00:00
Collecting numba
  Downloading numba-0.56.4-cp39-cp39-macosx_10_14_x86_64.whl (2.4 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.4/2.4 MB 9.2 MB/s eta 0:00:00:00:0100:01
Requirement already satisfied: tqdm in /Users/johannavogenstahl/miniconda3/lib/python3.9/site-packages (from decoupler) (4.64.1)
Requirement already satisfied: typing-extensions in /Users/johannavogenstahl/miniconda3/lib/python3.9/site-packages (from decoupler) (4.5.0)
Collecting natsort
  Using cached natsort-8.3.1-py3-none-any.whl (38 kB)
Requirement already satisfied: numpy>=1.16.5 in /Users/johannavogenstahl/miniconda3/lib/python3.9/site-packages (from anndata->decoupler) (1.24.3)
Requirement already satisfied: pandas>=1.1.1 in /Users/johannavogenstahl/miniconda3/lib/python3.9/site-packages (from anndata->decoupler) (2.0.1)
Requirement already satisfied: packaging>=20 in /Users/johannavogenstahl/miniconda3/lib/python3.9/site-packages (from anndata->decoupler) (23.1)
Requirement already satisfied: scipy>1.4 in /Users/johannavogenstahl/miniconda3/lib/python3.9/site-packages (from anndata->decoupler) (1.10.1)
Collecting h5py>=3
  Downloading h5py-3.8.0-cp39-cp39-macosx_10_9_x86_64.whl (3.2 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.2/3.2 MB 10.0 MB/s eta 0:00:0000:0100:01
Collecting numpy>=1.16.5
  Downloading numpy-1.23.5-cp39-cp39-macosx_10_9_x86_64.whl (18.1 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 18.1/18.1 MB 13.1 MB/s eta 0:00:0000:0100:01
Collecting llvmlite<0.40,>=0.39.0dev0
  Downloading llvmlite-0.39.1-cp39-cp39-macosx_10_9_x86_64.whl (25.5 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 25.5/25.5 MB 12.1 MB/s eta 0:00:0000:0100:01
Requirement already satisfied: setuptools in /Users/johannavogenstahl/miniconda3/lib/python3.9/site-packages (from numba->decoupler) (65.6.3)
Requirement already satisfied: pytz>=2020.1 in /Users/johannavogenstahl/miniconda3/lib/python3.9/site-packages (from pandas>=1.1.1->anndata->decoupler) (2023.3)
Requirement already satisfied: tzdata>=2022.1 in /Users/johannavogenstahl/miniconda3/lib/python3.9/site-packages (from pandas>=1.1.1->anndata->decoupler) (2023.3)
Requirement already satisfied: python-dateutil>=2.8.2 in /Users/johannavogenstahl/miniconda3/lib/python3.9/site-packages (from pandas>=1.1.1->anndata->decoupler) (2.8.2)
Requirement already satisfied: six>=1.5 in /Users/johannavogenstahl/miniconda3/lib/python3.9/site-packages (from python-dateutil>=2.8.2->pandas>=1.1.1->anndata->decoupler) (1.16.0)
Installing collected packages: numpy, natsort, llvmlite, numba, h5py, anndata, decoupler
  Attempting uninstall: numpy
    Found existing installation: numpy 1.24.3
    Uninstalling numpy-1.24.3:
      Successfully uninstalled numpy-1.24.3
Successfully installed anndata-0.9.1 decoupler-1.3.4 h5py-3.8.0 llvmlite-0.39.1 natsort-8.3.1 numba-0.56.4 numpy-1.23.5
Processing ./corneto-0.9.1a0-py3-none-any.whl
Requirement already satisfied: numpy<2.0,>=1.16 in /Users/johannavogenstahl/miniconda3/lib/python3.9/site-packages (from corneto==0.9.1a0) (1.23.5)
Installing collected packages: corneto
Successfully installed corneto-0.9.1a0
---------------------------------------------------------------------------
TypingError                               Traceback (most recent call last)
<ipython-input-1-8cccc3bb254a> in <module>
      5 get_ipython().system('pip install corneto-0.9.1a0-py3-none-any.whl')
      6 
----> 7 import decoupler as dc

~/opt/anaconda3/lib/python3.7/site-packages/decoupler/__init__.py in <module>
     14 from .method_udt import run_udt  # noqa: F401
     15 from .method_ora import run_ora, test1r, get_ora_df  # noqa: F401
---> 16 from .method_gsva import run_gsva  # noqa: F401
     17 from .method_gsea import run_gsea  # noqa: F401
     18 from .method_viper import run_viper  # noqa: F401

~/opt/anaconda3/lib/python3.7/site-packages/decoupler/method_gsva.py in <module>
     80 
     81 
---> 82 @nb.njit(nb.types.Tuple((nb.f4[:, :], nb.i8[:, :]))(nb.f4[:, :]), parallel=True, cache=True)
     83 def nb_get_D_I(mat):
     84     n = mat.shape[1]

~/opt/anaconda3/lib/python3.7/site-packages/numba/decorators.py in wrapper(func)
    184             with typeinfer.register_dispatcher(disp):
    185                 for sig in sigs:
--> 186                     disp.compile(sig)
    187                 disp.disable_compile()
    188         return disp

~/opt/anaconda3/lib/python3.7/site-packages/numba/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 

~/opt/anaconda3/lib/python3.7/site-packages/numba/dispatcher.py in compile(self, sig)
    691 
    692             self._cache_misses[sig] += 1
--> 693             cres = self._compiler.compile(args, return_type)
    694             self.add_overload(cres)
    695             self._cache.save_overload(sig, cres)

~/opt/anaconda3/lib/python3.7/site-packages/numba/dispatcher.py in compile(self, args, return_type)
     78             return retval
     79         else:
---> 80             raise retval
     81 
     82     def _compile_cached(self, args, return_type):

~/opt/anaconda3/lib/python3.7/site-packages/numba/dispatcher.py in _compile_cached(self, args, return_type)
     88 
     89         try:
---> 90             retval = self._compile_core(args, return_type)
     91         except errors.TypingError as e:
     92             self._failed_cache[key] = e

~/opt/anaconda3/lib/python3.7/site-packages/numba/dispatcher.py in _compile_core(self, args, return_type)
    106                                       args=args, return_type=return_type,
    107                                       flags=flags, locals=self.locals,
--> 108                                       pipeline_class=self.pipeline_class)
    109         # Check typing error if object mode is used
    110         if cres.typing_error is not None and not flags.enable_pyobject:

~/opt/anaconda3/lib/python3.7/site-packages/numba/compiler.py in compile_extra(typingctx, targetctx, func, args, return_type, flags, locals, library, pipeline_class)
    970     pipeline = pipeline_class(typingctx, targetctx, library,
    971                               args, return_type, flags, locals)
--> 972     return pipeline.compile_extra(func)
    973 
    974 

~/opt/anaconda3/lib/python3.7/site-packages/numba/compiler.py in compile_extra(self, func)
    388         self.lifted = ()
    389         self.lifted_from = None
--> 390         return self._compile_bytecode()
    391 
    392     def compile_ir(self, func_ir, lifted=(), lifted_from=None):

~/opt/anaconda3/lib/python3.7/site-packages/numba/compiler.py in _compile_bytecode(self)
    901         """
    902         assert self.func_ir is None
--> 903         return self._compile_core()
    904 
    905     def _compile_ir(self):

~/opt/anaconda3/lib/python3.7/site-packages/numba/compiler.py in _compile_core(self)
    888         self.define_pipelines(pm)
    889         pm.finalize()
--> 890         res = pm.run(self.status)
    891         if res is not None:
    892             # Early pipeline completion

~/opt/anaconda3/lib/python3.7/site-packages/numba/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 

~/opt/anaconda3/lib/python3.7/site-packages/numba/compiler.py in run(self, status)
    264                     # No more fallback pipelines?
    265                     if is_final_pipeline:
--> 266                         raise patched_exception
    267                     # Go to next fallback pipeline
    268                     else:

~/opt/anaconda3/lib/python3.7/site-packages/numba/compiler.py in run(self, status)
    255                 try:
    256                     event("-- %s" % stage_name)
--> 257                     stage()
    258                 except _EarlyPipelineCompletion as e:
    259                     return e.result

~/opt/anaconda3/lib/python3.7/site-packages/numba/compiler.py in stage_nopython_frontend(self)
    513                 self.args,
    514                 self.return_type,
--> 515                 self.locals)
    516             self.typemap = typemap
    517             self.return_type = return_type

~/opt/anaconda3/lib/python3.7/site-packages/numba/compiler.py in type_inference_stage(typingctx, interp, args, return_type, locals)
   1122 
   1123         infer.build_constraint()
-> 1124         infer.propagate()
   1125         typemap, restype, calltypes = infer.unify()
   1126 

~/opt/anaconda3/lib/python3.7/site-packages/numba/typeinfer.py in propagate(self, raise_errors)
    925         if errors:
    926             if raise_errors:
--> 927                 raise errors[0]
    928             else:
    929                 return errors

TypingError: Failed in nopython mode pipeline (step: nopython frontend)
Invalid use of Function(<built-in function arange>) with argument(s) of type(s): (dtype=class(float32), start=int64, step=Literal[int](-1), stop=Literal[int](0))
 * parameterized
In definition 0:
    AssertionError: 
    raised from /Users/johannavogenstahl/opt/anaconda3/lib/python3.7/site-packages/numba/typing/npydecl.py:631
In definition 1:
    AssertionError: 
    raised from /Users/johannavogenstahl/opt/anaconda3/lib/python3.7/site-packages/numba/typing/npydecl.py:631
This error is usually caused by passing an argument of a type that is unsupported by the named function.
[1] During: resolving callee type: Function(<built-in function arange>)
[2] During: typing of call at /Users/johannavogenstahl/opt/anaconda3/lib/python3.7/site-packages/decoupler/method_gsva.py (85)

File "../../../opt/anaconda3/lib/python3.7/site-packages/decoupler/method_gsva.py", line 85:
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)
    ^
PauBadiaM commented 1 year ago

HI @jvogenstahl , Sorry for the delayed reply. I see two problems, the first one is that pycurl does not find SSL, which is a systems's library. I guess you need to install or load this first in google colab in order to be able to use install it properly.

Warning: libcurl is configured to use SSL, but we have not been able to determine which SSL backend it is using. If your Curl is built against OpenSSL, LibreSSL, BoringSSL, GnuTLS, NSS, mbedTLS, or Secure Transport please specify the SSL backend manually. For other SSL backends please ignore this message.Not using an SSL library

The second one is about numba compiling code, you could try to update numba as suggested in this thread.

I also saw that you are using python 3.7, maybe update it to 3.10 just in case.

@pablormier, did you encounter any of this issues?

deeenes commented 1 year ago

I think pycurl comes into the picture here due to pypath-omnipath, and that's not related to decoupler at all, finally we haven't used it in the tutorial at all. Feel free to remove the line

!pip install pypath-omnipath

The numba compilation error is independent and will stay around regardless. I would also highly recommend trying a more up-to-date Python, 3.10 or 3.11, and making sure all packages are up-to-date.

pablormier commented 1 year ago

Is this problem resolved? as @deeenes said, pypath-omnipath is not required. It is also recommended to install the dependencies using the right version of each tool, as in the original notebook. The issue seems to be related to incompatible versions between packages.