spyder-ide / spyder

Official repository for Spyder - The Scientific Python Development Environment
https://www.spyder-ide.org
MIT License
8.38k stars 1.63k forks source link

python not responding after run cv2.imshow() #18939

Closed yxu148 closed 2 years ago

yxu148 commented 2 years ago

Description

What steps will reproduce the problem?

No picture shown after running cv2.imshow

Python not responding

Have to close python

Traceback

--- Logging error ---
Traceback (most recent call last):
  File "D:\Applications\Miniconda3\lib\logging\__init__.py", line 1082, in emit
    stream.write(msg + self.terminator)
AttributeError: 'NoneType' object has no attribute 'write'
Call stack:
  File "D:\Applications\Miniconda3\Scripts\spyder-script.py", line 10, in <module>
    sys.exit(main())
  File "D:\Applications\Miniconda3\lib\site-packages\spyder\app\start.py", line 214, in main
    mainwindow.main(options, args)
  File "D:\Applications\Miniconda3\lib\site-packages\spyder\app\mainwindow.py", line 2310, in main
    mainwindow = create_window(app, splash, options, args)
  File "D:\Applications\Miniconda3\lib\site-packages\spyder\app\mainwindow.py", line 2206, in create_window
    app.exec_()
  File "D:\Applications\Miniconda3\lib\site-packages\qtconsole\manager.py", line 27, in poll
    super().poll()
  File "D:\Applications\Miniconda3\lib\site-packages\jupyter_client\restarter.py", line 116, in poll
    self.kernel_manager.restart_kernel(now=True, newports=newports)
  File "D:\Applications\Miniconda3\lib\site-packages\jupyter_client\manager.py", line 510, in restart_kernel
    self.start_kernel(**self._launch_args)
  File "D:\Applications\Miniconda3\lib\site-packages\jupyter_client\manager.py", line 342, in start_kernel
    self.post_start_kernel(**kw)
  File "D:\Applications\Miniconda3\lib\site-packages\qtconsole\manager.py", line 62, in post_start_kernel
    self.kernel_restarted.emit()
  File "D:\Applications\Miniconda3\lib\site-packages\spyder\plugins\ipythonconsole\widgets\shell.py", line 784, in _handle_kernel_restarted
    super(ShellWidget, self)._handle_kernel_restarted(*args, **kwargs)
  File "D:\Applications\Miniconda3\lib\site-packages\qtconsole\frontend_widget.py", line 530, in _handle_kernel_restarted
    self.log.warning("kernel restarted")
Message: 'kernel restarted'
Arguments: ()

Versions

Dependencies


# Mandatory:
atomicwrites >=1.2.0          :  1.4.0 (OK)
chardet >=2.0.0               :  3.0.4 (OK)
cloudpickle >=0.5.0           :  1.6.0 (OK)
cookiecutter >=1.6.0          :  1.7.2 (OK)
diff_match_patch >=20181111   :  20200713 (OK)
intervaltree >=3.0.2          :  3.1.0 (OK)
IPython >=7.6.0               :  7.22.0 (OK)
jedi =0.17.2                  :  0.17.2 (OK)
jsonschema >=3.2.0            :  3.2.0 (OK)
keyring >=17.0.0              :  23.0.1 (OK)
nbconvert >=4.0               :  6.1.0 (OK)
numpydoc >=0.6.0              :  1.1.0 (OK)
paramiko >=2.4.0              :  2.7.2 (OK)
parso =0.7.0                  :  0.7.0 (OK)
pexpect >=4.4.0               :  4.8.0 (OK)
pickleshare >=0.4             :  0.7.5 (OK)
psutil >=5.3                  :  5.8.0 (OK)
pygments >=2.0                :  2.9.0 (OK)
pylint >=1.0                  :  2.8.3 (OK)
pyls >=0.36.2;<1.0.0          :  0.36.2 (OK)
pyls_black >=0.4.6            :  0.4.6 (OK)
pyls_spyder >=0.3.2;<0.4.0    :  0.3.2 (OK)
qdarkstyle =3.0.2             :  3.0.2 (OK)
qstylizer >=0.1.10            :  0.1.10 (OK)
qtawesome >=1.0.2             :  1.0.2 (OK)
qtconsole >=5.1.0             :  5.1.0 (OK)
qtpy >=1.5.0                  :  1.9.0 (OK)
rtree >=0.9.7                 :  0.9.7 (OK)
setuptools >=39.0.0           :  51.0.0.post20201207 (OK)
sphinx >=0.6.6                :  4.0.2 (OK)
spyder_kernels >=2.0.3;<2.1.0 :  2.0.3 (OK)
textdistance >=4.2.0          :  4.2.1 (OK)
three_merge >=0.1.1           :  0.1.1 (OK)
watchdog >=0.10.3;<2.0.0      :  1.0.2 (OK)
zmq >=17                      :  20.0.0 (OK)

# Optional:
cython >=0.21                 :  None (NOK)
matplotlib >=2.0.0            :  None (NOK)
numpy >=1.7                   :  1.20.2 (OK)
pandas >=1.1.1                :  None (NOK)
scipy >=0.17.0                :  None (NOK)
sympy >=0.7.3                 :  None (NOK)
ccordoba12 commented 2 years ago

Hey @yxu148, thanks for reporting. I think this error is fixed in our latest version (5.3.2).

Since it's still not available in Anaconda, you need to create a new environment with conda-forge packages. For that, please close Spyder, open the Anaconda Prompt and run the following commands there:

    conda create -n spyder-cf -c conda-forge spyder py-opencv
    conda activate spyder-cf
    spyder

Let us know if that solves the problem for you.

ccordoba12 commented 2 years ago

Closing due to lack of response.