user16836078
user16836078

Reputation:

TypeError: expected string or bytes-like object while starting Spyder 5.2.2

I created a new environment in conda with Spyder 5.2.2 and Python 3.10.2. Now, I'm experiencing an error telling me that the program expects a string or byte-like object while starting the Spyder. Interestingly, this does not happen when my Python is 3.9.* . Any reason this can happen?

Here is the error encountered:

(py10) PS C:\Users\Kevin Yew> spyder
Traceback (most recent call last):
  File "C:\Users\Kevin Yew\anaconda3\envs\py10\Scripts\spyder-script.py", line 10, in <module>
    sys.exit(main())
  File "C:\Users\Kevin Yew\anaconda3\envs\py10\lib\site-packages\spyder\app\start.py", line 233, in main
    from spyder.app import mainwindow
  File "C:\Users\Kevin Yew\anaconda3\envs\py10\lib\site-packages\spyder\app\mainwindow.py", line 41, in <module>
    requirements.check_qt()
  File "C:\Users\Kevin Yew\anaconda3\envs\py10\lib\site-packages\spyder\requirements.py", line 47, in check_qt
    if parse_version(actual_ver) < parse_version(required_ver):
  File "C:\Users\Kevin Yew\anaconda3\envs\py10\lib\site-packages\pkg_resources\__init__.py", line 120, in parse_version
    return packaging.version.Version(v)
  File "C:\Users\Kevin Yew\anaconda3\envs\py10\lib\site-packages\pkg_resources\_vendor\packaging\version.py", line 264, in __init__
    match = self._regex.search(version)
TypeError: expected string or bytes-like object

Edit Here's the code you can try to reproduce the error.

conda create -n py10 python=3.10.2
conda activate py10
conda install spyder
spyder

Upvotes: 2

Views: 4132

Answers (3)

Ohumeronen
Ohumeronen

Reputation: 2086

I resolved this running:

conda install -c anaconda pyqt

Upvotes: 0

Carlos Cordoba
Carlos Cordoba

Reputation: 34136

(Spyder maintainer here) This is an error in the code that checks if PyQt5 is present and it will be fixed in our next version (5.3.0) to be released in March 2022 (see here).

Upvotes: 3

user16836078
user16836078

Reputation:

I have glanced through the posts about the issues in Spyder and apparently, it involves upgrading or downgrading certain packages to solve the problem of running Spyder. When I look into the updatable packages in Anaconda Navigator, the PyQt and Qt are not in the latest release. I tried my luck to update it to the latest version and now the Spyder works! Now I can run my Spyder with Python 3.10.2 :-)

Upvotes: 1

Related Questions