When I run this cell on Jupyter notebook, my visualization window remains. When I run this as a script, it doesnβt. Iβve tried toggling the block argument in the mne.viz.Brain, but doing so only blocks the program from executing all of the lines below. It wonβt include data. Any advice? I appreciate it.
The reason for the windows closing is that Python simply exits once the end of the script is reached. What you can do to prevent this behavior is run python -i your_script.py (interactive mode).
I appreciate the warm welcome. This community is great. Following your advice, I ran python3 -i your_script.py several times. Even though the window remains open, I still canβt interact with the visualization.
My current strategy is to step through each cleanup and destroy step until the window is open and interactive. Iβve tried running python3 -v your_script.py to inspect all of the steps from the end of the visualization to its close. Is this strategy effective? If not, what are some other things I can try?
I think we need more info about your setup and how exactly the problem manifests. If I download the example you linked to as a .py file, open a terminal in that folder, and type python -i brain.py I get 6 open windows, all of which I can click-drag in to rotate the brains around.
Can you say more about what happens when you do that? Please also share the output of python -c "import mne; print(mne.sys_info())"
When I enter my directoryβs pipenv and run python3 -i brain.py (note the lowercase i flag), I see six windows open but remain non-interactive; on my Mac, the color wheel spins indefinitely. No errors are printed out in the terminal. Here is a 45-second video demo of the issue: https://youtu.be/Lp15KkYfWqM
When I run python3 -c "import mne; print(mne.sys_info())", I get
Platform macOS-13.5.2-arm64-arm-64bit
Python 3.9.6 (default, Aug 11 2023, 19:44:49) [Clang 15.0.0 (clang-1500.0.40.1)]
Executable /Users/machine/.local/share/virtualenvs/double_scoop-f6JcJJRI/bin/python3
CPU arm (8 cores)
Memory 16.0 GB
Core
ββ mne 1.5.1
ββ numpy 1.23.1 (OpenBLAS 0.3.20 with 8 threads)
ββ scipy 1.11.2
ββ matplotlib 3.7.2 (backend=MacOSX)
/Users/machine/.local/share/virtualenvs/double_scoop-f6JcJJRI/lib/python3.9/site-packages/urllib3/init.py:34: NotOpenSSLWarning: urllib3 v2.0 only supports OpenSSL 1.1.1+, currently the βsslβ module is compiled with βLibreSSL 2.8.3β. See: urllib3>=2.0 does not work with system Python on macOS Β· Issue #3020 Β· urllib3/urllib3 Β· GitHub
warnings.warn(
ββ pooch 1.7.0
ββ jinja2 3.1.2
@heybriannguyen I donβt know for sure whatβs going on but the first thing I would try is upgrading to pyvista 0.42.2 (and adding the trame_* packages listed as unavailable).
@larsoner any idea why pyvista figures would be unresponsive on macOS?
Sounds like Loading... . I do not use PySide6 for this reason. Can you live with using PyQt6 instead? If so then Iβd uninstall PySide6 and install PyQt6.
Thank you so much @drammock@larsoner. Using PyQt6 instead of PySide, I got it to work! I didnβt need to download the trame_* packages. For those who are running into a similar issue, here is what happens when I run python3 -c "import mne; print(mne.sys_info())".