Spyder: Unable to launch spyder after upgrading to 4.0.1

Created on 8 Jan 2020  路  17Comments  路  Source: spyder-ide/spyder

Issue Report Checklist

  • [x] Searched the issues page for similar reports
  • [x] Read the relevant sections of the Spyder Troubleshooting Guide and followed its advice
  • [x] Reproduced the issue after updating with conda update spyder (or pip, if not using Anaconda)
  • [x] Tried basic troubleshooting (if a bug/error)

    • [x] Restarted Spyder

    • [x] Reset preferences with spyder --reset

    • [ ] Reinstalled the latest version of Anaconda

    • [ ] Tried the other applicable steps from the Troubleshooting Guide

  • [x] 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:
``` else:
# 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
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
Awaiting Followup

Most helpful comment

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

All 17 comments

By the way, this is the result of python.app:

colinww@ca-l-colin system-model % conda list python.app
# packages in environment at /Users/colinww/anaconda3:
#
# Name                    Version                   Build  Channel
python.app                2                        py37_9
colinww@ca-l-colin system-model % conda install python.app
Collecting package metadata (current_repodata.json): done
Solving environment: done

# All requested packages already installed.

I met the same problem as you did

I also just had this problem with my Mac after conda updating few hours ago, but not when I updated conda in my Windows PC

I just ran into the a very similar problem on my Mac after a conda update.

This is from a clean environment only installing python=3.7 and spyder.

  File ".../anaconda3/envs/test_spyder/lib/python3.7/site-packages/spyder/app/mainwindow.py", line 3718, in main
    mainwindow = run_spyder(app, options, args)
  File ".../anaconda3/envs/test_spyder/lib/python3.7/site-packages/spyder/app/mainwindow.py", line 3559, in run_spyder
    main.setup()
  File ".../anaconda3/envs/test_spyder/lib/python3.7/site-packages/spyder/app/mainwindow.py", line 922, in setup
    from spyder.plugins.completion.plugin import CompletionManager
  File ".../anaconda3/envs/test_spyder/lib/python3.7/site-packages/spyder/plugins/completion/plugin.py", line 27, in <module>
    from spyder.plugins.completion.languageserver.plugin import (
  File ".../anaconda3/envs/test_spyder/lib/python3.7/site-packages/spyder/plugins/completion/languageserver/plugin.py", line 30, in <module>
    from spyder.plugins.completion.languageserver.client import LSPClient
  File ".../anaconda3/envs/test_spyder/lib/python3.7/site-packages/spyder/plugins/completion/languageserver/client.py", line 24, in <module>
    import zmq
  File ".../anaconda3/envs/test_spyder/lib/python3.7/site-packages/zmq/__init__.py", line 42, in <module>
    _load_libzmq()
  File ".../anaconda3/envs/test_spyder/lib/python3.7/site-packages/zmq/__init__.py", line 13, in _load_libzmq
    PYPY = platform.python_implementation().lower() == 'pypy'
  File ".../anaconda3/envs/test_spyder/lib/python3.7/platform.py", line 1265, in python_implementation
    return _sys_version()[0]
  File ".../anaconda3/envs/test_spyder/lib/python3.7/platform.py", line 1226, 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)]'

@jjhelmus, @mingwandroid, @msarahan, do you know what's happening here?

After more poking, this seems to also be the root cause of seeing this error: #10984 Just somehow in the past, spyder was allowed to startup successfully.

The python 3.7.6 build 1 packages in defaults accidentally have the conda-forge branding applied which I believe can cause this issue. Updating to the build 2 packages which are already available should fix this issue. Newly created environments should install this build of Python automatically.

I have no idea where the 3.7.0 (defaults, Jun 28 2018... string is coming from.

For what is is worth, the 3.7.0 version is coming from the python binary in the python.app package.

Thanks @jjhelmus for the clarification! That means that running

conda update python

should fix the problem.

People that posted on this issue, please confirm.

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

Yes that fixes it for me too, thank you!

Why is this not handled when I run conda update --all?

for me everything is running again as well

Ok, this is great news! Thanks a lot @jjhelmus for your help!

Why is this not handled when I run conda update --all?

Any comments about this @jjhelmus?

Thank you so much!

In my case, I uninstalled Spyder 2 and run:

conda activate
spyder

Was this page helpful?
0 / 5 - 0 ratings