LernerLab / GuPPy

Guided Photometry Analysis in Python, a free and open-source FP analysis tool.
GNU General Public License v3.0
63 stars 11 forks source link

AssertionError when opening server #75

Closed MannyEsguerra closed 5 months ago

MannyEsguerra commented 6 months ago

I am using latest GupPy. When I invoke the server, I get this error right away:

(guppy) D:\Packages\GuPPy-main\GuPPy>panel serve --show savingInputParameters.ipynb
2024-02-14 10:30:00,763 Starting Bokeh server version 2.4.3 (running on Tornado 6.2)
2024-02-14 10:30:00,763 User authentication hooks NOT provided (default user enabled)
2024-02-14 10:30:00,778 Bokeh app running at: http://localhost:5006/savingInputParameters
2024-02-14 10:30:00,778 Starting Bokeh server with process id: 10580
Folder path set to D:/Data/Spencer Lab/Hernandez_iGluSNFR
2024-02-14 10:30:08,846 Starting Bokeh server version 2.4.3 (running on Tornado 6.2)
2024-02-14 10:30:08,847 User authentication hooks NOT provided (default user enabled)
Launching server at http://localhost:49436
2024-02-14 10:30:08,853 Error running application handler <bokeh.application.handlers.notebook.NotebookHandler object at 0x000001AA276B3CD0>:
File 'windows_events.py', line 319, in run_forever:
assert self._self_reading_future is None Traceback (most recent call last):
  File "C:\Users\Windows\anaconda3\envs\guppy\lib\site-packages\bokeh\application\handlers\code_runner.py", line 231, in run
    exec(self._code, module.__dict__)
  File "D:\Packages\GuPPy-main\GuPPy\savingInputParameters.ipynb", line 529, in <module>
    "template.main.append(visualize)\n",
  File "C:\Users\Windows\anaconda3\envs\guppy\lib\site-packages\panel\viewable.py", line 424, in show
    return serve(
  File "C:\Users\Windows\anaconda3\envs\guppy\lib\site-packages\panel\io\server.py", line 605, in serve
    return get_server(panels, **kwargs)
  File "C:\Users\Windows\anaconda3\envs\guppy\lib\site-packages\panel\io\server.py", line 835, in get_server
    server.io_loop.start()
  File "C:\Users\Windows\anaconda3\envs\guppy\lib\site-packages\tornado\platform\asyncio.py", line 215, in start
    self.asyncio_loop.run_forever()
  File "C:\Users\Windows\anaconda3\envs\guppy\lib\asyncio\windows_events.py", line 319, in run_forever
    assert self._self_reading_future is None
AssertionError

What does this mean? It doesn't seem to affect program function. Thank you.

venus-sherathiya commented 6 months ago

Did you change anything in the conda environment ?

MannyEsguerra commented 6 months ago

When this problem appeared, I deleted the old conda environment, built a new one, and reinstalled all the dependencies from scratch. What do you have in mind?

venus-sherathiya commented 6 months ago

You are on Ubuntu, right ?

MannyEsguerra commented 6 months ago

Windows 10.

Maybe unrelated, one thing I've noticed in latest Windows build, the software sometimes looks for modules in the wrong directory, as if the path is Guppy-Main\Guppy\Guppy. I got around it by creating that second Guppy subdirectory and copying the files to it. Works, but probably a bad idea?

If you need more specifics I can try to re-create the issue.

MannyEsguerra commented 6 months ago

I looked around the Bokeh forums and apparently this is error is known and harmless (?) behavior when using Panel, eg:

https://discourse.bokeh.org/t/permission-error-running-bokeh-server/10520/2

venus-sherathiya commented 6 months ago

Lets do one thing Open Anaconda prompt window and execute the following commands one by one conda remove --name guppy --all conda clean --all

After this, follow the instructions from Github to create a new conda environment

For launching GuPPy, there are little changes in the step. Please look at the instructions on Github. You do the following for launching GuPPy conda activate guppy cd path_to_guppy_main_folder panel serve --show GuPPy/savingInputParameters.ipynb

Please let me know if it works or not

MannyEsguerra commented 6 months ago

Still getting assertion error. But also after removing the environment and clearing variables, when I reinstall Guppy it still brings up previously used storenames. I've removed all Guppy generated files like output folders, parameters etc.

venus-sherathiya commented 6 months ago

GuPPy was running fine in this machine before ?

MannyEsguerra commented 6 months ago

Yes, it was running fine. Sorry I don't know what the last good version was. For a totally fresh start do I need to clear anything else in addition to removing the conda environment and previous Outputs?

Manuel Esguerra, Ph.D. Research Assistant Professor, Department of Neuroscience https://med.umn.edu/neuroscience

University of Minnesota Medical Discovery Team - Addiction https://med.umn.edu/addictionmdt Lions Research Building/McGuire Translational Research Facility 3-432 2001 6th St SE, Minneapolis MN 55455 (612) 624-3075

On Fri, Feb 16, 2024 at 8:59 AM Venus Sherathiya @.***> wrote:

GuPPy was running fine in this machine before ?

— Reply to this email directly, view it on GitHub https://github.com/LernerLab/GuPPy/issues/75#issuecomment-1948538720, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALFIVZFKDV622YWBOIIAIR3YT5X4RAVCNFSM6AAAAABDITC7J6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNBYGUZTQNZSGA . You are receiving this because you authored the thread.Message ID: @.***>

venus-sherathiya commented 6 months ago

conda remove --name guppy --all conda clean --all

These two commands will remove conda environment. Fetch the most recent code from Github main branch. Reinstall conda environment. You do need to delete anything else Please try launching GuPPy. If it still does not work, I think we need to meet on a zoom and figure it out because I do not understand what's the issue here

MannyEsguerra commented 6 months ago

I did all that already. I still get the assertion error which is supposedly harmless, according to Bokeh forums. But it's still strange that I have old storenames populating the interface. Is that expected behavior if I did conda remove and conda clean? Where are those variables stored?

Manuel Esguerra, Ph.D. Research Assistant Professor, Department of Neuroscience https://med.umn.edu/neuroscience

University of Minnesota Medical Discovery Team - Addiction https://med.umn.edu/addictionmdt Lions Research Building/McGuire Translational Research Facility 3-432 2001 6th St SE, Minneapolis MN 55455 (612) 624-3075

On Fri, Feb 16, 2024 at 10:22 AM Venus Sherathiya @.***> wrote:

Lets do one thing Open Anaconda prompt window and execute the following commands one by one conda remove --name guppy --all conda clean --all

These two commands will remove conda environment. Reinstall it. You do need to delete anything else Fetch the most recent code from Github main branch. And try launching GuPPy

— Reply to this email directly, view it on GitHub https://github.com/LernerLab/GuPPy/issues/75#issuecomment-1948795574, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALFIVZDWTZFJPCCTV5GFLN3YT6BTXAVCNFSM6AAAAABDITC7J6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNBYG44TKNJXGQ . You are receiving this because you authored the thread.Message ID: @.***>

venus-sherathiya commented 6 months ago

Assertion error is happening because there is something wrong.

The line which says "User authentication hooks not provided", it is harmless.

Old storenames will populate even if you remove conda because it's independent of conda environement. If we figure this out, I will let you know how to get rid of it.

lets try one last thing cd path_guppy_main_folder conda update -n guppy --file spec_file_windows10.txt

Try this. This is the last thing we can try. Please let me know about it

Also, even with assertion error, GuPPy runs fine ?

MannyEsguerra commented 6 months ago

I tried updating the spec_file as suggested, then rebuilt the environment. Still get the assertion error from the asyncio package. I also tried updating spec_file without rebuilding (which doesn't really make sense?) and same error. Defaults are still present as well (Start folder, Storenames).

Manuel Esguerra, Ph.D. Research Assistant Professor, Department of Neuroscience https://med.umn.edu/neuroscience

University of Minnesota Medical Discovery Team - Addiction https://med.umn.edu/addictionmdt Lions Research Building/McGuire Translational Research Facility 3-432 2001 6th St SE, Minneapolis MN 55455 (612) 624-3075

On Fri, Feb 16, 2024 at 10:37 AM Venus Sherathiya @.***> wrote:

Assertion error is happening because there is something wrong.

The line which says "User authentication hooks not provided", it is harmless.

lets try one last thing cd path_guppy_main_folder conda update -n guppy --file spec_file_windows10.txt

Try this. This is the last thing we can try. Please let me know about it `

— Reply to this email directly, view it on GitHub https://github.com/LernerLab/GuPPy/issues/75#issuecomment-1948839792, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALFIVZEG55DRVLUYZ2Q2KSTYT6DNBAVCNFSM6AAAAABDITC7J6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNBYHAZTSNZZGI . You are receiving this because you authored the thread.Message ID: @.***>

MannyEsguerra commented 6 months ago

Adding: all analysis steps work through PSTH Computation. However when choosing Visualizaiton GUI, I am getting a similar error. The Visualization GUI tab still opens.

2024-02-16 13:29:28,357 Starting Bokeh server version 2.4.3 (running on Tornado 6.2)
2024-02-16 13:29:28,357 User authentication hooks NOT provided (default user enabled)
Launching server at http://localhost:5143
2024-02-16 13:29:28,360 error handling message
 message: Message 'PATCH-DOC' content: {'events': [{'kind': 'MessageSent', 'msg_type': 'bokeh_event', 'msg_data': {'event_name': 'button_click', 'event_values': {}}}], 'references': []}
 error: AssertionError()
Traceback (most recent call last):
  File "C:\Users\Windows\anaconda3\envs\guppy\lib\site-packages\bokeh\server\protocol_handler.py", line 97, in handle
    work = await handler(message, connection)
  File "C:\Users\Windows\anaconda3\envs\guppy\lib\site-packages\bokeh\server\session.py", line 95, in _needs_document_lock_wrapper
    result = func(self, *args, **kwargs)
  File "C:\Users\Windows\anaconda3\envs\guppy\lib\site-packages\bokeh\server\session.py", line 289, in _handle_patch
    message.apply_to_document(self.document, self)
  File "C:\Users\Windows\anaconda3\envs\guppy\lib\site-packages\bokeh\protocol\messages\patch_doc.py", line 115, in apply_to_document
    invoke_with_curdoc(doc, lambda: doc.apply_json_patch(self.content, setter))
  File "C:\Users\Windows\anaconda3\envs\guppy\lib\site-packages\bokeh\document\callbacks.py", line 408, in invoke_with_curdoc
    return f()
  File "C:\Users\Windows\anaconda3\envs\guppy\lib\site-packages\bokeh\protocol\messages\patch_doc.py", line 115, in <lambda>
    invoke_with_curdoc(doc, lambda: doc.apply_json_patch(self.content, setter))
  File "C:\Users\Windows\anaconda3\envs\guppy\lib\site-packages\bokeh\document\document.py", line 391, in apply_json_patch
    DocumentPatchedEvent.handle_json(self, event_json, references, setter)
  File "C:\Users\Windows\anaconda3\envs\guppy\lib\site-packages\bokeh\document\events.py", line 259, in handle_json
    handler(doc, event_json, references, setter)
  File "C:\Users\Windows\anaconda3\envs\guppy\lib\site-packages\bokeh\document\events.py", line 300, in _handle_json
    cb(event_json["msg_data"])
  File "C:\Users\Windows\anaconda3\envs\guppy\lib\site-packages\bokeh\document\callbacks.py", line 355, in trigger_json_event
    model._trigger_event(event)
  File "C:\Users\Windows\anaconda3\envs\guppy\lib\site-packages\bokeh\util\callback_manager.py", line 119, in _trigger_event
    self.document.callbacks.notify_event(cast(Model, self), event, invoke)
  File "C:\Users\Windows\anaconda3\envs\guppy\lib\site-packages\bokeh\document\callbacks.py", line 247, in notify_event
    invoke_with_curdoc(doc, callback_invoker)
  File "C:\Users\Windows\anaconda3\envs\guppy\lib\site-packages\bokeh\document\callbacks.py", line 408, in invoke_with_curdoc
    return f()
  File "C:\Users\Windows\anaconda3\envs\guppy\lib\site-packages\bokeh\util\callback_manager.py", line 115, in invoke
    cast(EventCallbackWithEvent, callback)(event)
  File "C:\Users\Windows\anaconda3\envs\guppy\lib\site-packages\panel\reactive.py", line 406, in _server_event
    self._comm_event(event)
  File "C:\Users\Windows\anaconda3\envs\guppy\lib\site-packages\panel\reactive.py", line 398, in _comm_event
    self._process_bokeh_event(event)
  File "C:\Users\Windows\anaconda3\envs\guppy\lib\site-packages\panel\reactive.py", line 345, in _process_bokeh_event
    self._process_event(event)
  File "C:\Users\Windows\anaconda3\envs\guppy\lib\site-packages\panel\widgets\button.py", line 176, in _process_event
    self.clicks += 1
  File "C:\Users\Windows\anaconda3\envs\guppy\lib\site-packages\param\parameterized.py", line 367, in _f
    instance_param.__set__(obj, val)
  File "C:\Users\Windows\anaconda3\envs\guppy\lib\site-packages\param\parameterized.py", line 369, in _f
    return f(self, obj, val)
  File "C:\Users\Windows\anaconda3\envs\guppy\lib\site-packages\param\__init__.py", line 625, in __set__
    super(Dynamic,self).__set__(obj,val)
  File "C:\Users\Windows\anaconda3\envs\guppy\lib\site-packages\param\parameterized.py", line 369, in _f
    return f(self, obj, val)
  File "C:\Users\Windows\anaconda3\envs\guppy\lib\site-packages\param\parameterized.py", line 1252, in __set__
    obj.param._call_watcher(watcher, event)
  File "C:\Users\Windows\anaconda3\envs\guppy\lib\site-packages\param\parameterized.py", line 2043, in _call_watcher
    self_._execute_watcher(watcher, (event,))
  File "C:\Users\Windows\anaconda3\envs\guppy\lib\site-packages\param\parameterized.py", line 2025, in _execute_watcher
    watcher.fn(*args, **kwargs)
  File "D:\Packages\GuPPy-main\guppy\savinginputparameters.ipynb", line 445, in onclickVisualization
    "def onclickVisualization(event=None):\n",
  File "D:\Packages\GuPPy-main\guppy\visualizePlot.py", line 688, in visualizeResults
    createPlots(filepath, storesList[1,:], inputParameters)
  File "D:\Packages\GuPPy-main\guppy\visualizePlot.py", line 630, in createPlots
    helper_plots(filepath, event, name_arr, inputParameters)
  File "D:\Packages\GuPPy-main\guppy\visualizePlot.py", line 586, in helper_plots
    template.show(port=number)
  File "C:\Users\Windows\anaconda3\envs\guppy\lib\site-packages\panel\viewable.py", line 424, in show
    return serve(
  File "C:\Users\Windows\anaconda3\envs\guppy\lib\site-packages\panel\io\server.py", line 605, in serve
    return get_server(panels, **kwargs)
  File "C:\Users\Windows\anaconda3\envs\guppy\lib\site-packages\panel\io\server.py", line 835, in get_server
    server.io_loop.start()
  File "C:\Users\Windows\anaconda3\envs\guppy\lib\site-packages\tornado\platform\asyncio.py", line 215, in start
    self.asyncio_loop.run_forever()
  File "C:\Users\Windows\anaconda3\envs\guppy\lib\asyncio\windows_events.py", line 319, in run_forever
    assert self._self_reading_future is None
AssertionError
2024-02-16 13:29:39,683 WebSocket connection opened
2024-02-16 13:29:39,685 ServerConnection created
venus-sherathiya commented 6 months ago

Can you please send me your availability for next week ? Let us meet on zoom and figure it out.

MannyEsguerra commented 6 months ago

Next week I could meet after 2pm on Tues 20, Weds 21, or Friday 23. Thank you.

venus-sherathiya commented 6 months ago

Can you please send me an email at venus.sherathiya@northwestern.edu ?

venus-sherathiya commented 5 months ago

Hello Manny,

Please get the updated code from GitHub and follow the instructions from the Github Wiki page. I hope this will solve the issue. Please let me know if it does not work out.

MannyEsguerra commented 5 months ago

The server started without errors. Thank you!