Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New IPython consoles or restart of kernel not working because of pkg_resources error #2679

Closed
Diti24 opened this issue Sep 8, 2015 · 47 comments

Comments

@Diti24
Copy link

Diti24 commented Sep 8, 2015

Description

What steps will reproduce the problem?

  1. Stat spyder
  2. try to create a new ipython console (in Consoles-> Open an IPython console

What is the expected output? What do you see instead?
A new console should appear but the new console immediately stops with the following error:

Error in sitecustomize; set PYTHONVERBOSE for traceback:
TypeError: 'NoneType' object is not callable
Traceback (most recent call last):
File "/pyzo2014a/lib/python3.4/site‑packages/spyderlib/widgets/externalshell/start_ipython_kernel.py", line 175, in 
from IPython.kernel.zmq.kernelapp import IPKernelApp
File "pyzo2014a/lib/python3.4/site‑packages/IPython/__init__.py", line 48, in 
from .terminal.embed import embed
File "pyzo2014a/lib/python3.4/site‑packages/IPython/terminal/embed.py", line 16, in 
from IPython.core.interactiveshell import DummyMod
File "pyzo2014a/lib/python3.4/site‑packages/IPython/core/interactiveshell.py", line 31, in 
from pickleshare import PickleShareDB
File "pyzo2014a/lib/python3.4/site‑packages/pickleshare.py", line 41, in 
from path import path as Path
File "pyzo2014a/lib/python3.4/site‑packages/path.py", line 122, in 
__version__ = pkg_resources.require('path.py')[0].version
TypeError: 'NoneType' object is not callable

Please provide any additional information below

Version and main components

  • Spyder Version: 2.3.6
  • Python Version: 3.4.3
  • Qt Versions: 4.8.6, PyQt4 (API v2) 4.11.3 on Linux

Optional dependencies

pyflakes >=0.6.0:  0.9.2 (OK)
pep8 >=0.6      :  1.6.2 (OK)
pygments >=1.6  :  2.0.2 (OK)
IPython >=1.0   :  4.0.0 (OK)
zmq >=2.1.11    :  14.7.0 (OK)
qtconsole >=4.0 :  4.0.1 (OK)
pandas >=0.13.1 :  0.16.2 (OK)
sphinx >=0.6.6  :  1.2.3 (OK)
psutil >=0.3    :  2.2.1 (OK)
rope >=0.9.2    :  0.9.4-1 (OK)
jedi >=0.8.1    :  0.9.0 (OK)
matplotlib >=1.0:  1.4.3 (OK)
sympy >=0.7.3   :  0.7.6.1 (OK)
pylint >=0.25   :  0.25.1 (OK)

@ccordoba12
Copy link
Member

This clearly seems an issue with pyzo, not with Spyder, so please report this error with them.

@Diti24
Copy link
Author

Diti24 commented Sep 9, 2015

Hi, I just installed anaconda from skretch as suggested in #2680. Right after installation it worked.
Than I made a conda update --all (so getting ipython 4.0.0 and spyder 2.3.6) and i got the same behaviour as with pyzo.
This is the update process I made, maybe here this can help to understand which package is causing the probel?:
./conda update --all
Fetching package metadata: ....
Solving package specifications: .
Package plan for installation in environment /home/diti/anaconda3:

The following packages will be downloaded:

package build
nbconvert-4.0.0 py34_0 269 KB
odo-0.3.3 np19py34_0 157 KB
blaze-core-0.8.2 np19py34_0 348 KB
notebook-4.0.4 py34_0 4.2 MB
qtconsole-4.0.1 py34_0 128 KB
ipython-notebook-4.0.4 py34_0 5 KB
ipython-qtconsole-4.0.1 py34_0 4 KB
spyder-2.3.6 py34_0 2.7 MB
spyder-app-2.3.6 py34_0 7 KB
------------------------------------------------------------
                                       Total:         7.8 MB

The following NEW packages will be INSTALLED:

funcsigs:          0.4-py34_0        
ipykernel:         4.0.3-py34_0      
ipython_genutils:  0.1.0-py34_0      
jupyter_client:    4.0.0-py34_0      
jupyter_core:      4.0.4-py34_0      
krb5:              1.13.2-0          
libgfortran:       1.0-0             
nbconvert:         4.0.0-py34_0      
nbformat:          4.0.0-py34_0      
notebook:          4.0.4-py34_0      
openblas:          0.2.14-1          
patchelf:          0.6-0             
path.py:           7.6-py34_0        
pbr:               1.3.0-py34_0      
pexpect:           3.3-py34_0        
pickleshare:       0.5-py34_0        
qtconsole:         4.0.1-py34_0      
simplegeneric:     0.8.1-py34_0      
traitlets:         4.0.0-py34_0      
wheel:             0.24.0-py34_0     

The following packages will be UPDATED:

argcomplete:       0.8.9-py34_0      --> 0.9.0-py34_0      
astropy:           1.0.3-np19py34_0  --> 1.0.4-np19py34_0  
bcolz:             0.9.0-np19py34_0  --> 0.10.0-np19py34_0 
binstar:           0.11.0-py34_0     --> 0.12-2            
blaze-core:        0.8.0-np19py34_0  --> 0.8.2-np19py34_0  
bokeh:             0.9.0-np19py34_0  --> 0.9.3-np19py34_0  
cffi:              1.1.0-py34_0      --> 1.1.2-py34_0      
clyent:            0.3.4-py34_0      --> 0.4.0-py34_0      
conda:             3.14.1-py34_0     --> 3.16.0-py34_0     
conda-build:       1.14.1-py34_0     --> 1.17.0-py34_0     
conda-env:         2.2.3-py34_0      --> 2.4.2-py34_0      
cryptography:      0.9.1-py34_0      --> 0.9.3-py34_0      
curl:              7.43.0-0          --> 7.43.0-1          
cython:            0.22.1-py34_0     --> 0.23.1-py34_0     
datashape:         0.4.5-np19py34_0  --> 0.4.6-np19py34_0  
decorator:         3.4.2-py34_0      --> 4.0.2-py34_0      
ipython:           3.2.0-py34_0      --> 4.0.0-py34_0      
ipython-notebook:  3.2.0-py34_0      --> 4.0.4-py34_0      
ipython-qtconsole: 3.2.0-py34_0      --> 4.0.1-py34_0      
jedi:              0.8.1-py34_0      --> 0.9.0-py34_0      
jinja2:            2.7.3-py34_1      --> 2.8-py34_0        
llvmlite:          0.5.0-py34_0      --> 0.6.0-py34_0      
mistune:           0.5.1-py34_1      --> 0.7.1-py34_0      
mock:              1.0.1-py34_0      --> 1.3.0-py34_0      
multipledispatch:  0.4.7-py34_0      --> 0.4.8-py34_0      
networkx:          1.9.1-py34_0      --> 1.10-py34_0       
nltk:              3.0.3-np19py34_0  --> 3.0.4-np19py34_0  
numba:             0.19.1-np19py34_0 --> 0.20.0-np19py34_0 
numpy:             1.9.2-py34_0      --> 1.9.2-py34_1      
odo:               0.3.2-np19py34_0  --> 0.3.3-np19py34_0  
openpyxl:          1.8.5-py34_0      --> 2.0.2-py34_0      
patsy:             0.3.0-np19py34_0  --> 0.4.0-np19py34_0  
pillow:            2.8.2-py34_0      --> 2.9.0-py34_0      
pip:               7.0.3-py34_0      --> 7.1.2-py34_0      
py:                1.4.27-py34_0     --> 1.4.30-py34_0     
pytables:          3.2.0-np19py34_0  --> 3.2.1.1-np19py34_0
pytest:            2.7.1-py34_0      --> 2.7.2-py34_0      
scipy:             0.15.1-np19py34_0 --> 0.16.0-np19py34_1 
setuptools:        17.1.1-py34_0     --> 18.1-py34_0       
spyder:            2.3.5.2-py34_0    --> 2.3.6-py34_0      
spyder-app:        2.3.5.2-py34_0    --> 2.3.6-py34_0      
sqlalchemy:        1.0.5-py34_0      --> 1.0.8-py34_0      
sympy:             0.7.6-py34_0      --> 0.7.6.1-py34_0    
toolz:             0.7.2-py34_0      --> 0.7.4-py34_0      
tornado:           4.2-py34_0        --> 4.2.1-py34_0      
xlrd:              0.9.3-py34_0      --> 0.9.4-py34_0

@ccordoba12
Copy link
Member

I really don't understand why you're getting the same error as the pyzo one, if pyzo is not part of Anaconda :-)

