Spyder: Cannot start ipython kernel after fresh install of spyder within a conda environment in Windows 10

Created on 6 Sep 2018  路  30Comments  路  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] Could not reproduce inside jupyter qtconsole (if console-related)
  • [x] Tried basic troubleshooting (if a bug/error)

    • [x] Restarted Spyder

    • [x] Reset preferences with spyder --reset

    • [x] Reinstalled the latest version of Anaconda

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

  • [x] Completed the Problem Description, Steps to Reproduce and Version sections below

Problem Description

I am encountering an error inside ipython console in spyder after a fresh install in a new
conda environment. This error is reproducible in python 3.5.x, 3.6.x, and 3.7.x and on two different
PCs using Windows 10 and Windows 7. Also I have tried different anaconda channels ---
conda, anaconda, and conda-forge all leading to the same issue.

Starting jupyter qtconsole directly does not return the error bellow. Also running spyder from a pip installation does not reproduce the error.

A temporary solution I found is to downgrade ipykernel to version 4.8.2 which removes the error
but adds the following warning message at the start of the console
C:\Users\markovic\Miniconda3\envs\spyder\lib\site-packages\ipykernel\parentpoller.py:116: UserWarning: Parent poll failed. If the frontend dies, the kernel may be left running. Please let us know about your system (bitness, Python, etc.) at [email protected] [email protected]""")

What steps reproduce the problem?

  1. conda create -n spyder python=3
  2. conda activate spyder
  3. conda install spyder
  4. start spyder

What is the expected output? What do you see instead?

In addition to the ipykernel error inside the console:

An error ocurred while starting the kernel
Traceback (most recent call last):
File "C:\Users\markovic\Miniconda3\envs\spyder\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "C:\Users\markovic\Miniconda3\envs\spyder\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\markovic\Miniconda3\envs\spyder\lib\site鈥憄ackages\spyder_kernels\console\__main__.py", line 11, in 
start.main()
File "C:\Users\markovic\Miniconda3\envs\spyder\lib\site鈥憄ackages\spyder_kernels\console\start.py", line 284, in main
kernel.initialize()
File "", line 2, in initialize
File "C:\Users\markovic\Miniconda3\envs\spyder\lib\site鈥憄ackages\traitlets\config\application.py", line 87, in catch_config_error
return method(app, *args, **kwargs)
File "C:\Users\markovic\Miniconda3\envs\spyder\lib\site鈥憄ackages\ipykernel\kernelapp.py", line 474, in initialize
self.init_io()
File "C:\Users\markovic\Miniconda3\envs\spyder\lib\site鈥憄ackages\ipykernel\kernelapp.py", line 326, in init_io
sys.stdout.flush()
AttributeError: 'NoneType' object has no attribute 'flush'
Traceback (most recent call last):
File "C:\Users\markovic\Miniconda3\envs\spyder\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "C:\Users\markovic\Miniconda3\envs\spyder\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\markovic\Miniconda3\envs\spyder\lib\site鈥憄ackages\spyder_kernels\console\__main__.py", line 11, in 
start.main()
File "C:\Users\markovic\Miniconda3\envs\spyder\lib\site鈥憄ackages\spyder_kernels\console\start.py", line 284, in main
kernel.initialize()
File "", line 2, in initialize
File "C:\Users\markovic\Miniconda3\envs\spyder\lib\site鈥憄ackages\traitlets\config\application.py", line 87, in catch_config_error
return method(app, *args, **kwargs)
File "C:\Users\markovic\Miniconda3\envs\spyder\lib\site鈥憄ackages\ipykernel\kernelapp.py", line 474, in initialize
self.init_io()
File "C:\Users\markovic\Miniconda3\envs\spyder\lib\site鈥憄ackages\ipykernel\kernelapp.py", line 326, in init_io
sys.stdout.flush()
AttributeError: 'NoneType' object has no attribute 'flush'
Traceback (most recent call last):
File "C:\Users\markovic\Miniconda3\envs\spyder\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "C:\Users\markovic\Miniconda3\envs\spyder\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\markovic\Miniconda3\envs\spyder\lib\site鈥憄ackages\spyder_kernels\console\__main__.py", line 11, in 
start.main()
File "C:\Users\markovic\Miniconda3\envs\spyder\lib\site鈥憄ackages\spyder_kernels\console\start.py", line 284, in main
kernel.initialize()
File "", line 2, in initialize
File "C:\Users\markovic\Miniconda3\envs\spyder\lib\site鈥憄ackages\traitlets\config\application.py", line 87, in catch_config_error
return method(app, *args, **kwargs)
File "C:\Users\markovic\Miniconda3\envs\spyder\lib\site鈥憄ackages\ipykernel\kernelapp.py", line 474, in initialize
self.init_io()
File "C:\Users\markovic\Miniconda3\envs\spyder\lib\site鈥憄ackages\ipykernel\kernelapp.py", line 326, in init_io
sys.stdout.flush()
AttributeError: 'NoneType' object has no attribute 'flush'
Traceback (most recent call last):
File "C:\Users\markovic\Miniconda3\envs\spyder\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "C:\Users\markovic\Miniconda3\envs\spyder\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\markovic\Miniconda3\envs\spyder\lib\site鈥憄ackages\spyder_kernels\console\__main__.py", line 11, in 
start.main()
File "C:\Users\markovic\Miniconda3\envs\spyder\lib\site鈥憄ackages\spyder_kernels\console\start.py", line 284, in main
kernel.initialize()
File "", line 2, in initialize
File "C:\Users\markovic\Miniconda3\envs\spyder\lib\site鈥憄ackages\traitlets\config\application.py", line 87, in catch_config_error
return method(app, *args, **kwargs)
File "C:\Users\markovic\Miniconda3\envs\spyder\lib\site鈥憄ackages\ipykernel\kernelapp.py", line 474, in initialize
self.init_io()
File "C:\Users\markovic\Miniconda3\envs\spyder\lib\site鈥憄ackages\ipykernel\kernelapp.py", line 326, in init_io
sys.stdout.flush()
AttributeError: 'NoneType' object has no attribute 'flush'

I also get the following warning inside the anaconda prompt
js: Not allowed to load local resource: file:///C:/Users/usarename/Miniconda3/envs/spyder/lib/site-packages/spyder/utils/help/static/css/default.css
This warning also disappears after a downgrade to ipykernel 4.8.2

Paste Traceback/Error Below (if applicable)

WARNING:traitlets:kernel restarted
WARNING:traitlets:kernel restarted
WARNING:traitlets:kernel restarted
WARNING:traitlets:kernel restarted
WARNING:traitlets:KernelRestarter: restart failed
WARNING:traitlets:kernel died: 18.00324773788452

Versions

  • Spyder version: 3.3.1
  • Python version: 3.7 (but also 3.6.x and 3.5.x)
  • Qt version: 5.9.6
  • PyQt version: 5.9.2
  • Operating System name/version: Win10 x64bit

Dependencies

IPython >=4.0     :  6.5.0 (OK)
cython >=0.21     :  None (NOK)
jedi >=0.9.0      :  0.12.1 (OK)
matplotlib >=2.0.0:  None (NOK)
nbconvert >=4.0   :  5.3.1 (OK)
numpy >=1.7       :  None (NOK)
pandas >=0.13.1   :  None (NOK)
pycodestyle >=2.3 :  2.4.0 (OK)
pyflakes >=0.6.0  :  2.0.0 (OK)
pygments >=2.0    :  2.2.0 (OK)
pylint >=0.25     :  2.1.1 (OK)
qtconsole >=4.2.0 :  4.4.1 (OK)
rope >=0.9.4      :  0.11.0 (OK)
sphinx >=0.6.6    :  1.7.8 (OK)
sympy >=0.7.3     :  None (NOK)
Awaiting Followup

Most helpful comment

Please close Spyder, open an Anaconda Prompt, run there

conda install -n spyder ipykernel=4.8.2

and try again.

All 30 comments

Please close Spyder, open an Anaconda Prompt, run there

conda install -n spyder ipykernel=4.8.2

and try again.

This warning also disappears after a downgrade to ipykernel 4.8.2

So that downgrade also fixes starting our IPython consoles?

I also get the following warning inside the anaconda prompt

This will be fixed in our 3.3.2 release.

Yes, installing ipykernel 4.8.2 fixes the error inside spyder and removes warning within anaconda prompt, however it adds the warning message to qtconsole (either inside spyder or when started directly with jupyter qtconsole).

This seems to be an error specific to installations from one of the conda channels. qtconsole inside spyder works fine if I install it using pip (which is also based on ipykernel 4.9.0).

As far as I know, I didn't install packages related to anaconda. But the recommendation with regard to ipykernel resolved the issue.

works for me

Installing collected packages: ipykernel
  Found existing installation: ipykernel 4.9.0
    Uninstalling ipykernel-4.9.0:
      Successfully uninstalled ipykernel-4.9.0
Successfully installed ipykernel-4.8.2

thank you @ccordoba12

error message within py console within spyder

An error ocurred while starting the kernel
Traceback (most recent call last):
File "E:\py36\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "E:\py36\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "E:\py36\lib\site鈥憄ackages\spyder_kernels\console\__main__.py", line 11, in 
start.main()
File "E:\py36\lib\site鈥憄ackages\spyder_kernels\console\start.py", line 284, in main
kernel.initialize()
File "", line 2, in initialize
File "E:\py36\lib\site鈥憄ackages\traitlets\config\application.py", line 87, in catch_config_error
return method(app, *args, **kwargs)
File "E:\py36\lib\site鈥憄ackages\ipykernel\kernelapp.py", line 474, in initialize
self.init_io()
File "E:\py36\lib\site鈥憄ackages\ipykernel\kernelapp.py", line 326, in init_io
sys.stdout.flush()

AttributeError: 'NoneType' object has no attribute 'flush'

error in cmd from which spyder was launched

 C:\Users\<username>>python E:\py36\Lib\site-packages\spyder\app\start.py
js: Not allowed to load local resource: file:///E:/py36/lib/site-packages/spyder/utils/help/static/css/default.css

packages

C:\Users\<username>pip list
Package                  Version
------------------------ ---------
alabaster                0.7.11
astroid                  2.0.4
Babel                    2.6.0
backcall                 0.1.0
bleach                   2.1.4
certifi                  2018.8.24
chardet                  3.0.4
cloudpickle              0.5.5
colorama                 0.3.9
decorator                4.3.0
defusedxml               0.5.0
docutils                 0.14
entrypoints              0.2.3
html5lib                 1.0.1
idna                     2.7
imagesize                1.1.0
ipykernel                4.8.2
ipython                  6.5.0
ipython-genutils         0.2.0
isort                    4.3.4
jedi                     0.12.1
Jinja2                   2.10
jsonschema               2.6.0
jupyter-client           5.2.3
jupyter-core             4.4.0
keyring                  13.2.1
lazy-object-proxy        1.3.1
MarkupSafe               1.0
mccabe                   0.6.1
mistune                  0.8.3
nbconvert                5.4.0
nbformat                 4.4.0
numpydoc                 0.8.0
packaging                17.1
pandocfilters            1.4.2
parso                    0.3.1
pickleshare              0.7.4
pip                      10.0.1
prompt-toolkit           1.0.15
psutil                   5.4.7
pycodestyle              2.4.0
pyflakes                 2.0.0
Pygments                 2.2.0
pylint                   2.1.1
pyparsing                2.2.0
PyQt5                    5.9.2
python-dateutil          2.7.3
pytz                     2018.5
pywin32-ctypes           0.2.0
pyzmq                    17.1.2
QtAwesome                0.4.4
qtconsole                4.4.1
QtPy                     1.5.0
requests                 2.19.1
rope                     0.11.0
setuptools               39.0.1
simplegeneric            0.8.1
sip                      4.19.8
six                      1.11.0
snowballstemmer          1.2.1
Sphinx                   1.7.9
sphinxcontrib-websupport 1.1.0
spyder                   3.3.1
spyder-kernels           0.2.6
testpath                 0.3.1
tornado                  5.1
traitlets                4.3.2
typed-ast                1.1.0
urllib3                  1.23
wcwidth                  0.1.7
webencodings             0.5.1
wrapt                    1.10.11

C:\Users\markovic\Miniconda3\envs\spyder\lib\site-packages\ipykernel\parentpoller.py:116: UserWarning: Parent poll failed. If the frontend dies, the kernel may be left running. Please let us know about your system (bitness, Python, etc.) at [email protected] [email protected]""")

