Search code examples
pythonpython-3.xcondatypeerrorspyder

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

Solution

  • (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).