IVlad IVlad - 3 months ago 24
Python Question

IPython won't start with locally installed Python 3.5

I am on a linux system that only has Python 2.7 installed globally. I have installed Anaconda with Python 3.5 in my home folder. I also installed the latest version of IPython using

conda install ipython
. When running
ipython
at the console, I get:

Traceback (most recent call last):
File "/home/mateinfo/vlad/anaconda3/bin/ipython", line 4, in <module>
import IPython
File "/home/mateinfo/vlad/anaconda3/lib/python3.5/site-packages/IPython/__init__.py", line 49, in <module>
from .terminal.embed import embed
File "/home/mateinfo/vlad/anaconda3/lib/python3.5/site-packages/IPython/terminal/embed.py", line 16, in <module>
from IPython.core.interactiveshell import DummyMod, InteractiveShell
File "/home/mateinfo/vlad/anaconda3/lib/python3.5/site-packages/IPython/core/interactiveshell.py", line 31, in <module>
from pickleshare import PickleShareDB
File "/home/mateinfo/vlad/anaconda3/lib/python3.5/site-packages/pickleshare.py", line 41, in <module>
from path import path as Path
File "/opt/pcm/lib/python/path.py", line 919
def mkdir(self, mode=0777):


As far as I can tell, the problem is with the used
path
module, which seems to be from Python 2.7, since it uses the old octal format
0777
.

How can I get IPython working under this setup?

I have this in my
.bashrc
:

# added by Anaconda3 4.0.0 installer
export PATH="/home/mateinfo/vlad/anaconda3/bin:$PATH"
export PATH="/home/mateinfo/vlad/anaconda3/lib:$PATH"
export PATH="/home/mateinfo/vlad/anaconda3/lib/python3.5:$PATH"


Only the first line was added by the Anaconda installer, the other 2 were added by me, with no success.

Answer

You might have the PYTHONPATH environment variable set to a location where a python2 library resides.

As general recommendation, never use this variable. Create proper setup.py scripts for your libraries.

To get rid of it, you can do unset PYTHONPATH or eliminate anything that sets this variable in your .bashrc.

Comments