saezlab / pypath

Python module for prior knowledge integration. Builds databases of signaling pathways, enzyme-substrate interactions, complexes, annotations and intercellular communication roles.
http://omnipathdb.org/
GNU General Public License v3.0
135 stars 47 forks source link

Unable to load Omnipath #287

Closed alberto-valdeolivas closed 9 months ago

alberto-valdeolivas commented 9 months ago

Hi @deeenes, I hope you are doing great :).

Describe the bug I manage to install pypath without probelms in a conda environment that I am starting from scratch. However, I am getting the following error when trying to load in python:

>>> from pypath import omnipath
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/valdeola/scratch/conda/envs/BeSpace_funcAnalisys_env/lib/python3.10/site-packages/pypath/omnipath/__init__.py", line 25, in <module>
    from pypath.omnipath import app as _app_mod
  File "/home/valdeola/scratch/conda/envs/BeSpace_funcAnalisys_env/lib/python3.10/site-packages/pypath/omnipath/app.py", line 35, in <module>
    from pypath.core import annot
  File "/home/valdeola/scratch/conda/envs/BeSpace_funcAnalisys_env/lib/python3.10/site-packages/pypath/core/annot.py", line 37, in <module>
    import pypath.inputs.cellphonedb as cellphonedb
  File "/home/valdeola/scratch/conda/envs/BeSpace_funcAnalisys_env/lib/python3.10/site-packages/pypath/inputs/cellphonedb.py", line 30, in <module>
    import pypath.utils.mapping as mapping
  File "/home/valdeola/scratch/conda/envs/BeSpace_funcAnalisys_env/lib/python3.10/site-packages/pypath/utils/mapping.py", line 129, in <module>
    for it in ramp_input.ramp_id_types_2('compound')
  File "/home/valdeola/scratch/conda/envs/BeSpace_funcAnalisys_env/lib/python3.10/site-packages/pypath/inputs/ramp.py", line 200, in ramp_id_types_2
    for i in json.loads(c.result)['data']
  File "/home/valdeola/scratch/conda/envs/BeSpace_funcAnalisys_env/lib/python3.10/json/__init__.py", line 339, in loads
    raise TypeError(f'the JSON object must be str, bytes or bytearray, '
TypeError: the JSON object must be str, bytes or bytearray, not NoneType
>>>

To Reproduce I am just following the regular steps to create a conda environment containing pypath-omnipath in an HPC system.

  1. conda create --name myenv python=3.10
  2. conda activate myenv
  3. pip install pypath-omnipath
  4. python3
  5. >>> from pypath import omnipath

And I got the error message dispalyed above.

Log file Please attach the log file or at least the last few lines of it. This way we can see better exactly at which operation and at processing of which dataset the error occured.

Desktop (please complete the following information):

I have also tried with other versions of Python (3.11 and 3.12), but I was getting the same error.

deeenes commented 9 months ago

Hi Alberto, I hope you too are doing well! :)

This particular trace means nothing else than a download error. First I would simply try again, if it fails same or similar way, then it's time to look into the logs, or try from another network.

Also, building a database by the pypath.omnipath module will likely fail this time, because many refactoring happened in the past months, and there are still a few things to clean up. I want to do a public database build before end of March, then I have to fix all the remaining issues and after that, the situation will be better.

If you let me know which particular data you want to access, maybe I can help more.

Denes

alberto-valdeolivas commented 9 months ago

Thanks @deeenes for you quick reply!

It worked today! However, I have this error now:

>>> from pypath import omnipath
>>> from pypath.utils import mapping
>>> from pypath.utils import homology
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name 'homology' from 'pypath.utils'

Is it orthology.py now?

I guess it is due to the refactoring. Should I install the pip version instead of the one from github while you are working on this refactoring?

I am actually basically trying to run Progeny, CollecTri and Enrichment Analysis from decoupler with homology transformation for other species such as rat, pig or cyno.

Best regards, Alberto.

deeenes commented 9 months ago

Is it orthology.py now?

I guess it is due to the refactoring. Should I install the pip version instead of the one from github while you are working on this refactoring?

The git version is better, or they are identical. This change is permanent, the name will stay orthology. First I thought it doesn't make sense to maintain the old name in this case, but for the translate... functions that could be useful, so I made it a synonym (05f13bec4).

I am actually basically trying to run Progeny, CollecTri and Enrichment Analysis from decoupler with homology transformation for other species such as rat, pig or cyno.

Okay, that should work :)

alberto-valdeolivas commented 9 months ago

Thanks Denes! Everything is fine now! :)