Spyder: re.error when creating kernel

Created on 30 Sep 2019  路  8Comments  路  Source: spyder-ide/spyder

Description

What steps will reproduce the problem?

I installed the TensorFlow package and since then I started to get the following error message. I tried to uninstall all packages, python related installations, conda and anaconda and delete all the related files and reinstall only Anaconda (latest version, windows 64bit), but still I get the same error message. Restarting kernel or resetting Spyder will not help. Updating, removing and reinstalling all packages and spyder with conda did not help. Adding Spyder to firewall exceptions of windows did not help.

An error occurred while starting the kernel
Traceback (most recent call last):
File "C:\Users\amkh8857\AppData\Local\Continuum\anaconda3\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "C:\Users\amkh8857\AppData\Local\Continuum\anaconda3\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\amkh8857\AppData\Local\Continuum\anaconda3\lib\site鈥憄ackages\spyder_kernels\console\__main__.py", line 11, in 
start.main()
File "C:\Users\amkh8857\AppData\Local\Continuum\anaconda3\lib\site鈥憄ackages\spyder_kernels\console\start.py", line 306, in main
kernel.initialize()
File "", line 2, in initialize
File "C:\Users\amkh8857\AppData\Local\Continuum\anaconda3\lib\site鈥憄ackages\traitlets\config\application.py", line 87, in catch_config_error
return method(app, *args, **kwargs)
File "C:\Users\amkh8857\AppData\Local\Continuum\anaconda3\lib\site鈥憄ackages\ipykernel\kernelapp.py", line 484, in initialize
self.init_kernel()
File "C:\Users\amkh8857\AppData\Local\Continuum\anaconda3\lib\site鈥憄ackages\ipykernel\kernelapp.py", line 389, in init_kernel
user_ns=self.user_ns,
File "C:\Users\amkh8857\AppData\Local\Continuum\anaconda3\lib\site鈥憄ackages\traitlets\config\configurable.py", line 412, in instance
inst = cls(*args, **kwargs)
File "C:\Users\amkh8857\AppData\Local\Continuum\anaconda3\lib\site鈥憄ackages\spyder_kernels\console\kernel.py", line 37, in __init__
super(SpyderKernel, self).__init__(*args, **kwargs)
File "C:\Users\amkh8857\AppData\Local\Continuum\anaconda3\lib\site鈥憄ackages\ipykernel\ipkernel.py", line 67, in __init__
kernel = self,
File "C:\Users\amkh8857\AppData\Local\Continuum\anaconda3\lib\site鈥憄ackages\traitlets\config\configurable.py", line 412, in instance
inst = cls(*args, **kwargs)
File "C:\Users\amkh8857\AppData\Local\Continuum\anaconda3\lib\site鈥憄ackages\IPython\core\interactiveshell.py", line 693, in __init__
self.init_magics()
File "C:\Users\amkh8857\AppData\Local\Continuum\anaconda3\lib\site鈥憄ackages\ipykernel\zmqshell.py", line 593, in init_magics
super(ZMQInteractiveShell, self).init_magics()
File "C:\Users\amkh8857\AppData\Local\Continuum\anaconda3\lib\site鈥憄ackages\IPython\core\interactiveshell.py", line 2245, in init_magics
m.PylabMagics, m.ScriptMagics,
File "C:\Users\amkh8857\AppData\Local\Continuum\anaconda3\lib\site鈥憄ackages\IPython\core\magic.py", line 405, in register
m = m(shell=self.shell)
File "C:\Users\amkh8857\AppData\Local\Continuum\anaconda3\lib\site鈥憄ackages\IPython\core\magics\osm.py", line 52, in __init__
self.execre = re.compile(r'(.*)\.(%s)$' % winext,re.IGNORECASE)
File "C:\Users\amkh8857\AppData\Local\Continuum\anaconda3\lib\re.py", line 234, in compile
return _compile(pattern, flags)
File "C:\Users\amkh8857\AppData\Local\Continuum\anaconda3\lib\re.py", line 286, in _compile
p = sre_compile.compile(pattern, flags)
File "C:\Users\amkh8857\AppData\Local\Continuum\anaconda3\lib\sre_compile.py", line 764, in compile
p = sre_parse.parse(p, flags)
File "C:\Users\amkh8857\AppData\Local\Continuum\anaconda3\lib\sre_parse.py", line 930, in parse
p = _parse_sub(source, pattern, flags & SRE_FLAG_VERBOSE, 0)
File "C:\Users\amkh8857\AppData\Local\Continuum\anaconda3\lib\sre_parse.py", line 426, in _parse_sub
not nested and not items))
File "C:\Users\amkh8857\AppData\Local\Continuum\anaconda3\lib\sre_parse.py", line 816, in _parse
p = _parse_sub(source, state, sub_verbose, nested + 1)
File "C:\Users\amkh8857\AppData\Local\Continuum\anaconda3\lib\sre_parse.py", line 426, in _parse_sub
not nested and not items))
File "C:\Users\amkh8857\AppData\Local\Continuum\anaconda3\lib\sre_parse.py", line 507, in _parse
code = _escape(source, this, state)
File "C:\Users\amkh8857\AppData\Local\Continuum\anaconda3\lib\sre_parse.py", line 402, in _escape
raise source.error("bad escape %s" % escape, len(escape))
re.error: bad escape \P at position 52

Versions

  • Spyder version: 3.3.6
  • Python version: 3.7.3
  • Qt version: 5.9.6
  • PyQt5 version: 5.9.2
  • Operating System: Windows 8.1

Dependencies

pyflakes >=0.6.0  :  2.1.1 (OK)
pycodestyle >=2.3 :  2.5.0 (OK)
pygments >=2.0    :  2.4.2 (OK)
sphinx >=0.6.6    :  2.1.2 (OK)
rope >=0.9.4      :  0.14.0 (OK)
jedi >=0.9.0      :  0.13.3 (OK)
nbconvert >=4.0   :  5.5.0 (OK)
pandas >=0.13.1   :  0.24.2 (OK)
numpy >=1.7       :  1.16.4 (OK)
sympy >=0.7.3     :  1.4 (OK)
cython >=0.21     :  0.29.12 (OK)
qtconsole >=4.2.0 :  4.5.1 (OK)
IPython >=4.0     :  7.6.1 (OK)
matplotlib >=2.0.0:  3.1.0 (OK)
pylint >=0.25     :  2.3.1 (OK)
Bug upstream

All 8 comments

This looks like a bug in IPython. Until we submit a fix for it, you need to look for the pathext environment variable and remove it or edit it to be in the right format, as described here:

https://www.nextofwindows.com/what-is-pathext-environment-variable-in-windows

Thanks! it worked! Great!

Thanks! it worked! Great!

Glad to know!


I reopened this issue so we don't forget to submit a fix to IPython.

This looks like a bug in IPython. Until we submit a fix for it, you need to look for the pathext environment variable and remove it or edit it to be in the right format, as described here:

https://www.nextofwindows.com/what-is-pathext-environment-variable-in-windows

Thank you very much, this saved my day!

@dalthviz, this requires a simple fix in IPython (just catch an error on Windows when pathext is malformed), but it's not urgent.

@dalthviz, there's a new IPython release coming soon, so please address this one with a PR there as soon as you can.

Fixed with ipython/ipython#12367

Thanks a lot @dalthviz!

Was this page helpful?
0 / 5 - 0 ratings