@ccordoba12
Copy link
Member

Please post the exact error you're getting with Anaconda :-)

@Diti24
Copy link
Author

Diti24 commented Sep 15, 2015

Hi

Error in sitecustomize; set PYTHONVERBOSE for traceback:
TypeError: 'NoneType' object is not callable
Traceback (most recent call last):
File "/mnt/disk2/opt/anaconda3/lib/python3.4/site‑packages/spyderlib/widgets/externalshell/start_ipython_kernel.py", line 175, in 
from IPython.kernel.zmq.kernelapp import IPKernelApp
File "/mnt/disk2/opt/anaconda3/lib/python3.4/site‑packages/IPython/__init__.py", line 48, in 
from .terminal.embed import embed
File "/mnt/disk2/opt/anaconda3/lib/python3.4/site‑packages/IPython/terminal/embed.py", line 16, in 
from IPython.core.interactiveshell import DummyMod
File "/mnt/disk2/opt/anaconda3/lib/python3.4/site‑packages/IPython/core/interactiveshell.py", line 31, in 
from pickleshare import PickleShareDB
File "/mnt/disk2/opt/anaconda3/lib/python3.4/site‑packages/pickleshare.py", line 41, in 
from path import path as Path
File "/mnt/disk2/opt/anaconda3/lib/python3.4/site‑packages/path.py", line 122, in 
__version__ = pkg_resources.require('path.py')[0].version
TypeError: 'NoneType' object is not callable

