spyder-ide / spyder

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

Spyder 6.0 startup errror when Spyder-terminal is installed #22419

Closed beew closed 1 month ago

beew commented 2 months ago

Problem Description

Just updated spyder to v6.0.0 When start spyder in the terminal

get these error messages,


$ spyder
terminal: cannot import name 'QStylePalette' from 'spyder.utils.palette' (/home/bernard/opt/python310/lib/python3.10/site-packages/spyder/utils/palette.py)
Traceback (most recent call last):
  File "/home/bernard/opt/python310/lib/python3.10/site-packages/spyder/app/find_plugins.py", line 71, in find_external_plugins
    mod = importlib.import_module(entry_point.module)
  File "/home/bernard/opt/python310/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 992, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/bernard/opt/python310/lib/python3.10/site-packages/spyder_terminal/__init__.py", line 10, in <module>
    from .terminalplugin import TerminalPlugin as PLUGIN_CLASS
  File "/home/bernard/opt/python310/lib/python3.10/site-packages/spyder_terminal/terminalplugin.py", line 23, in <module>
    from spyder_terminal.widgets.main_widget import TerminalMainWidget
  File "/home/bernard/opt/python310/lib/python3.10/site-packages/spyder_terminal/widgets/main_widget.py", line 30, in <module>
    from spyder_terminal.widgets.terminalgui import TerminalWidget
  File "/home/bernard/opt/python310/lib/python3.10/site-packages/spyder_terminal/widgets/terminalgui.py", line 27, in <module>
    from spyder.utils.palette import QStylePalette
ImportError: cannot import name 'QStylePalette' from 'spyder.utils.palette' (/home/bernard/opt/python310/lib/python3.10/site-packages/spyder/utils/palette.py)
Traceback (most recent call last):
  File "/home/bernard/opt/python310/lib/python3.10/site-packages/spyder/plugins/editor/widgets/main_widget.py", line 1253, in update_edit_menu
    if readwrite_editor and not editor.isReadOnly():
AttributeError: 'NoneType' object has no attribute 'isReadOnly'

But spyder does start and seems to be working.

What steps reproduce the problem?

Just start spyder from the terminal

What is the expected output? What do you see instead?

expected output should be nothing, but I saw the above

Versions

Dependencies

# Mandatory:
aiohttp >=3.9.3                  :  3.10.5 (OK)
asyncssh >=2.14.0,<3.0.0         :  2.17.0 (OK)
atomicwrites >=1.2.0             :  1.4.1 (OK)
chardet >=2.0.0                  :  5.1.0 (OK)
cloudpickle >=0.5.0              :  2.2.1 (OK)
cookiecutter >=1.6.0             :  2.1.1 (OK)
diff_match_patch >=20181111      :  20200713 (OK)
github >=2.3.0                   :  2.4.0 (OK)
importlib_metadata >=4.6.0       :  6.8.0 (OK)
intervaltree >=3.0.2             :  3.1.0 (OK)
IPython >=8.13.0,<9.0.0,!=8.17.1 :  8.13.1 (OK)
jedi >=0.17.2,<0.20.0            :  0.18.2 (OK)
jellyfish >=0.7                  :  0.9.0 (OK)
jsonschema >=3.2.0               :  4.17.3 (OK)
keyring >=17.0.0                 :  23.13.1 (OK)
nbconvert >=4.0                  :  7.2.9 (OK)
numpydoc >=0.6.0                 :  1.5.0 (OK)
parso >=0.7.0,<0.9.0             :  0.8.3 (OK)
pexpect >=4.4.0                  :  4.8.0 (OK)
pickleshare >=0.4                :  0.7.5 (OK)
psutil >=5.3                     :  5.9.4 (OK)
pygments >=2.0                   :  2.14.0 (OK)
pylint >=3.1,<4                  :  3.1.0 (OK)
pylint_venv >=3.0.2              :  3.0.2 (OK)
pyls_spyder >=0.4.0              :  0.4.0 (OK)
pylsp >=1.12.0,<1.13.0           :  1.12.0 (OK)
pylsp_black >=2.0.0,<3.0.0       :  2.0.0 (OK)
pyuca >=1.2                      :  1.2 (OK)
qdarkstyle >=3.2.0,<3.3.0        :  3.2 (OK)
qstylizer >=0.2.2                :  0.2.2 (OK)
qtawesome >=1.3.1,<1.4.0         :  1.3.1 (OK)
qtconsole >=5.6.0,<5.7.0         :  5.6.0 (OK)
qtpy >=2.4.0                     :  2.4.1 (OK)
rtree >=0.9.7                    :  1.0.1 (OK)
setuptools >=49.6.0              :  65.5.0 (OK)
sphinx >=0.6.6                   :  6.1.3 (OK)
spyder_kernels >=3.0.0,<3.1.0    :  3.0.0 (OK)
superqt >=0.6.2,<1.0.0           :  0.6.7 (OK)
textdistance >=4.2.0             :  4.5.0 (OK)
three_merge >=0.1.1              :  0.1.1 (OK)
watchdog >=0.10.3                :  2.2.1 (OK)
xdg >=0.26                       :  0.28 (OK)
yarl >=1.9.4                     :  1.9.7 (OK)
zmq >=24.0.0                     :  24.0.1 (OK)

