I am using virtualenvwrapper so anybody can reproduce it easily, but this happens as well using pip directly on my system.
After installing iPython with pip, I wont be able to run it (note I'm using the Python 2 interpreter, although the same exact thing will happen if I use Python 3):
$ mkvirtualenv -p python2 test
$ pip install --upgrade pip # Just in case...
$ pip install ipython
$ ipython
Traceback (most recent call last):
File "/home/peque/.virtualenvs/test/bin/ipython", line 7, in
from IPython import start_ipython
File "/home/peque/.virtualenvs/test/lib/python2.7/site-packages/IPython/__init__.py", line 48, in
from .terminal.embed import embed
File "/home/peque/.virtualenvs/test/lib/python2.7/site-packages/IPython/terminal/embed.py", line 16, in
from IPython.core.interactiveshell import DummyMod
File "/home/peque/.virtualenvs/test/lib/python2.7/site-packages/IPython/core/interactiveshell.py", line 31, in
from pickleshare import PickleShareDB
File "/home/peque/.virtualenvs/test/lib/python2.7/site-packages/pickleshare.py", line 41, in
from path import path as Path
ImportError: cannot import name path
Now, the packages I have installed after this simple steps are:
$ pip freeze
decorator==4.0.2
ipython==4.0.0
ipython-genutils==0.1.0
path.py==8.0
pexpect==3.3
pickleshare==0.5
simplegeneric==0.8.1
traitlets==4.0.0
Why am I getting this error? Is there any way to avoid it while still using iPython version 4?
解决方案
Quick fix
Just downgrade package:
pip install -I path.py==7.7.1
Explanation
There is a commit (62ccb76) made a couple of hours ago that removes the path alias and bumps path.py version to 0.8. Apparently, in order to fix Issue #102:
Removed path.path. Clients must now refer to the canonical name, path.Path as introduced in 6.2.
However, pickleshare has not been updated and continues to use the old alias.
The problem has already been reported, and hope it will be fixed soon. I created a pull request in case it helps.
Update
The pull request has already been merged and version 8.1 of path.py adds the path alias again (a warning will be generated instead for now). So users should not hit this problem now.
Updating the package to version 8.1 should fix the problem as well now:
pip install -I path.py==8.1