@ccordoba12
Copy link
Member

I really don't know what's happening, sorry.

Couldn't you stay on Anaconda 2.3 for the moment? I mean, if that's working for you, you should stay there :-)

@Diti24
Copy link
Author

Diti24 commented Sep 15, 2015

I was just interested in spyder 2.3.6 instead of 2.3.5.2 because it fixed this
issue #2593.
But of course I can wait for the moment.
Thanks anyway

@ccordoba12
Copy link
Member

Then please run

conda update spyder

to only update Spyder :-)

@Diti24
Copy link
Author

Diti24 commented Sep 16, 2015

So first I did
./conda update spyder and I got same problems, probably because of these dependencies
The following NEW packages will be INSTALLED:

ipykernel:        4.0.3-py34_0 
ipython_genutils: 0.1.0-py34_0 
jupyter_client:   4.0.0-py34_0 
jupyter_core:     4.0.4-py34_0 
nbconvert:        4.0.0-py34_0 
nbformat:         4.0.0-py34_0 
path.py:          7.6.1-py34_0 
pexpect:          3.3-py34_0   
pickleshare:      0.5-py34_0   
qtconsole:        4.0.1-py34_0 
simplegeneric:    0.8.1-py34_0 
traitlets:        4.0.0-py34_0 
wheel:            0.24.0-py34_0

The following packages will be UPDATED:

conda:            3.14.1-py34_0  --> 3.17.0-py34_0
conda-env:        2.2.3-py34_0   --> 2.4.2-py34_0 
decorator:        3.4.2-py34_0   --> 4.0.2-py34_0 
ipython:          3.2.0-py34_0   --> 4.0.0-py34_0 
jedi:             0.8.1-py34_0   --> 0.9.0-py34_0 
jinja2:           2.7.3-py34_1   --> 2.8-py34_0   
mistune:          0.5.1-py34_1   --> 0.7.1-py34_0 
pip:              7.0.3-py34_0   --> 7.1.2-py34_0 
setuptools:       17.1.1-py34_0  --> 18.1-py34_0  
spyder:           2.3.5.2-py34_0 --> 2.3.6-py34_0 

afterwards I tried with
./conda update --no-deps spyder
and finally I got 2.3.6 working.
The following issue:
#2680 (comment)
is still there, but this is minor it is not need and we survive without.

Thanks

@ccordoba12 ccordoba12 changed the title New console or restart of kernel not working New IPython console or restart of kernel not working Sep 16, 2015
@ccordoba12 ccordoba12 added this to the v2.3.7 milestone Sep 16, 2015
@ccordoba12
Copy link
Member

I'm glad to know that you were able to workaround this problem :-) I'll take a closer look at this issue and I'll try to fix for 2.3.7

@ccordoba12 ccordoba12 changed the title New IPython console or restart of kernel not working New IPython consoles or restart of kernel not working Sep 16, 2015
@ccordoba12 ccordoba12 removed this from the v2.3.7 milestone Sep 28, 2015
@ccordoba12 ccordoba12 changed the title New IPython consoles or restart of kernel not working New IPython consoles or restart of kernel not working because of pkg_resources error Sep 28, 2015
@ccordoba12
Copy link
Member

Ok, according to this post:

http://stackoverflow.com/questions/32155633/error-while-starting-new-ipython-console-in-spyder

this problem has nothing to do with Spyder, and it is solved by running

conda update setuptools

in case you're using Anaconda. If not, you just need to update setuptools to its latest version to fix it.

@leekahung
Copy link

Hm...I think that's the issue for me though. I think I had a similar problem where I've also tried conda update setuptools on my terminal, but the issue still lingers. Is it a separate problem? (Trying to learn Python and this issue isn't helping me get started as a beginner...It'll be a great help for me, thank you guys in advance. Should I just do a fresh install and not update spyder to 2.3.6 from 2.3.5.2 at the moment?)

What's shown on the IPython console (below):

An error ocurred while starting the kernel
Error in sitecustomize; set PYTHONVERBOSE for traceback:
TypeError: 'NoneType' object is not callable
Traceback (most recent call last):
File "/Users/guest/anaconda/lib/python3.4/site‑packages/spyderlib/widgets/externalshell/start_ipython_kernel.py", line 175, in
from IPython.kernel.zmq.kernelapp import IPKernelApp
File "/Users/guest/anaconda/lib/python3.4/site‑packages/IPython/init.py", line 48, in
from .terminal.embed import embed
File "/Users/guest/anaconda/lib/python3.4/site‑packages/IPython/terminal/embed.py", line 16, in
from IPython.core.interactiveshell import DummyMod
File "/Users/guest/anaconda/lib/python3.4/site‑packages/IPython/core/interactiveshell.py", line 31, in
from pickleshare import PickleShareDB
File "/Users/guest/anaconda/lib/python3.4/site‑packages/pickleshare.py", line 41, in
from path import path as Path
File "/Users/guest/anaconda/lib/python3.4/site‑packages/path.py", line 123, in
version = pkg_resources.require('path.py')[0].version
TypeError: 'NoneType' object is not callable