I haven't seen this error before. Weird.


@minrk, sorry to bother you again but:

  1. Have you seen this error?
  2. Any chance to get ipykernel 4.9.1 soon? This is like the fifth issue we have seen about this. Thanks!

I opened a pr against ipykernel that fixes this issue for me. Would be great to have it tested by others https://github.com/ipython/ipykernel/pull/344

@ccordoba12 FYI, I am also getting the same warning message in Spyder's IPython console (Parent poll failed. etc...) when using Spyder 3.x as of right now (i.e. with this fix), with a clean spyder install on a new env with Python 3.7 and ipykernel manually downgraded to 4.8.2. The warning does not appear with Python 3.6 and an otherwise identical configuration.

So is this a Python 3.7 only issue?

@ccordoba12 The warning message in Spyder's IPython Console, yes.

I see. Please report it in ipykernel and ping me when you do it. Thanks!

@ccordoba12 It doesn't occur in other IPython kernels outside of Spyder in the same environment, even if I launch a QtConsole instance in the same environment. So presumably, it is something specific to how the kernel is being launched in Spyder vs. in plain QtConsole, even if the problem is in fact on their end. Should I still report it? What should I tell them, other than the basic details of my environment and dependencies?

I'll have to take a look at this first. Thanks for noticing that it's a Spyder problem.

