ImportError: cannot import name start_ipython - python

I have extracted ipython-1.1.0.tar.gz in /usr/lib/ipython-1.1.0 and have run the following commands to finish the build and installation:
root#my-laptop:/usr/lib/ipython-1.1.0# python setup.py build
root#my-laptop:/usr/lib/ipython-1.1.0# python setup.py install
I am using Python 2.6 and is installed under /usr/bin/python2.6 and have my additional packages under /usr/lib/python2.6/site-packages/
Now, when I am trying to start ipython notebook from shell command, I am getting the following ImportError message:
root#my-laptop:/usr/lib/ipython-1.1.0# ipython notebook
Traceback (most recent call last):
File "/usr/local/bin/ipython", line 5, in <module>
from IPython import start_ipython
ImportError: cannot import name start_ipython
When I tried to start the IPython instance as mentioned in README.rst file, I got the following message:
root#my-laptop:/usr/lib/ipython-1.1.0# python -m IPython
/usr/bin/python: IPython is a package and cannot be directly executed
I tried easy_install and pip install
root#my-laptop:/usr/lib/ipython-1.1.0# easy_install ipython
Searching for ipython
Best match: ipython 1.1.0
Adding ipython 1.1.0 to easy-install.pth file
Using /usr/local/lib/python2.6/dist-packages
Processing dependencies for ipython
root#my-laptop:/usr/lib/ipython-1.1.0# pip install ipython
Requirement already satisfied: ipython in /usr/lib/pymodules/python2.6
Installing collected packages: ipython
Successfully installed ipython
But the ImportError problem still remains unresolved. This is not allowing to open the interactive Python.
I found some solution in the below link, but not sure about it:
https://trac.macports.org/ticket/40119

I just ran into this problem as well. Are we sure the IPython API didn't change? I got something that looks right working with:
import IPython
IPython.Shell.start()
edit:
ok, nvmind. There was also another program I installed at the same time that decided to change PYTHONPATH.

This worked for me:
import IPython
IPython.start_ipython()

Related

import matplotlib error on mac

Um... I wanted to import matplotlib in Python IDLE, but it said
>>> import matplotlib
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
import matplotlib
ModuleNotFoundError: No module named 'matplotlib'
I've already tried pip thing and the conda thing in terminal.
It said
# All requested packages already installed.
# packages in environment at /Users/Dan/anaconda:
Then! what's the problem here?
You may have installed Matplotlib to Python 2.7 and not Python 3.6. To install it to Python3 you need to use pip3:
pip3 install matplotlib
Then open python3.6 from your terminal (not idle) and try importing matplotlib from there. This way you can use any text editor you wish, and run your code from the terminal.
I had the same issue using the same command in IDLE. I just figured it out. go to your terminal and enter:
pip3.6 install matplotlib
I was using pip3 instead of pip3.6

ImportError: No module named IPython.paths when running jupyter notebook?

I installed jupyter via: /usr/local/opt/python/bin/python2.7 -m pip install jupyter
this install ipython version 4.1.2. However, when I run jupyter notebook, I get:
Traceback (most recent call last):
File "/usr/local/bin/jupyter-notebook", line 7, in <module>
from notebook.notebookapp import main
File "/Library/Python/2.7/site-packages/notebook/notebookapp.py", line 83, in <module>
from IPython.paths import get_ipython_dir
ImportError: No module named IPython.paths
yet, when I run from IPython.paths import get_ipython_dir in the ipython shell directly it works fine. Also when I run /usr/local/opt/python/bin/python2.7 and then the same thing, it runs successfully. Additionally, when I check the sys.executable path in python I get /usr/local/opt/python/bin/python2.7
This doesn't make sense to me. How can Ipython and my normal python (both using /usr/local/opt/python/bin/python2.7) both run this successfully, but my jupyter, installed with that specific python, cannot run the command. Any suggestions?
I had the same problem. Just now this helped me. Someone might find this useful.
from IPython.paths import get_ipython_dir
ImportError: No module named IPython.paths
So I was running Python 3 on Linux mint 17. I first uninstalled jupyter from my system using the command.
sudo -H pip3 uninstall jupyter
After successfully uninstalling I installed jupyter again with the following command.
sudo -H pip3 install jupyter
And when I launched jupyter again using
jupyter notebook
The kernel didn't die or didn't restart. Everything works fine now. I hope atleast one person finds this useful.
Upgrade ipython:
pip install ipython==5.3.0
If you cannot uninstall ipython, try this:
sudo -H pip install --ignore-installed -U ipython==5.3.0

Can't start Ipython: no module named ipython

I'm trying to install iPython on a Mac and am running into several problems. I believe the build script may be saving ipython to the wrong location but am unsure how to resolve this properly.
Initially I tried installing using pip, which gave the following error:
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/bg/68k19b6d6hbgwfcgvgy0dtvr0000gn/T/pip-build-qXqxr3/simplegeneric
So I tried building from the tarball instead. This succeeded without any errors but when I tried to start ipython I got the error
File "/usr/local/bin/ipython", line 4, in <module>
from IPython import start_ipython
ImportError: No module named IPython
The contents of /usr/local/bin/ipython are as follows:
#!/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
# This script was automatically generated by setup.py
if __name__ == '__main__':
from IPython import start_ipython
start_ipython()
I tried updating pip, reinstalling python via homebrew, and consistently run into the same problem. I was able to successfully install numpy, scipy, and matplotlib, all of which appear in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages while ipython does not.
Anyone know how to resolve this?

IPython notebook install error

I'm trying to install IPython notebook on OS X 10.10.2.
After all dependencies have been added, this error occurs:
File "/Library/Python/2.7/site-packages/jinja2/tests.py", line 14, in <module>
from jinja2._compat import text_type, string_types, integer_types
ImportError: cannot import name integer_types
How can I fix this?
How are you installing ipython?
If you have pip, are you using pip install ipython[all]?
I also recommend using virtualenv to start with a completely clean python2.7 install from scratch and see if you encounter the errors still. There may be some version compatibility conflicts on the system.
Alternative is you can install the Anaconda distribution which comes prepackaged with ipython and dependencies http://continuum.io/downloads

I can't launch ipython-listener

I'm trying to get up and running with an ipython plugin for gedit3, but it requires ipython-listener, and when I try to launch it I get this:
Traceback (most recent call last):
File "/usr/local/bin/ipython-listener", line 27, in <module>
from IPython.frontend.terminal.embed import InteractiveShellEmbed
ImportError: No module named terminal.embed
I'm running ipython version 0.10.2 and python version 2.7.2+
I tried to do pip install terminal.embed but couldn't find it:
Downloading/unpacking terminal.embed
Could not find any downloads that satisfy the requirement terminal.embed
No distributions at all found for terminal.embed
Storing complete log in /home/amanda/.pip/pip.log
So now what?
I tried to do pip install terminal.embed but couldn't find it
It's not a package, it's part of IPython. Your IPython is just too old (by a couple of years).
That plugin depends on IPython ≥ 0.11 (current is 0.13.1). Try:
pip install --upgrade ipython

Categories

Resources