(I've tried playing around with the program and I somehow manage to keep one IPython console functional by opening it with a regular Python console at the same time, but I can't get any new consoles opened for IPython without that error message reappearing. And if I restart the kernel on the console that works, the error screen will appear. This is very frustrating.)

@ccordoba12
Copy link
Member

@leekahung, please run the command I mentioned in my last comment to fix this problem.

@steve28
Copy link

steve28 commented Oct 8, 2015

@ccordoba12 - I'm have the same issue and I have run:
conda update setuptools

conda reports it's already up to date.

Edit: Here's 100% repro case for me:

  1. download anaconda python3 installer, install fresh anaconda.
  2. try spyder - it works.
  3. run conda update conda, then conda update anaconda (nothing updates), then conda update spyder

now you get the path.py issue when spyder attempts to start an ipython console

@twmacro
Copy link

twmacro commented Oct 11, 2015

@ccordoba12, I’m getting the exact same error message as @leekahung posted and had similar experience as @steve28. Somedays, I wouldn’t see it, other days, I would get it every time. On one of those bad days, I tried three different installations for experimentation:

  1. Anaconda3-2.3.0-Linux-x86_64.sh -- no error
  2. Anaconda3-2.3.0-Linux-x86_64.sh + conda update --all -- produces error
  3. Anaconda3-2.3.0-Linux-x86_64.sh + conda update spyder -- produces error

However, in the 2nd and 3rd cases, I did notice something that might be helpful: when I deleted my ~/.spyder2-py3 directory, spyder started without that error. When I left that directory in place -- even without making any custom settings -- it gave that error. I experimented with that at least 15 times.

As a temporary work-around, I edited the file: .../anaconda/lib/python3.4/site packages/path.py. I simply added the except TypeError: logic:

try:
    import pkg_resources
    __version__ = pkg_resources.require('path.py')[0].version
except ImportError:
    __version__ = 'unknown'
except pkg_resources.DistributionNotFound:
    __version__ = 'unknown'
except TypeError:
    __version__ = 'unknown'

I'm sure that's not the right fix, but it gets me running for now.

@albahnsen
Copy link

I'm having exactly the same issue. works perfect with fresh anaconda, then I installed joblib using conda, and I start having the issue.

@Diti24
Copy link
Author

Diti24 commented Nov 16, 2015

Still have the same problem with spyder 2.3.7. But I can confirm that twmacro commented on Oct 11 worked also for me.

@DSLituiev
Copy link

same problem. Tried the measure mentioned by @ccordoba12 -- it did not work

@Diti24
Copy link
Author

Diti24 commented Nov 17, 2015

Hi @DSLituiev was the same for me, the one mentioned by @twmacro should work right? Well is just a temporary fix, is probably not the right solution but at least it works...

@DSLituiev
Copy link

thank you @Diti24 and @twmacro!
It looks like it works (restarted kernel 7 times with no problem; earlier failed after third time or so).

@twmacro
Copy link

twmacro commented Nov 18, 2015

I’m seeing this same behavior with Anaconda3-2.4.0-Linux-x86_64.sh. I made the same fix as I indicated above and that works.

I stumbled on another apparent fix while I attempted to follow this through with a debugger (python -m pdb spyder). The second fix is to unpack the setuptools egg file:

cd anaconda3/lib/python3.5/site-packages
unzip setuptools-18.4-py3.5.egg
rm setuptools-18.4-py3.5.egg   # doesn’t appear to be necessary

The other little tidbit I learned through trying to debug this is that the parent python process has no trouble getting through path.py. It’s the child process, but interestingly, it appears to be the second pass through path.py of that child process. I determined that by printing “here” statements with process id to a file from within path.py. However, when the setuptools egg file is unpacked as above or if my first fix from Oct 10 (see above) is used, there doesn’t appear to be a second pass at all.

I don’t know if any of that info might help the developer, but I hope.

@ccordoba12
Copy link
Member

@twmacro, thanks for all your work to solve this problem. I'm going to use your October 10 proposed solution to patch the path.py version that comes with Anaconda (yep, I'm a Continuum employee too ;-)

There's going to be a new Anaconda release (2.4.1) in December, so this is the perfect time to fix it!

@twmacro
Copy link

twmacro commented Nov 18, 2015

@ccordoba12, fantastic! :-)

@leekahung
Copy link

Thank you everyone for your hard work! While I'm good at the moment with temporary fixes, I'm looking forward to the new patch!

@thibaudruelle
Copy link

I'm still having this issue with Anaconda 2.4.1 and Spyder 2.3.8. Looking into the path.py file, it looks like it was not updated. Was the patch made as planned ?

