question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to launch spyder after upgrading to 4.0.1

See original GitHub issue

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

Issue Analytics

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

github_iconTop GitHub Comments

4reactions
fprabowocommented, Jan 9, 2020

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

0reactions
RubensZimbrescommented, Apr 21, 2020

In my case, I uninstalled Spyder 2 and run:

conda activate spyder

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error after upgrading Spyder to 4.0.1 with Anaconda on ...
1 in the Anaconda-Navigator window. On the left go to Environments, select spyder-4.0.1 and a list of installed modules appears. In the drop ......
Read more >
spyder-ide/public - Gitter
Hi I've just installed Spyder on my Macbook using conda. When I run spyder at the console it opens in a new Desktop,...
Read more >
Frequently Asked Questions — Spyder 4 documentation
From Anaconda Navigator: Scroll to Spyder under Home, and click Launch. *Windows Only*: Launch it via the Start menu shortcut.
Read more >
How to update Spyder in Anaconda to 5.x?
Whenever I launch Spyder IDE, I get this prompt to upgrade the version to 5.x, and today, ... then. conda update conda. Failed...
Read more >
How to update Spyder when the latest version isn't shown on ...
Moktar Mannaa · 1. Close Spyder. · 2. Run Anaconda Prompt as an administrator. · 3.Copy and paste these two lines: conda update...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found