theislab / graphcompass

GraphCompass: Graph Comparison Tools for Differential Analyses in Spatial Systems
MIT License
34 stars 0 forks source link

joblib.externals.loky.process_executor.BrokenProcessPool: A result has failed to un-serialize. Please ensure that the objects returned by the function are always picklable. #64

Closed spatts14 closed 2 weeks ago

spatts14 commented 3 months ago

Hello!

I'm having a bit of an issue. I have V=0.2.3

I'm running this line of code:

gc.tl.distance.compare_conditions(
    adata=adata,
    library_key=library_key,
    cluster_key=cluster_key,
    method="diffusion",
    compute_spatial_graphs=False,
     kwargs_spatial_neighbors={
         'coord_type': 'generic',
         'delaunay': True,  
     }  
)

This is the error I'm getting

  0%|          | 0/21 [00:00<?, ?it/s]
  5%|▍         | 1/21 [00:09<03:00,  9.01s/it]
 10%|▉         | 2/21 [00:24<04:07, 13.00s/it]
 14%|█▍        | 3/21 [00:41<04:21, 14.52s/it]
 14%|█▍        | 3/21 [07:15<43:31, 145.08s/it]
joblib.externals.loky.process_executor._RemoteTraceback: 
"""
Traceback (most recent call last):
  File "/rds/general/user/sep22/home/anaconda3/envs/graphcompass_HPC/lib/python3.11/site-packages/joblib/externals/loky/process_executor.py", line 661, in wait_result_broken_or_wakeup
    result_item = result_reader.recv()
                  ^^^^^^^^^^^^^^^^^^^^
  File "/rds/general/user/sep22/home/anaconda3/envs/graphcompass_HPC/lib/python3.11/multiprocessing/connection.py", line 251, in recv
    return _ForkingPickler.loads(buf.getbuffer())
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/rds/general/user/sep22/home/anaconda3/envs/graphcompass_HPC/lib/python3.11/site-packages/tblib/pickling_support.py", line 28, in unpickle_exception
    inst = func(*args)
           ^^^^^^^^^^^
TypeError: ArpackNoConvergence.__init__() missing 2 required positional arguments: 'eigenvalues' and 'eigenvectors'
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/rds/general/user/sep22/home/IMC_analysis/Graph_Compass/scripts/graph_compass_script.py", line 150, in <module>
    gc.tl.distance.compare_conditions(
  File "/rds/general/user/sep22/home/anaconda3/envs/graphcompass_HPC/lib/python3.11/site-packages/graphcompass/tl/_distance.py", line 113, in compare_conditions
    pairwise_similarities = _calculate_graph_distances(
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/rds/general/user/sep22/home/anaconda3/envs/graphcompass_HPC/lib/python3.11/site-packages/graphcompass/tl/_distance.py", line 167, in _calculate_graph_distances
    out = Parallel(n_jobs=n_jobs)(
          ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/rds/general/user/sep22/home/anaconda3/envs/graphcompass_HPC/lib/python3.11/site-packages/joblib/parallel.py", line 1952, in __call__
    return output if self.return_generator else list(output)
                                                ^^^^^^^^^^^^
  File "/rds/general/user/sep22/home/anaconda3/envs/graphcompass_HPC/lib/python3.11/site-packages/joblib/parallel.py", line 1595, in _get_outputs
    yield from self._retrieve()
  File "/rds/general/user/sep22/home/anaconda3/envs/graphcompass_HPC/lib/python3.11/site-packages/joblib/parallel.py", line 1699, in _retrieve
    self._raise_error_fast()
  File "/rds/general/user/sep22/home/anaconda3/envs/graphcompass_HPC/lib/python3.11/site-packages/joblib/parallel.py", line 1734, in _raise_error_fast
    error_job.get_result(self.timeout)
  File "/rds/general/user/sep22/home/anaconda3/envs/graphcompass_HPC/lib/python3.11/site-packages/joblib/parallel.py", line 736, in get_result
    return self._return_or_raise()
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/rds/general/user/sep22/home/anaconda3/envs/graphcompass_HPC/lib/python3.11/site-packages/joblib/parallel.py", line 754, in _return_or_raise
    raise self._result
joblib.externals.loky.process_executor.BrokenProcessPool: A result has failed to un-serialize. Please ensure that the objects returned by the function are always picklable.
merelkuijs commented 3 months ago

The error you're seeing (ArpackNoConvergence.__init__() missing 2 required positional arguments: 'eigenvalues' and 'eigenvectors') indicates that an ArpackNoConvergence exception was raised, which occurs when the ARPACK solver (used in eigenvalue problems) fails to converge. This might be due to the nature of your data:

  1. If the data being processed exceeds the memory limits, the ARPACK solver may fail due to insufficient resources.
  2. Eigenvalues and eigenvectors may furthermore be difficult or impossible to compute accurately for certain matrices due to various properties (e.g., nearly singular matrices, ill-conditioning).

Since I don't have access to your data, it's difficult to determine the exact nature of your problem. Could you try to apply the function to our example dataset, gc.datasets.mibitof_breast_cancer()? If that works, the error is most likely due to the nature of your data.

merelkuijs commented 3 months ago

By the way, we do not yet have a visualization function to visualize diffusion results. To compare subgraphs and visualize the results, you could use the portrait method:

gc.tl.distance.compare_conditions(
    adata=adata,
    library_key=library_key,
    cluster_key=cluster_key,
    method="portrait",
    compute_spatial_graphs=False,
     kwargs_spatial_neighbors={
         'coord_type': 'generic',
         'delaunay': True,  
     }  
)
mayarali commented 1 month ago

Hi @spatts14, can you please confirm that this has been resolved using the latest version?

mayarali commented 2 weeks ago

Closing this issue due to inactivity.

@spatts14, feel free to reopen or create a new issue if you encounter further errors or have additional questions. Thanks!