@jhillairet
Copy link

Hello,

I'm having the same issue with conda 3.19.3 and spyder Spyder 2.3.8. When restarting the IPython console, the error log is below. Note that restarting Spyder works (no IPython crash).

An error ocurred while starting the kernel
Vendor: Continuum Analytics, Inc.
Package: mkl
Message: trial mode expires in 29 days
Error in sitecustomize; set PYTHONVERBOSE for traceback:
TypeError: 'NoneType' object is not callable
Traceback (most recent call last):
File "/home/hash/anaconda3/lib/python3.5/site‑packages/spyderlib/widgets/externalshell/start_ipython_kernel.py", line 183, in 
from IPython.kernel.zmq.kernelapp import IPKernelApp
File "/home/hash/anaconda3/lib/python3.5/site‑packages/IPython/__init__.py", line 49, in 
from .terminal.embed import embed
File "/home/hash/anaconda3/lib/python3.5/site‑packages/IPython/terminal/embed.py", line 16, in 
from IPython.core.interactiveshell import DummyMod
File "/home/hash/anaconda3/lib/python3.5/site‑packages/IPython/core/interactiveshell.py", line 31, in 
from pickleshare import PickleShareDB
File "/home/hash/anaconda3/lib/python3.5/site‑packages/pickleshare.py", line 41, in 
from path import path as Path
File "/home/hash/anaconda3/lib/python3.5/site‑packages/path.py", line 123, in 
__version__ = pkg_resources.require('path.py')[0].version
TypeError: 'NoneType' object is not callable

@samotracio
Copy link

Hello,
Same problem here. Using Spyder 2.3.8 and Python 3.5.1 in an environment under Anaconda 2.5.0. Everything is up to date (setuptools, spyder, ipython, etc.).

Note error appears also just by opening a 2nd ipython console (Ctrl-T)

Error in sitecustomize; set PYTHONVERBOSE for traceback:
TypeError: 'NoneType' object is not callable
Traceback (most recent call last):
File "/home/uzer/anaconda/envs/p35/lib/python3.5/site-packages/spyderlib/widgets/externalshell/start_ipython_kernel.py", line 183, in
from IPython.kernel.zmq.kernelapp import IPKernelApp
File "/home/uzer/anaconda/envs/p35/lib/python3.5/site-packages/IPython/init.py", line 49, in
from .terminal.embed import embed
File "/home/uzer/anaconda/envs/p35/lib/python3.5/site-packages/IPython/terminal/embed.py", line 16, in
from IPython.core.interactiveshell import DummyMod
File "/home/uzer/anaconda/envs/p35/lib/python3.5/site-packages/IPython/core/interactiveshell.py", line 31, in
from pickleshare import PickleShareDB
File "/home/uzer/anaconda/envs/p35/lib/python3.5/site-packages/pickleshare.py", line 41, in
from path import path as Path
File "/home/uzer/anaconda/envs/p35/lib/python3.5/site-packages/path.py", line 123, in
version = pkg_resources.require('path.py')[0].version
TypeError: 'NoneType' object is not callable

@ccordoba12
Copy link
Member

@samotracio, could you run

conda update path.py

to see if that fixes the problem?

@samotracio
Copy link

@ccordoba12 : yeap, that solved the problem! Thanks!
But note I had to force the update, as I was already running path.py 8.1.2


conda update -f path.py
Using Anaconda Cloud api site https://api.anaconda.org
Fetching package metadata: ....
Solving package specifications: ...............
Package plan for installation in environment /home/uzer/anaconda/envs/p35:

The following packages will be UPDATED:
path.py: 8.1.2-py35_1 --> 8.1.2-py35_1

@ccordoba12
Copy link
Member

I see, glad it fixed it for you ;-)

@andybrnr
Copy link

andybrnr commented Apr 6, 2016

Related but slightly different error here; I encountered this when starting with a clean Ubuntu 15.04 vm and installing anaconda off the website. Firing up spyder, I get this:

Error in sitecustomize; set PYTHONVERBOSE for traceback:
AttributeError: module 'pkg_resources' has no attribute 'DistributionNotFound'
Traceback (most recent call last):
File "/home/ubuntu/anaconda3/lib/python3.5/site‑packages/path.py", line 123, in
version = pkg_resources.require('path.py')[0].version
AttributeError: module 'pkg_resources' has no attribute 'require'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/ubuntu/anaconda3/lib/python3.5/site‑packages/spyderlib/widgets/externalshell/start_ipython_kernel.py", line 183, in 
from IPython.kernel.zmq.kernelapp import IPKernelApp
File "/home/ubuntu/anaconda3/lib/python3.5/site‑packages/IPython/__init__.py", line 49, in 
from .terminal.embed import embed
File "/home/ubuntu/anaconda3/lib/python3.5/site‑packages/IPython/terminal/embed.py", line 16, in 
from IPython.core.interactiveshell import DummyMod
File "/home/ubuntu/anaconda3/lib/python3.5/site‑packages/IPython/core/interactiveshell.py", line 31, in 
from pickleshare import PickleShareDB
File "/home/ubuntu/anaconda3/lib/python3.5/site‑packages/pickleshare.py", line 41, in 
from path import path as Path
File "/home/ubuntu/anaconda3/lib/python3.5/site‑packages/path.py", line 126, in 
except pkg_resources.DistributionNotFound:
AttributeError: module 'pkg_resources' has no attribute 'DistributionNotFound'