FYI, having the same problem here. I'm guessing this is what's causing Ctrl-C to not work to interrupt running processes (the Console cannot be interrupted to come back with the prompt until the process finishes).

Windows-10
Spyder 3.3.1
Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)]
IPython 7.0.1
(not using Anaconda)

Also note that starting Ipython from a command shell doesn't report this warning.

Console reports:

c:\users\hans\appdata\local\programs\python\python37\lib\site-packages\ipykernel\parentpoller.py:116: UserWarning: Parent poll failed.  If the frontend dies,
                the kernel may be left running.  Please let us know
                about your system (bitness, Python, etc.) at
                [email protected]
  [email protected]""")

Packages:

Package                  Version
------------------------ ----------
alabaster                0.7.11
astroid                  2.0.4
attrs                    17.4.0
Babel                    2.6.0
backcall                 0.1.0
backoff                  1.6.0
beautifulsoup4           4.6.3
bleach                   2.1.4
cachetools               2.1.0
certifi                  2018.8.24
chardet                  3.0.4
click                    6.7
cloudpickle              0.5.5
colorama                 0.3.9
cycler                   0.10.0
Cython                   0.28.5
decorator                4.3.0
docutils                 0.14
dogpile.cache            0.6.7
entrypoints              0.2.3
enum-compat              0.0.2
enum34                   1.1.6
fasteners                0.14.1
Flask                    1.0.2
Flask-Cors               3.0.6
google                   2.0.1
google-api-core          1.4.1
google-api-python-client 1.7.4
google-apitools          0.5.24
google-auth              1.5.1
google-auth-httplib2     0.0.3
google-auth-oauthlib     0.2.0
google-cloud-core        0.28.1
google-cloud-storage     1.13.0
google-resumable-media   0.3.1
googleapis-common-protos 1.5.3
html5lib                 1.0.1
httplib2                 0.11.3
idna                     2.7
imagesize                1.1.0
ipykernel                4.9.0
ipython                  7.0.1
ipython-genutils         0.2.0
ipywidgets               7.4.1
isort                    4.3.4
itsdangerous             0.24
jedi                     0.12.1
Jinja2                   2.10
jsonpickle               1.0
jsonschema               2.6.0
jupyter                  1.0.0
jupyter-client           5.2.3
jupyter-console          5.2.0
jupyter-core             4.4.0
keyring                  13.2.1
kiwisolver               1.0.1
lazy-object-proxy        1.3.1
MarkupSafe               1.0
matplotlib               3.0.0
mccabe                   0.6.1
mistune                  0.8.3
monotonic                1.5
mpmath                   1.0.0
nbconvert                5.3.1
nbformat                 4.4.0
notebook                 5.6.0
numpy                    1.15.2+mkl
numpydoc                 0.8.0
oauth2client             3.0.0
oauthlib                 2.1.0
packaging                17.1
pandas                   0.23.4
pandocfilters            1.4.2
parso                    0.3.1
patsy                    0.5.0
pickleshare              0.7.4
pip                      18.1
pipenv                   2018.10.13
prometheus-client        0.3.1
prompt-toolkit           2.0.6
protobuf                 3.6.1
psutil                   5.4.7
psycopg2                 2.7.5
pyasn1                   0.4.4
pyasn1-modules           0.2.2
pycodestyle              2.4.0
pyflakes                 2.0.0
pygatt                   3.2.0
Pygments                 2.2.0
pylint                   2.1.1
pylru                    1.1.0
pyparsing                2.2.2
PyQt5                    5.9.2
pyserial                 3.4
python-dateutil          2.7.3
pytz                     2018.5
PyWavelets               1.0.1
pywin32-ctypes           0.2.0
pywinpty                 0.5.4
pywt                     1.0.6
PyYAML                   3.13
pyzmq                    17.1.2
QtAwesome                0.4.4
qtconsole                4.4.1
QtPy                     1.5.0
requests                 2.19.1
requests-oauthlib        1.0.0
rope                     0.11.0
rsa                      4.0
scikit-learn             0.20.0
scipy                    1.1.0
Send2Trash               1.5.0
setuptools               40.4.3
simplegeneric            0.8.1
sip                      4.19.8
six                      1.11.0
snowballstemmer          1.2.1
Sphinx                   1.7.9
sphinxcontrib-websupport 1.1.0
spyder                   3.3.1
spyder-kernels           0.2.6
SQLAlchemy               1.2.12
SQLAlchemy-Utils         0.33.5
statsmodels              0.9.0
sympy                    1.2
termcolor                1.1.0
terminado                0.8.1
testpath                 0.3.1
tornado                  5.1
traitlets                4.3.2
uritemplate              3.0.0
urllib3                  1.23
virtualenv               16.0.0
virtualenv-clone         0.3.0
wcwidth                  0.1.7
webencodings             0.5.1
Werkzeug                 0.14.1
widgetsnbextension       3.4.1
wrapt                    1.10.11

By the way, I think it may be a Python 3.7 only issue. At work I run Python 3.65 with pretty much the same setup otherwise, and I don't have the problem.

By the way, I think it may be a Python 3.7 only issue. At work I run Python 3.65 with pretty much the same setup otherwise, and I don't have the problem.

This is already confirmed, yes.

This is not the case for me, I'm on Python 3.5 and have the same issue.

@eehlise What is the exact behavior and error message you observe? When did this start occurring? What are your OS, Spyder, PyQt/Qt, IPython and QtConsole versions?

As I suspected, this error is not the same as the one reported and discussed in this thread, and is in fact totally unrelated. In the future, please read your error message and ensure it matches the one actually mentioned in the thread in order to get appropriate advice and not confuse the situation for yourself and others. It is all too common that users report having the "same issue", but their actual error message is totally different from the issue at hand.

Your Python environment or installation doesn't have the spyder鈥慿ernels module or the right version of it installed. Without this module is not possible for Spyder to create a console for you.

Most likely, this has to do with the python interpreter set under Preferences > Python interpreter being one in which the correct version of spyder-kernels is not installed (or perhaps running on a different version of Python e.g. 2 vs 3, although this still should work in my testing). Try setting it to "Default" or set the path under "Use the following Python interpreter" to the python.exe in the environment (under <Aanaconda_Dir>/envs) that you want to work in that has Spyder-Kernels, e.g. your Python 3.5 one.

Also, some additional comments:

that env is running Python 2.7.

This implies you are running Anaconda2; we strongly recommend you run Anaconda3 (i.e. Python 3.6/3.7 in base) and create Python 2 environment(s) as required if you really need them. There have been some problems reported with doing the former (not necessarily Spyder-related), Python 2 is EoL in a little over a year and most core scientific Python packages have already dropped Python 2 support or will be in the next few months.

Anaconda 1.9.2

Either you have an incredibly old version of Anaconda (the current one is 5.3.0) and should upgrade, or you're reporting something other than the version of Anaconda you downloaded and/or the anaconda metapackage in your base environment.

I did a clean install of anaconda and installed the spyder packages from within ancaconda. After starting spyder i got the message:

c:\users...\appdata\local\programs\python\python37\lib\site-packagesipykernel\parentpoller.py:116: UserWarning: Parent poll failed. If the frontend dies,
the kernel may be left running. Please let us know
about your system (bitness, Python, etc.) at
[email protected]
[email protected]""")

