ipython2 does not work anymore

Steve D'Aprano steve+python at pearwood.info
Thu Jan 19 19:01:09 EST 2017


On Fri, 20 Jan 2017 02:06 am, Cecil Westerhof wrote:

> I did not work with ipython2 for a long time. Most of my work is done
> with python3. I just tried to start ipython2 and got:
> Traceback (most recent call last):
[...]
> ImportError: No module named path
> 
> 
> What could be the problem here?

Something has changed between the last time you ran IPython and now. You
have deleted something, changed something, installed something... or you
have file system corruption and files are disappearing... or your 
PYTHONPATH environment variable is not set, or is set differently to the way
it used to be...

Do you want to investigate why the error occurred, or just fix it in the
most convenient and easy way?

If the second, then you can probably fix it by running:

python2 -m pip install path

assuming that you trust that path is a legitimate module.

Looking at the traceback, I see the final call which fails is in a module
called pickleshare.py:

  File "/usr/lib/python2.7/site-packages/pickleshare.py", line 40, in <module>
    from path import path as Path


You could try removing pickleshare and re-installing, or upgrading to the
latest version, and see whether it brings in the "path" dependency.

You could try running "locate path.py | grep python2.7" in the shell and see
whether path is installed. If it is installed, it sounds like the PYTHONPATH
is messed up. Run these and tell us what they say:

locate path.py | grep python2.7
python2.7 -c "import sys; print sys.path"
echo $PYTHONPATH



Googling for your error gives me these two relevant looking hits:

https://duckduckgo.com/html/?q=%22ImportError:%20No%20module%20named%20path%22+ipython

https://github.com/jupyter/notebook/issues/270

https://github.com/jupyter/notebook/issues/525



-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, 
and sure enough, things got worse.



More information about the Python-list mailing list