I tried the forced update of path.py, and initially it worked, but after doing a conda update all, it broke again, and the forced update of path.py won't fix it. Any thoughts?

@andybrnr
Copy link

andybrnr commented Apr 6, 2016

A little further info: uninstalled everything, rebooted, reinstalled. Run spyder, everything works great off the bat. Shutdown spyder. reboot, launch spyder again, get error shown above. Not sure how to interpret this, other than some setting or flag doesn't persist through a reboot...

@ccordoba12
Copy link
Member

@andybrnr, please run

conda update path.py

That should fix your error :-)

@andybrnr
Copy link

andybrnr commented Apr 6, 2016

Hi ccordoba12, thanks for the response. I've tried that--already on 8.1.2 for path, and update -f to rewrite it had no effect. So I don't know if this is a variant of the old issue or something different, but no dice on the old fix. Thoughts?

@andybrnr
Copy link

andybrnr commented Apr 6, 2016

Also, seems there's the issue of multiple consoles. I've intermittently gotten it to open ok, but right-click open new console fails with the error above.

@andybrnr
Copy link

andybrnr commented Apr 6, 2016

Ok, so it seems like somehow the method "require" used to be None, but now simply doesn't exist? The fact that the error used to be "NoneType is not executable" means the attribute was null (I think?). When it then fell through to the excepts, the patch handles the NoneType. Now the except statement was causing the error, as trying to evaluate pkg_resources.DistributionNotFound threw an AttributeError (no longer exists?). I patched by putting an "except AttributeError" above the pkg_resources.DistributionNotFound like so:

try:
    import pkg_resources
    __version__ = pkg_resources.require('path.py')[0].version
except ImportError:
    __version__ = 'unknown'
#hack fix 2016-4-6
except AttributeError: 
    __version__='unknown' 
#end hack 
except pkg_resources.DistributionNotFound:
    __version__ = 'unknown'
except:
    __version__ = 'unknown'

This has fixed the issue for me.

@twmacro
Copy link

twmacro commented Apr 7, 2016

I don't understand the big picture here with what is going on in the code, but from just looking at that try-except block, I'd prefer just this:

try:
    import pkg_resources
    __version__ = pkg_resources.require('path.py')[0].version
except:
    __version__ = 'unknown'

@ccordoba12
Copy link
Member

@andybrnr, what about the (much simpler) @twmacro proposal? Does it fix the problem for you too?

@andybrnr
Copy link

andybrnr commented Apr 7, 2016

I'll try it when I'm back at my work box tomorrow. Based on how I understand the code to be failing, I'm pretty sure that will work fine. I'm curious what functionality this section was intended to achieve, but simply setting version='unknown' doesn't seem to break anything important.

@andybrnr
Copy link

andybrnr commented Apr 8, 2016

Yeah, that works fine. Would recommend this solution for a final patch.

@mp-v2
Copy link

mp-v2 commented May 22, 2017

I'm also getting a similar error when I try to start Spyder. It doesn't seem to have been caused by anything specific I did:

