phy icon indicating copy to clipboard operation
phy copied to clipboard

Error in construction of QApplication before QWidget.

Open reneela opened this issue 1 year ago • 3 comments

There is a issue about running "phy template-gui params.py" in the phy2 environment that I created. And it returns the error as shown in the screen shot. We had already tried to run the command "pip install PyQtWebEngine" and try launching phy again. But it can't work. Could you pleas help us to solve this problem? Thank you very much.

phy template-gui params.py --debug returns this: `(phy2) C:\Users\hengj\OneDrive\Desktop\Kilosort_2023-10-24_155303>phy template-gui params.py --debug 17:17:20.505 [D] init:68 Start capturing exceptions. 17:17:20.510 [E] init:62 An error has occurred (OSError): Traceback (most recent call last): File "", line 198, in _run_module_as_main File "", line 88, in run_code File "C:\Users\hengj\anaconda3\envs\phy2\Scripts\phy.exe_main.py", line 7, in sys.exit(phycli()) ^^^^^^^^ File "C:\Users\hengj\anaconda3\envs\phy2\Lib\site-packages\click\core.py", line 1157, in call return self.main(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\hengj\anaconda3\envs\phy2\Lib\site-packages\click\core.py", line 1078, in main rv = self.invoke(ctx) ^^^^^^^^^^^^^^^^ File "C:\Users\hengj\anaconda3\envs\phy2\Lib\site-packages\click\core.py", line 1688, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\hengj\anaconda3\envs\phy2\Lib\site-packages\click\core.py", line 1434, in invoke return ctx.invoke(self.callback, **ctx.params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\hengj\anaconda3\envs\phy2\Lib\site-packages\click\core.py", line 783, in invoke return _callback(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\hengj\anaconda3\envs\phy2\Lib\site-packages\click\decorators.py", line 33, in new_func return f(get_current_context(), *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\hengj\anaconda3\envs\phy2\Lib\site-packages\phy\apps_init.py", line 159, in cli_template_gui template_gui(params_path, **kwargs) File "C:\Users\hengj\anaconda3\envs\phy2\Lib\site-packages\phy\apps\template\gui.py", line 209, in template_gui model = load_model(params_path) ^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\hengj\anaconda3\envs\phy2\Lib\site-packages\phylib\io\model.py", line 1440, in load_model return TemplateModel(**get_template_params(params_path)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\hengj\anaconda3\envs\phy2\Lib\site-packages\phylib\io\model.py", line 339, in init self._load_data() File "C:\Users\hengj\anaconda3\envs\phy2\Lib\site-packages\phylib\io\model.py", line 348, in _load_data self.spike_samples, self.spike_times = self._load_spike_samples() ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\hengj\anaconda3\envs\phy2\Lib\site-packages\phylib\io\model.py", line 652, in _load_spike_samples times = self._read_array(times_path) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\hengj\anaconda3\envs\phy2\Lib\site-packages\phylib\io\model.py", line 487, in _read_array raise IOError() OSError

QWidget: Must construct a QApplication before a QWidget `

reneela avatar Oct 10 '24 21:10 reneela

Hey, we are having the same issue. Were you able to fix it? If so, it would be really helpful to know how you did it :)

lustrauch avatar Feb 14 '25 10:02 lustrauch

Phy can’t read one of the arrays it needs—specifically the spike times. It’s looking for the file pointed to by times_path (usually spike_times.npy) and _read_array() fails, so it raises a bare OSError.

spike_times.npy is probably missing.

juwaynilucman avatar Sep 08 '25 17:09 juwaynilucman

I had a similar issue, but all my .npy files are there, including the spike_times.npy.

cyf203 avatar Nov 13 '25 16:11 cyf203