spyder: Unable to launch spyder after upgrading to 4.0.1

Issue Report Checklist

  • Searched the issues page for similar reports
  • Read the relevant sections of the Spyder Troubleshooting Guide and followed its advice
  • Reproduced the issue after updating with conda update spyder (or pip, if not using Anaconda)
  • Tried basic troubleshooting (if a bug/error)
    • Restarted Spyder
    • Reset preferences with spyder --reset
    • Reinstalled the latest version of Anaconda
    • Tried the other applicable steps from the Troubleshooting Guide
  • Completed the Problem Description, Steps to Reproduce and Version sections below

Problem Description

After updating spyder, I was unable to launch it. I uninstalled it, installed spyder 3.3.6, 4.0.0, and 4.0.1. They all cause the same error message:

Traceback (most recent call last):
  File "/Users/colinww/anaconda3/bin/spyder", line 11, in <module>
    sys.exit(main())
  File "/Users/colinww/anaconda3/lib/python3.7/site-packages/spyder/app/start.py", line 201, in main
    from spyder.app import mainwindow
  File "/Users/colinww/anaconda3/lib/python3.7/site-packages/spyder/app/mainwindow.py", line 167, in <module>
    from spyder.utils.environ import WinUserEnvDialog
  File "/Users/colinww/anaconda3/lib/python3.7/site-packages/spyder/utils/environ.py", line 19, in <module>
    from spyder.plugins.variableexplorer.widgets.collectionseditor import (
  File "/Users/colinww/anaconda3/lib/python3.7/site-packages/spyder/plugins/variableexplorer/widgets/collectionseditor.py", line 29, in <module>
    from pympler.asizeof import asizeof
  File "/Users/colinww/anaconda3/lib/python3.7/site-packages/pympler/asizeof.py", line 1476, in <module>
    import numpy  # NumPy array, matrix, etc.
  File "/Users/colinww/anaconda3/lib/python3.7/site-packages/numpy/__init__.py", line 158, in <module>
    from . import core
  File "/Users/colinww/anaconda3/lib/python3.7/site-packages/numpy/core/__init__.py", line 100, in <module>
    from . import _internal
  File "/Users/colinww/anaconda3/lib/python3.7/site-packages/numpy/core/_internal.py", line 20, in <module>
    IS_PYPY = platform.python_implementation() == 'PyPy'
  File "/Users/colinww/anaconda3/lib/python3.7/platform.py", line 1267, in python_implementation
    return _sys_version()[0]
  File "/Users/colinww/anaconda3/lib/python3.7/platform.py", line 1228, in _sys_version
    repr(sys_version))
ValueError: failed to parse CPython sys.version: '3.7.0 (default, Jun 28 2018, 07:39:16) \n[Clang 4.0.1 (tags/RELEASE_401/final)]'

So I modified platform.py around line 1220 to report some more info:

        # CPython
        match = _sys_version_parser.match(sys_version)
        if match is None:
            print("This is the executable: {}".format(sys.executable))
            print("And this is the version: {}".format(sys.version))
            raise ValueError(
                'failed to parse CPython sys.version: %s' %
                repr(sys_version))

And now this is the output I get:

...
This is the executable: /Users/colinww/anaconda3/bin/python
And this is the version: 3.7.0 (default, Jun 28 2018, 07:39:16)
[Clang 4.0.1 (tags/RELEASE_401/final)]
Traceback (most recent call last):
  File "/Users/colinww/anaconda3/bin/spyder", line 11, in <module>
    sys.exit(main())
  File "/Users/colinww/anaconda3/lib/python3.7/site-packages/spyder/app/start.py", line 201, in main
    from spyder.app import mainwindow
...

Which is super weird, because if I launch that executable, I get:

colinww@ca-l-colin system-model % /Users/colinww/anaconda3/bin/python
Python 3.7.6 | packaged by conda-forge | (default, Jan  7 2020, 14:13:53)
[Clang 4.0.1 (tags/RELEASE_401/final)] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.version
'3.7.6 | packaged by conda-forge | (default, Jan  7 2020, 14:13:53) \n[Clang 4.0.1 (tags/RELEASE_401/final)]'

This would be parsed correctly…

Anyway, long story short. I traced it back to the launcher in /Users/colinww/anaconda3/bin/spyder. The script is launched with: #!/bin/bash /Users/colinww/anaconda3/bin/pythonw.

When I run this, I get the same output which is causing crashing.

colinww@ca-l-colin system-model % /Users/colinww/anaconda3/bin/pythonw
Python 3.7.0 (default, Jun 28 2018, 07:39:16)
[Clang 4.0.1 (tags/RELEASE_401/final)] :: Anaconda, Inc. on darwin

So I changed the header line to read #!/Users/colinww/anaconda3/bin/python, and so far so good…

So is there something wrong with my system? This is a fairly clean install of 2019.10, all I added were a few packages always using conda.

Versions

  • Spyder version: 4.0.1
  • Python version: 3.7.6
  • Qt version: 5.9.7
  • PyQt version: 5.9.2
  • Operating System name/version: Darwin 15.2

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 17 (4 by maintainers)

Most upvoted comments

Yes, for me running conda update python has fixed the problem.