Moreover all matplotlib plot windows did not respond and crashed. I performed the downgrade of IPython to version 4.8.2 and everything was working again.

This is the exact behavior described in the original post, yes. As you figured out, it is a bug in the third party package ipykernel version 4.9.0, and will be fixed in 4.9.1.

I performed the downgrade of IPython to version 4.8.2

I assume you mean ipykernel, not ipython.

Indeed ipykernel 4.8.2

The kernel 5.1.0 solves the problem (ipykernel-5.1.0 ):

conda install ipykernel
Solving environment: done

Package Plan

environment location: ...

added / updated specs:
- ipykernel

The following packages will be downloaded:

package                    |            build
---------------------------|-----------------
ipykernel-5.1.0            |   py36h39e3cac_0         156 KB

The following packages will be UPDATED:

ipykernel: 4.9.0-py36_1 --> 5.1.0-py36h39e3cac_0

Proceed ([y]/n)? y

Downloading and Extracting Packages
ipykernel-5.1.0 | 156 KB | #####################################################

I ran:

conda install -n spyder ipykernel=5.1

showing the following error:
EnvironmentLocationNotFound: Not a conda environment: C:\Users\guhas\Anaconda_setup\envs\spyder

conda install -n spyder ipykernel=5.1

As you can see from the documentation, the -n flag performs the install into the named environment, and the error message therefore tells you that such an environment does not exist on your system (as you have not created it like the OP stated they did, with conda create -n spyder python=3.6).

