magland / sortingview

Web app for viewing results of ephys spike sorting
Apache License 2.0
24 stars 8 forks source link

problem with pubnub package #200

Closed lfrank closed 2 years ago

lfrank commented 2 years ago

Currently when we try to import the latest version of sortingview we get an error (see below) which seems to have been introduced in the just-released 6.4.0 version of pubnub.

This is just FYI, but if it gets fixed we'd appreciate knowing so we can remove the version restriction that we now need...

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
Input In [2], in <cell line: 17>()
     13 import spyglass.common as sgc
     15 from spyglass.common import (Session, IntervalList,LabMember, LabTeam, Raw, Session, Nwbfile,
     16                             Electrode)#,SpikeSortingView)
---> 17 import spyglass.spikesorting as ss

File ~/Src/spyglass/spyglass/src/spyglass/spikesorting/__init__.py:1, in <module>
----> 1 from .sortingview import SortingviewWorkspace, SortingviewWorkspaceSelection
      2 from .spikesorting_artifact import (ArtifactDetection,
      3                                     ArtifactDetectionParameters,
      4                                     ArtifactDetectionSelection,
      5                                     ArtifactRemovedIntervalList)
      6 from .spikesorting_curation import (AutomaticCuration,
      7                                     AutomaticCurationParameters,
      8                                     AutomaticCurationSelection,
   (...)
     12                                     QualityMetrics, WaveformParameters,
     13                                     Waveforms, WaveformSelection)

File ~/Src/spyglass/spyglass/src/spyglass/spikesorting/sortingview.py:2, in <module>
      1 import datajoint as dj
----> 2 import sortingview as sv
      4 from ..common.common_lab import LabTeam, LabMember
      5 from .sortingview_helper_fn import (_add_metrics_to_sorting_in_workspace,
      6                                     _create_spikesortingview_workspace,
      7                                     _set_workspace_permission)

File ~/miniconda2/envs/spyglass/lib/python3.9/site-packages/sortingview/__init__.py:2, in <module>
      1 from .version import __version__
----> 2 from .backend.start_backend_cli import start_backend_cli
      3 from .backend.start_backend import start_backend
      4 from .workspace import load_workspace, create_workspace, Workspace

File ~/miniconda2/envs/spyglass/lib/python3.9/site-packages/sortingview/backend/start_backend_cli.py:2, in <module>
      1 import click
----> 2 from .start_backend import start_backend
      4 @click.command('sortingview-start-backend')
      5 @click.option('--project', required=False, default='', help="The kachery-cloud project ID")
      6 @click.option('--backend-id', required=False, default='', help="The backend ID")
      7 def start_backend_cli(project: str, backend_id: str):
      8     pid = project if project != '' else None

File ~/miniconda2/envs/spyglass/lib/python3.9/site-packages/sortingview/backend/start_backend.py:5, in <module>
      3 import numpy as np
      4 import h5py
----> 5 from kachery_cloud.TaskBackend import TaskBackend
      6 import kachery_cloud as kcl
      7 from ..SpikeSortingView import SpikeSortingView

File ~/miniconda2/envs/spyglass/lib/python3.9/site-packages/kachery_cloud/__init__.py:3, in <module>
      1 from .store_file import store_file
      2 from .load_file import load_file
----> 3 from .request_file_experimental import request_file_experimental
      4 from .store_file_local import store_file_local
      5 from .link_file import link_file

File ~/miniconda2/envs/spyglass/lib/python3.9/site-packages/kachery_cloud/request_file_experimental.py:2, in <module>
      1 from typing import Union
----> 2 from .TaskBackend.TaskClient import TaskClient, TaskErrorException
      3 from .load_file import load_file
      4 from ._access_group_encrypt import _access_group_decrypt

File ~/miniconda2/envs/spyglass/lib/python3.9/site-packages/kachery_cloud/TaskBackend/__init__.py:7, in <module>
      3 except:
      4     # Let's not require pubnub by default - require user to install it manually if needed
      5     raise Exception('Pubnub not installed. To install run: pip install pubnub')
----> 7 from .TaskBackend import TaskBackend
      8 from .TaskClient import TaskClient
      9 from .upload_task_result import upload_task_result, download_task_result

File ~/miniconda2/envs/spyglass/lib/python3.9/site-packages/kachery_cloud/TaskBackend/TaskBackend.py:4, in <module>
      2 import random
      3 from typing import Callable, Dict, Union
----> 4 from .TaskClient import TaskClient
      5 from ._run_task import _run_task
      6 from ..get_project_id import get_project_id

File ~/miniconda2/envs/spyglass/lib/python3.9/site-packages/kachery_cloud/TaskBackend/TaskClient.py:7, in <module>
      5 from ..get_project_id import get_project_id
      6 from .upload_task_result import upload_task_result, download_task_result
----> 7 from .PubsubListener import PubsubListener
      8 from .._kacherycloud_request import _kacherycloud_request
      9 from ..get_client_id import get_client_id

File ~/miniconda2/envs/spyglass/lib/python3.9/site-packages/kachery_cloud/TaskBackend/PubsubListener.py:5, in <module>
      2 import time
      4 from pubnub.pnconfiguration import PNConfiguration
----> 5 from pubnub.pubnub import PubNub
      6 from pubnub.callbacks import SubscribeCallback
      7 from pubnub.enums import PNStatusCategory

File ~/miniconda2/envs/spyglass/lib/python3.9/site-packages/pubnub/pubnub.py:18, in <module>
     16 from .models.consumer.common import PNStatus
     17 from .pnconfiguration import PNConfiguration
---> 18 from .pubnub_core import PubNubCore
     19 from .structures import PlatformOptions
     20 from .workers import SubscribeMessageWorker

File ~/miniconda2/envs/spyglass/lib/python3.9/site-packages/pubnub/pubnub_core.py:3, in <module>
      1 import logging
      2 import time
----> 3 from pubnub.endpoints.entities.membership.add_memberships import AddSpaceMembers, AddUserSpaces
      4 from pubnub.endpoints.entities.membership.update_memberships import UpdateSpaceMembers, UpdateUserSpaces
      5 from pubnub.endpoints.entities.membership.fetch_memberships import FetchSpaceMemberships, FetchUserMemberships

ModuleNotFoundError: No module named 'pubnub.endpoints.entities'
magland commented 2 years ago

@lfrank Thanks for that report! Yes, the third party pubnub 6.4.0 made a breaking change, so I've updated the dependencies to exclude that release. Upgrading to sortingview >= 0.9.6 should fix this. Alternatively, you can force install pubnub 6.3.3