Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error starting iPython on Mac OSX: No module named jinja2

iPython was installed on a Mac OS X Mountain Lion using pip. When running ipython notebook in the Terminal, I get the error

...
File "/Users/god/.virtualenvs/datasci/lib/python2.7/site-packages/IPython/html/notebookapp.py", line 38, in <module>
from jinja2 import Environment, FileSystemLoader
ImportError: No module named jinja2

Question: What is the problem here, and how should we resolve it?

like image 723
Nyxynyx Avatar asked Oct 22 '25 04:10

Nyxynyx


1 Answers

Jinja 2 is listed as an optional dependency, see the iPython quickstart.

You must install optional dependencies separately:

pip install Jinja2

You can install such dependencies as optional functionality groups for ipython. Using these let you install the dependencies needed for that functionality; each of these groups can be installed with pip install ipython[groupname]:

  • notebook: for the webbased notebook
  • qtconsole: for the Qt console
  • parallel or zmq: for the ZMQ messaging support (separate sharable kernel)
  • doc: tools required to generate the documentation
  • test: dependencies to run the test suite
  • nbformat: dependencies for producing the notebook interchange format
  • nbconvert: dependencies for the nbconvert tool to convert the notebook format to other formats.

So to install all dependencies for ipython notebook use:

pip install ipython[notebook]

and ipython is installed plus the dependencies, or if you already have ipython installed it'll add on the missing packages.

Alternatively, install all optional dependencies with:

pip install ipython[all]
like image 59
Martijn Pieters Avatar answered Oct 23 '25 19:10

Martijn Pieters



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!