3

I have just upgraded ubuntu. As a result, spyder is not working anymore. This the error:

Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
Traceback (most recent call last):
 File "/usr/bin/spyder", line 33, in <module>
   sys.exit(load_entry_point('spyder==4.2.1', 'gui_scripts', 'spyder')())
 File "/usr/lib/python3/dist-packages/spyder/app/start.py", line 213, in main
   mainwindow.main(options, args)
 File "/usr/lib/python3/dist-packages/spyder/app/mainwindow.py", line 3624, in main
   mainwindow = create_window(app, splash, options, args)
 File "/usr/lib/python3/dist-packages/spyder/app/mainwindow.py", line 3482, in create_window
   main.setup()
 File "/usr/lib/python3/dist-packages/spyder/app/mainwindow.py", line 803, in setup
   self.completions = CompletionManager(self)
 File "/usr/lib/python3/dist-packages/spyder/plugins/completion/plugin.py", line 97, in __init__
   plugin_client = Plugin(self.main)
 File "/usr/lib/python3/dist-packages/spyder/plugins/completion/kite/plugin.py", line 50, in __init__
   self.installer = KiteInstallerDialog(
 File "/usr/lib/python3/dist-packages/spyder/plugins/completion/kite/widgets/install.py", line 287, in __init__
   self._integration_widget = KiteIntegrationInfo(self)
 File "/usr/lib/python3/dist-packages/spyder/plugins/completion/kite/widgets/install.py", line 58, in __init__
   image = image.scaled(image_width, image_height, Qt.KeepAspectRatio,
TypeError: arguments did not match any overloaded call:
 scaled(self, int, int, aspectRatioMode: Qt.AspectRatioMode = Qt.IgnoreAspectRatio, transformMode: Qt.TransformationMode = Qt.FastTransformation): argument 1 has unexpected type 'float'
 scaled(self, QSize, aspectRatioMode: Qt.AspectRatioMode = Qt.IgnoreAspectRatio, transformMode: Qt.TransformationMode = Qt.FastTransformation): argument 1 has unexpected type 'float'

This seems to be a bug (here)

what do you suggest? Can I downgrade spyder? is if a feasible solution?

Best

diedro
  • 413
  • 1
  • 3
  • 8
  • This is this bug: https://bugs.launchpad.net/ubuntu/+source/spyder/+bug/1968479 – Thomas Ward May 04 '22 at 15:44
  • This is a Python 3.10 problem, not a Spyder problem necessarily. The only way to 'fix' this is likely a Python downgrade which is not safe, so if you need Spyder you probably should use 20.04 not 22.04. HOWEVER there is a workaroudn in the bug: https://bugs.launchpad.net/ubuntu/+source/spyder/+bug/1968479/comments/4 Try this workaround first instead of using the spyder package in the repositories,. – Thomas Ward May 04 '22 at 15:45
  • @ThomasWard I have Spyder 5.3.1 currently installed in Ubuntu 22.04 (as shown in the below screenshot) in a Python virtual environment which has Python 3.10 as its Python version. – karel Jul 26 '22 at 11:13
  • https://stackoverflow.com/questions/72114520/error-when-starting-spyder-on-ubuntu-22-04 – ferdymercury Oct 13 '22 at 12:51

1 Answers1

4

This is a Python 3.10 problem, not a Spyder problem necessarily. which was posted as a comment to the main question by Thomas Ward seems to me to be correct because I was not able to successfully run the Spyder 5 application in either macOS or Ubuntu except by installing it in a Python virtual environment.

Follow these instructions to install the latest version of Spyder (currently Spyder 5.x) in all currently supported versions of Ubuntu.

  1. Install Python 3 virtual environment creator.

    sudo apt install python3-virtualenv
    
  2. Run python3 --version to show the python 3.x version. In Ubuntu 22.04 the default Python 3.x version is Python 3.10 which I will use as an example in the next step.

  3. Create a Python virtual environment for Python 3.

    virtualenv -p python3.10 venv  
    source ./venv/bin/activate
    

    The new Python virtual environment for python3.10 will be created in the venv directory which is located in the current directory.

  4. Install the latest version of Spyder.

    pip3 install spyder
    

enter image description here
Spyder 5.3.1 in Ubuntu 22.04 (Click image to enlarge)

karel
  • 110,292
  • 102
  • 269
  • 299
  • 1
    Worked perfectly, Spyder 5.3.2 came right up. – Rimfire Jul 27 '22 at 04:26
  • 1
    I remember thinking when I installed Spyder 5 Let pip automatically install all the dependencies with the compatible versions and abracadabra, it's installed. – karel Jul 27 '22 at 04:45