comet-ml / issue-tracking

Questions, Help, and Issues for Comet ML
https://www.comet.ml
85 stars 7 forks source link

AttributeError: module 'websocket' has no attribute '_abnf' #502

Closed ashok-arjun closed 1 year ago

ashok-arjun commented 1 year ago

Describe the Bug

When I execute experiment.end(), I get this error (stack trace below).

I am executing this colab notebook as is but in a local jupyter notebook.

However, this error doesn't come up in colab/kaggle, it only comes up when I use comet locally in my jupyter notebook.

I have ensured that websocket is in the right compatible version (1.3.3).

Stack Trace

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[47], line 128
    125     print('Test Accuracy of the model on the 10000 test images: %d %%' % (100 * correct / total))
    127 #make sure to end the experiment when your code is done running
--> 128 experiment.end()

File ~/.conda/envs/tactis/lib/python3.10/site-packages/comet_ml/experiment.py:670, in BaseExperiment.end(self)
    666 def end(self):
    667     """
    668     Use to indicate that the experiment is complete.
    669     """
--> 670     self._on_end(wait=True)

File ~/.conda/envs/tactis/lib/python3.10/site-packages/comet_ml/_online.py:621, in Experiment._on_end(self, wait)
    619 # If we didn't drain the streamer, don't close the websocket connection
    620 if self.ws_connection is not None and wait is True:
--> 621     self.ws_connection.close()
    622     LOGGER.debug("Waiting for WS connection to close")
    623     if wait is True:

File ~/.conda/envs/tactis/lib/python3.10/site-packages/comet_ml/connection.py:1346, in WebSocketConnection.close(self)
   1342 # Send the close opcode frame and let the thread clean itself properly
   1343 try:
   1344     # Copied from https://github.com/websocket-client/websocket-client/blob/29c15714ac9f5272e1adefc9c99b83420b409f63/websocket/_core.py#L410
   1345     self.ws.send(
-> 1346         struct.pack("!H", websocket._abnf.STATUS_NORMAL),
   1347         websocket._abnf.ABNF.OPCODE_CLOSE,
   1348     )
   1349 except WebSocketConnectionClosedException:
   1350     # Make sure we don't start create back the websocket connection
   1351     self.ws.keep_running = False

AttributeError: module 'websocket' has no attribute '_abnf'
dsblank commented 1 year ago

It looks like your Jupyter Notebook environment has been corrupted. Can you try "pip uninstall comet_ml" and "pip install comet_ml" to see if that fixes the issue?