An error ocurred while starting the kernel
'import sitecustomize' failed; use ‑v for traceback
Traceback (most recent call last):
File "/home/mplain/anaconda2/envs/rootclone2/lib/python2.7/site‑packages/spyder/utils/ipython/start_kernel.py", line 231, in 
main()
File "/home/mplain/anaconda2/envs/rootclone2/lib/python2.7/site‑packages/spyder/utils/ipython/start_kernel.py", line 204, in main
from ipykernel.kernelapp import IPKernelApp
File "/home/mplain/anaconda2/envs/rootclone2/lib/python2.7/site‑packages/ipykernel/__init__.py", line 2, in 
from .connect import *
File "/home/mplain/anaconda2/envs/rootclone2/lib/python2.7/site‑packages/ipykernel/connect.py", line 13, in 
from IPython.core.profiledir import ProfileDir
File "/home/mplain/anaconda2/envs/rootclone2/lib/python2.7/site‑packages/IPython/__init__.py", line 48, in 
from .core.application import Application
File "/home/mplain/anaconda2/envs/rootclone2/lib/python2.7/site‑packages/IPython/core/application.py", line 25, in 
from IPython.core import release, crashhandler
File "/home/mplain/anaconda2/envs/rootclone2/lib/python2.7/site‑packages/IPython/core/crashhandler.py", line 28, in 
from IPython.core import ultratb
File "/home/mplain/anaconda2/envs/rootclone2/lib/python2.7/site‑packages/IPython/core/ultratb.py", line 119, in 
from IPython.core import debugger
File "/home/mplain/anaconda2/envs/rootclone2/lib/python2.7/site‑packages/IPython/core/debugger.py", line 37, in 
from IPython.utils import PyColorize, ulinecache
File "/home/mplain/anaconda2/envs/rootclone2/lib/python2.7/site‑packages/IPython/utils/ulinecache.py", line 11, in 
from IPython.utils import openpy
File "/home/mplain/anaconda2/envs/rootclone2/lib/python2.7/site‑packages/IPython/utils/openpy.py", line 10, in 
from io import TextIOWrapper, BytesIO
ImportError: cannot import name TextIOWrapper
'import sitecustomize' failed; use ‑v for traceback
Traceback (most recent call last):
File "/home/mplain/anaconda2/envs/rootclone2/lib/python2.7/site‑packages/spyder/utils/ipython/start_kernel.py", line 231, in 
main()
File "/home/mplain/anaconda2/envs/rootclone2/lib/python2.7/site‑packages/spyder/utils/ipython/start_kernel.py", line 204, in main
from ipykernel.kernelapp import IPKernelApp
File "/home/mplain/anaconda2/envs/rootclone2/lib/python2.7/site‑packages/ipykernel/__init__.py", line 2, in 
from .connect import *
File "/home/mplain/anaconda2/envs/rootclone2/lib/python2.7/site‑packages/ipykernel/connect.py", line 13, in 
from IPython.core.profiledir import ProfileDir
File "/home/mplain/anaconda2/envs/rootclone2/lib/python2.7/site‑packages/IPython/__init__.py", line 48, in 
from .core.application import Application
File "/home/mplain/anaconda2/envs/rootclone2/lib/python2.7/site‑packages/IPython/core/application.py", line 25, in 
from IPython.core import release, crashhandler
File "/home/mplain/anaconda2/envs/rootclone2/lib/python2.7/site‑packages/IPython/core/crashhandler.py", line 28, in 
from IPython.core import ultratb
File "/home/mplain/anaconda2/envs/rootclone2/lib/python2.7/site‑packages/IPython/core/ultratb.py", line 119, in 
from IPython.core import debugger
File "/home/mplain/anaconda2/envs/rootclone2/lib/python2.7/site‑packages/IPython/core/debugger.py", line 37, in 
from IPython.utils import PyColorize, ulinecache
File "/home/mplain/anaconda2/envs/rootclone2/lib/python2.7/site‑packages/IPython/utils/ulinecache.py", line 11, in 
from IPython.utils import openpy
File "/home/mplain/anaconda2/envs/rootclone2/lib/python2.7/site‑packages/IPython/utils/openpy.py", line 10, in 
from io import TextIOWrapper, BytesIO
ImportError: cannot import name TextIOWrapper
'import sitecustomize' failed; use ‑v for traceback
Traceback (most recent call last):
File "/home/mplain/anaconda2/envs/rootclone2/lib/python2.7/site‑packages/spyder/utils/ipython/start_kernel.py", line 231, in 
main()
File "/home/mplain/anaconda2/envs/rootclone2/lib/python2.7/site‑packages/spyder/utils/ipython/start_kernel.py", line 204, in main
from ipykernel.kernelapp import IPKernelApp
File "/home/mplain/anaconda2/envs/rootclone2/lib/python2.7/site‑packages/ipykernel/__init__.py", line 2, in 
from .connect import *
File "/home/mplain/anaconda2/envs/rootclone2/lib/python2.7/site‑packages/ipykernel/connect.py", line 13, in 
from IPython.core.profiledir import ProfileDir
File "/home/mplain/anaconda2/envs/rootclone2/lib/python2.7/site‑packages/IPython/__init__.py", line 48, in 
from .core.application import Application
File "/home/mplain/anaconda2/envs/rootclone2/lib/python2.7/site‑packages/IPython/core/application.py", line 25, in 
from IPython.core import release, crashhandler
File "/home/mplain/anaconda2/envs/rootclone2/lib/python2.7/site‑packages/IPython/core/crashhandler.py", line 28, in 
from IPython.core import ultratb
File "/home/mplain/anaconda2/envs/rootclone2/lib/python2.7/site‑packages/IPython/core/ultratb.py", line 119, in 
from IPython.core import debugger
File "/home/mplain/anaconda2/envs/rootclone2/lib/python2.7/site‑packages/IPython/core/debugger.py", line 37, in 
from IPython.utils import PyColorize, ulinecache
File "/home/mplain/anaconda2/envs/rootclone2/lib/python2.7/site‑packages/IPython/utils/ulinecache.py", line 11, in 
from IPython.utils import openpy
File "/home/mplain/anaconda2/envs/rootclone2/lib/python2.7/site‑packages/IPython/utils/openpy.py", line 10, in 
from io import TextIOWrapper, BytesIO
ImportError: cannot import name TextIOWrapper
'import sitecustomize' failed; use ‑v for traceback
Traceback (most recent call last):
File "/home/mplain/anaconda2/envs/rootclone2/lib/python2.7/site‑packages/spyder/utils/ipython/start_kernel.py", line 231, in 
main()
File "/home/mplain/anaconda2/envs/rootclone2/lib/python2.7/site‑packages/spyder/utils/ipython/start_kernel.py", line 204, in main
from ipykernel.kernelapp import IPKernelApp
File "/home/mplain/anaconda2/envs/rootclone2/lib/python2.7/site‑packages/ipykernel/__init__.py", line 2, in 
from .connect import *
File "/home/mplain/anaconda2/envs/rootclone2/lib/python2.7/site‑packages/ipykernel/connect.py", line 13, in 
from IPython.core.profiledir import ProfileDir
File "/home/mplain/anaconda2/envs/rootclone2/lib/python2.7/site‑packages/IPython/__init__.py", line 48, in 
from .core.application import Application
File "/home/mplain/anaconda2/envs/rootclone2/lib/python2.7/site‑packages/IPython/core/application.py", line 25, in 
from IPython.core import release, crashhandler
File "/home/mplain/anaconda2/envs/rootclone2/lib/python2.7/site‑packages/IPython/core/crashhandler.py", line 28, in 
from IPython.core import ultratb
File "/home/mplain/anaconda2/envs/rootclone2/lib/python2.7/site‑packages/IPython/core/ultratb.py", line 119, in 
from IPython.core import debugger
File "/home/mplain/anaconda2/envs/rootclone2/lib/python2.7/site‑packages/IPython/core/debugger.py", line 37, in 
from IPython.utils import PyColorize, ulinecache
File "/home/mplain/anaconda2/envs/rootclone2/lib/python2.7/site‑packages/IPython/utils/ulinecache.py", line 11, in 
from IPython.utils import openpy
File "/home/mplain/anaconda2/envs/rootclone2/lib/python2.7/site‑packages/IPython/utils/openpy.py", line 10, in 
from io import TextIOWrapper, BytesIO
ImportError: cannot import name TextIOWrapper
'import sitecustomize' failed; use ‑v for traceback
Traceback (most recent call last):
File "/home/mplain/anaconda2/envs/rootclone2/lib/python2.7/site‑packages/spyder/utils/ipython/start_kernel.py", line 231, in 
main()
File "/home/mplain/anaconda2/envs/rootclone2/lib/python2.7/site‑packages/spyder/utils/ipython/start_kernel.py", line 204, in main
from ipykernel.kernelapp import IPKernelApp
File "/home/mplain/anaconda2/envs/rootclone2/lib/python2.7/site‑packages/ipykernel/__init__.py", line 2, in 
from .connect import *
File "/home/mplain/anaconda2/envs/rootclone2/lib/python2.7/site‑packages/ipykernel/connect.py", line 13, in 
from IPython.core.profiledir import ProfileDir
File "/home/mplain/anaconda2/envs/rootclone2/lib/python2.7/site‑packages/IPython/__init__.py", line 48, in 
from .core.application import Application
File "/home/mplain/anaconda2/envs/rootclone2/lib/python2.7/site‑packages/IPython/core/application.py", line 25, in 
from IPython.core import release, crashhandler
File "/home/mplain/anaconda2/envs/rootclone2/lib/python2.7/site‑packages/IPython/core/crashhandler.py", line 28, in 
from IPython.core import ultratb
File "/home/mplain/anaconda2/envs/rootclone2/lib/python2.7/site‑packages/IPython/core/ultratb.py", line 119, in 
from IPython.core import debugger
File "/home/mplain/anaconda2/envs/rootclone2/lib/python2.7/site‑packages/IPython/core/debugger.py", line 37, in 
from IPython.utils import PyColorize, ulinecache
File "/home/mplain/anaconda2/envs/rootclone2/lib/python2.7/site‑packages/IPython/utils/ulinecache.py", line 11, in 
from IPython.utils import openpy
File "/home/mplain/anaconda2/envs/rootclone2/lib/python2.7/site‑packages/IPython/utils/openpy.py", line 10, in 
from io import TextIOWrapper, BytesIO
ImportError: cannot import name TextIOWrapper

I've already tried updating conda, spyder and path.py and I'm still getting the issue. Any ideas?

@ccordoba12
Copy link
Member

Please post the result of

conda list

here to see if everything is in order.

@mp-v2
Copy link

mp-v2 commented May 22, 2017

Hey, my final hope (which you suggested in some google groups forum) was to reset Spyder (spyder --reset) which fixed it. Had to reset my preferences etc but it works now, sorry I have no idea what the issue was!

@ccordoba12
Copy link
Member

Glad spyder --reset worked for you!

@cugels
Copy link

cugels commented Dec 23, 2017

I had the same problem. However, in my case, it was because I had a file with the same name as a core module, and python was trying to load the wrong file from my root. Changed the name, and it was back to normal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests