Question

I have an account in a CentOS server without sudo permission. As a result, I tried to install IPython from source code by python setup.py prefix=<my home directory>.

However, I got the Error:

Traceback (most recent call last):
  File "/usr/bin/ipython", line 19, in <module>
    from IPython.frontend.terminal.ipapp import launch_new_instance
ImportError: No module named IPython.frontend.terminal.ipapp

I found a question same to mine: IPython import failure and python sys.path in general.

I followed the asker's instruction to add the directory of my IPython to the IPython execution file.

#!/usr/bin/python
"""Terminal-based IPython entry point.
"""
import sys
sys.path.append("./Ipython directory")

from IPython.frontend.terminal.ipapp import launch_new_instance

launch_new_instance()

However, I got the same error as well. So I want to know how can I launch IPython correctly? Thanks.

Was it helpful?

Solution

You probably want to install with the --user flag, which should put it on sys.path automatically.

python setup.py install --user

If you need to use --prefix for some other reason, then make sure that the directory you add to sys.path is the folder containing the IPython package, not the IPython directory. It will probably end with 'site-packages'.

OTHER TIPS

I copied the IPython source folder into ~/bin/. The execution file of IPython can recognize the module in IPython and the IPython shell launches successfully.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top