Therefore, you should simply run conda install ipykernel=5.1 into whatever environment Spyder is installed in (base, by default) to accomplish the same, or else perform the steps as described by the OP to create a dedicated environment for Spyder, if you so choose.

conda install -n spyder ipykernel=5.1

As you can see from the documentation, the -n flag performs the install into the named environment, and the error message therefore tells you that such an environment does not exist on your system (as you have not created it like the OP stated they did, with conda create -n spyder python=3.6).

Therefore, you should simply run conda install ipykernel=5.1 into whatever environment Spyder is installed in (base, by default) to accomplish the same, or else perform the steps as described by the OP to create a dedicated environment for Spyder, if you so choose.

this worked, its running the files now, thanks!

conda install -n spyder ipykernel=5.1

As you can see from the documentation, the -n flag performs the install into the named environment, and the error message therefore tells you that such an environment does not exist on your system (as you have not created it like the OP stated they did, with conda create -n spyder python=3.6).

Therefore, you should simply run conda install ipykernel=5.1 into whatever environment Spyder is installed in (base, by default) to accomplish the same, or else perform the steps as described by the OP to create a dedicated environment for Spyder, if you so choose.

Thanks man

I did everything including reinstalling Anaconda but I'm still getting this traceback. Please help.

Traceback (most recent call last):
File "C:\Users\sandhanaconda3\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "C:\Users\sandhanaconda3\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\sandhanaconda3\lib\site鈥憄ackages\spyder_kernels\console__main__.py", line 11, in
start.main()
File "C:\Users\sandhanaconda3\lib\site鈥憄ackages\spyder_kernels\console\start.py", line 288, in main
import_spydercustomize()
File "C:\Users\sandhanaconda3\lib\site鈥憄ackages\spyder_kernels\console\start.py", line 39, in import_spydercustomize
import spydercustomize
File "C:\Users\sandhanaconda3\lib\site鈥憄ackages\spyder_kernels\customize\spydercustomize.py", line 17, in
import pdb
File "C:\Users\sandhanaconda3\lib\pdb.py", line 76, in
import code
File "C:\Users\sandh\code.py", line 6
else:
^
SyntaxError: invalid syntax

@Atr0y As you can see by reading your traceback:

import code
File "C:\Users\sandh\code.py", line 6
else:
^
SyntaxError: invalid syntax

your error doesn't have anything to do with the one originally reported here, and is rather due to you having a file code.py in your user folder, your default working directory with Spyder, which shadows the builtin module code. Moving, renaming or removing that file will fix the problem. Thanks.

It worked! thanks a lot.

@Atr0y Sure thing, best of luck in the future!

Was this page helpful?
0 / 5 - 0 ratings