# Optional:
cython >=0.21                    :  0.29.28 (OK)
matplotlib >=3.0.0               :  3.7.1 (OK)
numpy >=1.7                      :  1.23.5 (OK)
pandas >=1.1.1                   :  2.1.3 (OK)
scipy >=0.17.0                   :  1.10.1 (OK)
sympy >=0.7.3                    :  1.13.0 (OK)
dalthviz commented 2 months ago

Hi @beew thank you for the report! I think the traceback you are seeing comes from the spyder-terminal plugin. I think, as it is right now, that plugin is not compatible with Spyder 6 (here an issue related to that https://github.com/spyder-ide/spyder-terminal/issues/345). Do you have spyder-terminal installed alongside Spyder 6? Let us know!

beew commented 2 months ago

Hi, after removing spyder-terminal I get the error

Traceback (most recent call last):
  File "/home/bernard/opt/python310/lib/python3.10/site-packages/spyder/plugins/editor/widgets/main_widget.py", line 1253, in update_edit_menu
    if readwrite_editor and not editor.isReadOnly():
AttributeError: 'NoneType' object has no attribute 'isReadOnly'

There is another package called pyls-spyder, not sure if it was installed along with spyder-terminal.

Thanks.

Edited; uninstalled pyls-spyder, still same error, so it is not the culprit and I reinstalled it.

beew commented 2 months ago

Also not sure if it is related, I noticed that the Ipython console is not displaying the initial banner, like version of python, version of Ipython etc (the box in Preference > Ipython console > display initial banner is checked)

It is displayed briefly when the "Help Spyder" pop up window is a white square, once the Help Spyder window is rendered the initial banner in Ipython console disappears.

The window layout in the pictures is Rstudio layout, but choosing default shows the same problem.

Screenshot from 2024-09-04 13-34-32

Screenshot from 2024-09-04 13-37-24

Screenshot from 2024-09-04 13-33-35

ccordoba12 commented 2 months ago

@beew, your initial crash is a problem with Spyder-terminal, which is not compatible with Spyder 6 yet and will only be at the beginning of next year. So, please uninstall it.

You also said:

Also not sure if it is related, I noticed that the Ipython console is not displaying the initial banner, like version of python, version of Ipython etc (the box in Preference > Ipython console > display initial banner is checked)

That's a small bug we didn't manage to fix before releasing Spyder 6. Please open a new issue about it and we'll fix it for 6.0.1, to be released in a couple of weeks.

beew commented 2 months ago

@ccordoba12

Hi, but after removing spyder-terminal, the error

  File "/home/bernard/opt/python310/lib/python3.10/site-packages/spyder/plugins/editor/widgets/main_widget.py", line 1253, in update_edit_menu
    if readwrite_editor and not editor.isReadOnly():
AttributeError: 'NoneType' object has no attribute 'isReadOnly'

still persists. Is this the same as the bug that Ipython is not showing initial banner or is it a different bug?

Thanks.

ccordoba12 commented 2 months ago

Ok, sorry, I just saw that @dalthviz suggested you already to remove Spyder-terminal.

Hi, but after removing spyder-terminal, the error still persists.

Could you post the entire traceback of that error? Also, are you able to see Spyder after it? Or it simply dies?

Is this the same as the bug that Ipython is not showing initial banner or is it a different bug?

Nop, it's not. Please open a new issue about it.

beew commented 2 months ago

@ccordoba12

No it doesn't die. It is working without any noticeable problem. How do I get a back trace of the error? I will open a new issue.

ccordoba12 commented 2 months ago

No it doesn't die. It is working without any noticeable problem. How do I get a back trace of the error?

So, where does the error show up? Are you only seeing it in the terminal where you start Spyder?

I will open a new issue.

Ok, thanks!

beew commented 2 months ago

@ccordoba12

Yeah I only see it when I start spyder from the terminal.

ccordoba12 commented 2 months ago

Ok, thanks for the confirmation @beew. We'll fix that error in 6.0.1, to be released in a couple of weeks.

beew commented 2 months ago

@ccordoba12

I applied your commit https://github.com/spyder-ide/spyder/commit/d859b8334ef2b2048de190f0219a47eb26337fcc manually and can confirm that there is no more error at start up.

Thanks.

ccordoba12 commented 2 months ago

Great! Thanks for letting us know about it @beew.

However, I'm going to reopen this issue because so we don't forget to fix the problem with Spyder-terminal.

mikewasouski commented 1 month ago

Hi, I'm also having similar bug after installing spyder, in a newly created virtual environment, using pip: python3 -m venv spydy source spydy/bin/activate

pip install spyder pip install spyder-terminal spyder

(spydy) mw@mi:/media/sf/projects$ terminal: cannot import name 'QStylePalette' from 'spyder.utils.palette' (/media/sf/projects/spydy/lib/python3.10/site-packages/spyder/utils/palette.py) Traceback (most recent call last): File "/media/sf/projects/spydy/lib/python3.10/site-packages/spyder/app/find_plugins.py", line 71, in find_external_plugins mod = importlib.import_module(entry_point.module) File "/usr/lib/python3.10/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1050, in _gcd_import File "", line 1027, in _find_and_load File "", line 992, in _find_and_load_unlocked File "", line 241, in _call_with_frames_removed File "", line 1050, in _gcd_import File "", line 1027, in _find_and_load File "", line 1006, in _find_and_load_unlocked File "", line 688, in _load_unlocked File "", line 883, in exec_module File "", line 241, in _call_with_frames_removed File "/media/sf/projects/spydy/lib/python3.10/site-packages/spyder_terminal/init.py", line 10, in from .terminalplugin import TerminalPlugin as PLUGIN_CLASS File "/media/sf/projects/spydy/lib/python3.10/site-packages/spyder_terminal/terminalplugin.py", line 23, in from spyder_terminal.widgets.main_widget import TerminalMainWidget File "/media/sf/projects/spydy/lib/python3.10/site-packages/spyder_terminal/widgets/main_widget.py", line 30, in from spyder_terminal.widgets.terminalgui import TerminalWidget File "/media/sf/projects/spydy/lib/python3.10/site-packages/spyder_terminal/widgets/terminalgui.py", line 27, in from spyder.utils.palette import QStylePalette ImportError: cannot import name 'QStylePalette' from 'spyder.utils.palette' (/media/sf/projects/spydy/lib/python3.10/site-packages/spyder/utils/palette.py)

When I try to import QStylePalette in the python CLI:

Python 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] on linux Type "help", "copyright", "credits" or "license" for more information. import spyder.utils.palette from spyder.utils.palette import QStylePalette Traceback (most recent call last): File "", line 1, in ImportError: cannot import name 'QStylePalette' from 'spyder.utils.palette' (/media/sf/projects/spydy/lib/python3.10/site-packages/spyder/utils/palette.py)`

Versions

Spyder version: 6.0.0 Python version: 3.10.12 PyQt version: 5.15.11 Operating System name/version: Linux Mint 21.3 x86_64

ccordoba12 commented 1 month ago

@mikewasouski, please uninstall Spyder-terminal because it's not compatible with Spyder 6.

ccordoba12 commented 1 month ago

I thought Spyder was crashing due to Spyder-terminal, but that was not the case according to @beew:

But spyder does start and seems to be working.

So, I think we can safely close this issue, as @beew did before.

FYI, there's already a volunteer working on updating Spyder-terminal for Spyder 6. So a new version for it will available in the coming weeks.