Repository: ipython/ipython

Issue:
For backwards compatibility shouldn't ipywidgets be a dependency of the ipython notebook?
I filed this bug with anaconda:

https://github.com/ContinuumIO/anaconda-issues/issues/470#issuecomment-147775813

Right now, `conda install ipython-notebook` provides a broken install for a widget backwards compatible IPython 4. You must seperately install `ipywidgets` for things to work fully in a IPython 3 backward compatible way.

My suggestion to Continuum was to include `ipywidgets` as a hard dependency of `ipython-notebook` 4. They said this was an upstream issue. It may also affect `pip install ipython[notebook]` but I haven't checked.



Discussion:
This also fails with `pip install ipython[notebook]`:

```
moorepants@caramelmonkey:eme150a-website(master)$ conda create -n beegee python=2
Fetching package metadata: ......
Solving package specifications: ................
Package plan for installation in environment /home/moorepants/miniconda/envs/beegee:

The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    setuptools-18.4            |           py27_0         342 KB

The following NEW packages will be INSTALLED:

    openssl:    1.0.1k-1     
    pip:        7.1.2-py27_0 
    python:     2.7.10-1     
    readline:   6.2-2        
    setuptools: 18.4-py27_0  
    sqlite:     3.8.4.1-1    
    tk:         8.5.18-0     
    wheel:      0.26.0-py27_1
    zlib:       1.2.8-0      

Fetching packages ...
setuptools-18. 100% |#########################################################################################################################################| Time: 0:00:00 886.44 kB/s
Extracting packages ...
[      COMPLETE      ]|############################################################################################################################################################| 100%
Linking packages ...
[      COMPLETE      ]|############################################################################################################################################################| 100%
#
# To activate this environment, use:
# $ source activate beegee
#
# To deactivate this environment, use:
# $ source deactivate
#
moorepants@caramelmonkey:eme150a-website(master)$ act beegee
discarding /home/moorepants/miniconda/bin from PATH
prepending /home/moorepants/miniconda/envs/beegee/bin to PATH
(beegee)moorepants@caramelmonkey:eme150a-website(master)$ pip install ipython[notebook]
Collecting ipython[notebook]
  Downloading ipython-4.0.0-py2-none-any.whl (730kB)
    100% |████████████████████████████████| 733kB 465kB/s 
Collecting decorator (from ipython[notebook])
  Downloading decorator-4.0.4-py2.py3-none-any.whl
Collecting simplegeneric>0.8 (from ipython[notebook])
  Downloading simplegeneric-0.8.1.zip
Collecting pexpect (from ipython[notebook])
  Downloading pexpect-4.0.1.tar.gz (143kB)
    100% |████████████████████████████████| 147kB 1.5MB/s 
Collecting traitlets (from ipython[notebook])
  Downloading traitlets-4.0.0-py2.py3-none-any.whl (56kB)
    100% |████████████████████████████████| 57kB 3.4MB/s 
Collecting pickleshare (from ipython[notebook])
  Downloading pickleshare-0.5.tar.gz
Collecting notebook (from ipython[notebook])
  Downloading notebook-4.0.6-py2.py3-none-any.whl (5.6MB)
    100% |████████████████████████████████| 5.6MB 49kB/s 
Collecting ptyprocess>=0.5 (from pexpect->ipython[notebook])
  Downloading ptyprocess-0.5.tar.gz
Collecting ipython-genutils (from traitlets->ipython[notebook])
  Downloading ipython_genutils-0.1.0-py2.py3-none-any.whl
Collecting path.py (from pickleshare->ipython[notebook])
  Downloading path.py-8.1.2-py2.py3-none-any.whl
Collecting tornado>=4 (from notebook->ipython[notebook])
  Downloading tornado-4.2.1.tar.gz (434kB)
    100% |████████████████████████████████| 438kB 653kB/s 
Collecting jupyter-client (from notebook->ipython[notebook])
  Downloading jupyter_client-4.1.1-py2.py3-none-any.whl (70kB)
    100% |████████████████████████████████| 73kB 1.7MB/s 
Collecting nbformat (from notebook->ipython[notebook])
  Downloading nbformat-4.0.1-py2.py3-none-any.whl (138kB)
    100% |████████████████████████████████| 139kB 1.3MB/s 
Collecting jupyter-core (from notebook->ipython[notebook])
  Downloading jupyter_core-4.0.6-py2.py3-none-any.whl (74kB)
    100% |████████████████████████████████| 77kB 1.3MB/s 
Collecting jinja2 (from notebook->ipython[notebook])
  Downloading Jinja2-2.8-py2.py3-none-any.whl (263kB)
    100% |████████████████████████████████| 266kB 923kB/s 
Collecting ipykernel (from notebook->ipython[notebook])
  Downloading ipykernel-4.1.0-py2.py3-none-any.whl (90kB)
    100% |████████████████████████████████| 94kB 1.2MB/s 
Collecting terminado>=0.3.3 (from notebook->ipython[notebook])
  Downloading terminado-0.5.tar.gz
Collecting nbconvert (from notebook->ipython[notebook])
  Downloading nbconvert-4.0.0-py2.py3-none-any.whl (278kB)
    100% |████████████████████████████████| 278kB 738kB/s 
Collecting backports.ssl-match-hostname (from tornado>=4->notebook->ipython[notebook])
  Downloading backports.ssl_match_hostname-3.4.0.2.tar.gz
Collecting certifi (from tornado>=4->notebook->ipython[notebook])
  Downloading certifi-2015.9.6.2-py2.py3-none-any.whl (371kB)
    100% |████████████████████████████████| 372kB 755kB/s 
Collecting pyzmq>=13 (from jupyter-client->notebook->ipython[notebook])
  Downloading pyzmq-14.7.0.tar.gz (1.0MB)
    100% |████████████████████████████████| 1.0MB 320kB/s 
Collecting jsonschema!=2.5.0,>=2.0 (from nbformat->notebook->ipython[notebook])
  Downloading jsonschema-2.5.1-py2.py3-none-any.whl
Collecting MarkupSafe (from jinja2->notebook->ipython[notebook])
  Downloading MarkupSafe-0.23.tar.gz
Collecting pygments (from nbconvert->notebook->ipython[notebook])
  Downloading Pygments-2.0.2-py2-none-any.whl (672kB)
    100% |████████████████████████████████| 675kB 507kB/s 
Collecting mistune!=0.6 (from nbconvert->notebook->ipython[notebook])
  Downloading mistune-0.7.1-py2.py3-none-any.whl
Collecting functools32 (from jsonschema!=2.5.0,>=2.0->nbformat->notebook->ipython[notebook])
  Downloading functools32-3.2.3-2.tar.gz
Building wheels for collected packages: simplegeneric, pexpect, pickleshare, ptyprocess, tornado, terminado, backports.ssl-match-hostname, pyzmq, MarkupSafe, functools32
  Running setup.py bdist_wheel for simplegeneric
  Stored in directory: /home/moorepants/.cache/pip/wheels/51/3c/13/2b621669f3ba74b01380aefcc0af0f643bb42360e7248496ed
  Running setup.py bdist_wheel for pexpect
  Stored in directory: /home/moorepants/.cache/pip/wheels/ea/5b/53/4b65a279e1390ae81febe74f660ce01ef4655c9c1ec9acd9bf
  Running setup.py bdist_wheel for pickleshare
  Stored in directory: /home/moorepants/.cache/pip/wheels/99/3e/8b/7d87bf47f2c2d437fcb9a913cd5c4b393b7132c508633e3eef
  Running setup.py bdist_wheel for ptyprocess
  Stored in directory: /home/moorepants/.cache/pip/wheels/8f/0b/d5/45ebc79539db587c173a63b42572328136bdb098210767fb80
  Running setup.py bdist_wheel for tornado
  Stored in directory: /home/moorepants/.cache/pip/wheels/e4/0e/f8/2c7f5423e2dcad6a71c6f04e859f35cb3cf962da96f22a74c3
  Running setup.py bdist_wheel for terminado
  Stored in directory: /home/moorepants/.cache/pip/wheels/f9/7c/62/fe686f920ed9fbc013e631a5415ec3162602b31e762595e3fe
  Running setup.py bdist_wheel for backports.ssl-match-hostname
  Stored in directory: /home/moorepants/.cache/pip/wheels/81/3d/36/f3c726a42caed585046d710e0e450bda1075c61c1c43443831
  Running setup.py bdist_wheel for pyzmq
  Stored in directory: /home/moorepants/.cache/pip/wheels/fe/81/30/cf2b9253557efdb74f23268eaa2b441d4b7793c9ddd7ac8488
  Running setup.py bdist_wheel for MarkupSafe
  Stored in directory: /home/moorepants/.cache/pip/wheels/94/a7/79/f79a998b64c1281cb99fa9bbd33cfc9b8b5775f438218d17a7
  Running setup.py bdist_wheel for functools32
  Stored in directory: /home/moorepants/.cache/pip/wheels/38/c6/c7/ee17acd621120c302e25c2fa8b3a8b235d5d1137c6ab4c9728
Successfully built simplegeneric pexpect pickleshare ptyprocess tornado terminado backports.ssl-match-hostname pyzmq MarkupSafe functools32
Installing collected packages: decorator, simplegeneric, ptyprocess, pexpect, ipython-genutils, traitlets, path.py, pickleshare, backports.ssl-match-hostname, certifi, tornado, jupyter-core, pyzmq, jupyter-client, functools32, jsonschema, nbformat, MarkupSafe, jinja2, ipykernel, terminado, pygments, mistune, nbconvert, notebook, ipython
Successfully installed MarkupSafe-0.23 backports.ssl-match-hostname-3.4.0.2 certifi-2015.9.6.2 decorator-4.0.4 functools32-3.2.3.post2 ipykernel-4.1.0 ipython-4.0.0 ipython-genutils-0.1.0 jinja2-2.8 jsonschema-2.5.1 jupyter-client-4.1.1 jupyter-core-4.0.6 mistune-0.7.1 nbconvert-4.0.0 nbformat-4.0.1 notebook-4.0.6 path.py-8.1.2 pexpect-4.0.1 pickleshare-0.5 ptyprocess-0.5 pygments-2.0.2 pyzmq-14.7.0 simplegeneric-0.8.1 terminado-0.5 tornado-4.2.1 traitlets-4.0.0
(beegee)moorepants@caramelmonkey:eme150a-website(master)$ ipython
Python 2.7.10 |Continuum Analytics, Inc.| (default, Sep 15 2015, 14:50:01) 
Type "copyright", "credits" or "license" for more information.

IPython 4.0.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: from IPython.html import widgets
/home/moorepants/miniconda/envs/beegee/lib/python2.7/site-packages/IPython/html.py:14: ShimWarning: The `IPython.html` package has been deprecated. You should import from `notebook` instead. `IPython.html.widgets` has moved to `ipywidgets`.
  "`IPython.html.widgets` has moved to `ipywidgets`.", ShimWarning)

In [2]: dir(widgets)
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-2-15203d59e637> in <module>()
----> 1 dir(widgets)

/home/moorepants/miniconda/envs/beegee/lib/python2.7/site-packages/IPython/utils/shimmodule.pyc in __dir__(self)
     73 
     74     def __dir__(self):
---> 75         return dir(__import__(self._mirror))
     76 
     77     @property

ImportError: No module named ipywidgets

In [3]: 
```


Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -187,7 +187,7 @@ def run(self):
     terminal = [],
     kernel = ['ipykernel'],
     nbformat = ['nbformat'],
-    notebook = ['notebook'],
+    notebook = ['notebook', 'ipywidgets'],
     nbconvert = ['nbconvert'],
 )
 install_requires = [


Test patch: