Repository: bokeh/bokeh

Issue:
bokeh-0.12.1-py27_0 conda package from defaults missing server/views/app_index.html
## What's Broke:

Try to 'bokeh serve' multiple examples and the server will hit an exception due to missing app_index.html in the conda package
## Repro

```
conda create -n broken --override-channels -c defaults bokeh=0.12.1-0 python=2.7
source activate broken
git clone https://github.com/bokeh/bokeh.git
cd $BOKEH_CLONE_ROOT/examples/app
bokeh serve fourier_animated.py selection_histogram.py 
```
## Stack trace

```
HTTPServerRequest(protocol='http', host='localhost:5006', method='GET', uri='/', version='HTTP/1.1', remote_ip='::1', headers={'Accept-Language': 'en-US,en;q=0.8', 'Accept-Encoding': 'gzip, deflate, sdch', 'Host': 'localhost:5006', 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8', 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.106 Safari/537.36', 'Connection': 'keep-alive', 'Upgrade-Insecure-Requests': '1'})
Traceback (most recent call last):
  File "/home/tsnyder/miniconda/envs/bokeh_sep01/lib/python2.7/site-packages/tornado/web.py", line 1469, in _execute
    result = yield result
  File "/home/tsnyder/miniconda/envs/bokeh_sep01/lib/python2.7/site-packages/tornado/gen.py", line 1015, in run
    value = future.result()
  File "/home/tsnyder/miniconda/envs/bokeh_sep01/lib/python2.7/site-packages/tornado/concurrent.py", line 237, in result
    raise_exc_info(self._exc_info)
  File "/home/tsnyder/miniconda/envs/bokeh_sep01/lib/python2.7/site-packages/tornado/gen.py", line 270, in wrapper
    result = func(*args, **kwargs)
  File "/home/tsnyder/miniconda/envs/bokeh_sep01/lib/python2.7/site-packages/bokeh/server/views/root_handler.py", line 32, in get
    self.render("app_index.html", items=self.applications.keys())
  File "/home/tsnyder/miniconda/envs/bokeh_sep01/lib/python2.7/site-packages/tornado/web.py", line 719, in render
    html = self.render_string(template_name, **kwargs)
  File "/home/tsnyder/miniconda/envs/bokeh_sep01/lib/python2.7/site-packages/tornado/web.py", line 823, in render_string
    t = loader.load(template_name)
  File "/home/tsnyder/miniconda/envs/bokeh_sep01/lib/python2.7/site-packages/tornado/template.py", line 427, in load
    self.templates[name] = self._create_template(name)
  File "/home/tsnyder/miniconda/envs/bokeh_sep01/lib/python2.7/site-packages/tornado/template.py", line 454, in _create_template
    with open(path, "rb") as f:
IOError: [Errno 2] No such file or directory: '/home/tsnyder/miniconda/envs/bokeh_sep01/lib/python2.7/site-packages/bokeh/server/views/app_index.html'
```
- Software version information output by `bokeh info` command

```
Python version      :  2.7.12 |Continuum Analytics, Inc.| (default, Jul  2 2016, 17:42:40) 
IPython version     :  Not installed
Bokeh version       :  0.12.1
BokehJS static path :  /home/tsnyder/miniconda/envs/bokeh_sep01/lib/python2.7/site-packages/bokeh/server/static
```

bokeh-0.12.1-py27_0 conda package from defaults missing server/views/app_index.html
## What's Broke:

Try to 'bokeh serve' multiple examples and the server will hit an exception due to missing app_index.html in the conda package
## Repro

```
conda create -n broken --override-channels -c defaults bokeh=0.12.1-0 python=2.7
source activate broken
git clone https://github.com/bokeh/bokeh.git
cd $BOKEH_CLONE_ROOT/examples/app
bokeh serve fourier_animated.py selection_histogram.py 
```
## Stack trace

```
HTTPServerRequest(protocol='http', host='localhost:5006', method='GET', uri='/', version='HTTP/1.1', remote_ip='::1', headers={'Accept-Language': 'en-US,en;q=0.8', 'Accept-Encoding': 'gzip, deflate, sdch', 'Host': 'localhost:5006', 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8', 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.106 Safari/537.36', 'Connection': 'keep-alive', 'Upgrade-Insecure-Requests': '1'})
Traceback (most recent call last):
  File "/home/tsnyder/miniconda/envs/bokeh_sep01/lib/python2.7/site-packages/tornado/web.py", line 1469, in _execute
    result = yield result
  File "/home/tsnyder/miniconda/envs/bokeh_sep01/lib/python2.7/site-packages/tornado/gen.py", line 1015, in run
    value = future.result()
  File "/home/tsnyder/miniconda/envs/bokeh_sep01/lib/python2.7/site-packages/tornado/concurrent.py", line 237, in result
    raise_exc_info(self._exc_info)
  File "/home/tsnyder/miniconda/envs/bokeh_sep01/lib/python2.7/site-packages/tornado/gen.py", line 270, in wrapper
    result = func(*args, **kwargs)
  File "/home/tsnyder/miniconda/envs/bokeh_sep01/lib/python2.7/site-packages/bokeh/server/views/root_handler.py", line 32, in get
    self.render("app_index.html", items=self.applications.keys())
  File "/home/tsnyder/miniconda/envs/bokeh_sep01/lib/python2.7/site-packages/tornado/web.py", line 719, in render
    html = self.render_string(template_name, **kwargs)
  File "/home/tsnyder/miniconda/envs/bokeh_sep01/lib/python2.7/site-packages/tornado/web.py", line 823, in render_string
    t = loader.load(template_name)
  File "/home/tsnyder/miniconda/envs/bokeh_sep01/lib/python2.7/site-packages/tornado/template.py", line 427, in load
    self.templates[name] = self._create_template(name)
  File "/home/tsnyder/miniconda/envs/bokeh_sep01/lib/python2.7/site-packages/tornado/template.py", line 454, in _create_template
    with open(path, "rb") as f:
IOError: [Errno 2] No such file or directory: '/home/tsnyder/miniconda/envs/bokeh_sep01/lib/python2.7/site-packages/bokeh/server/views/app_index.html'
```
- Software version information output by `bokeh info` command

```
Python version      :  2.7.12 |Continuum Analytics, Inc.| (default, Jul  2 2016, 17:42:40) 
IPython version     :  Not installed
Bokeh version       :  0.12.1
BokehJS static path :  /home/tsnyder/miniconda/envs/bokeh_sep01/lib/python2.7/site-packages/bokeh/server/static
```



Discussion:
I haven't tracked down whether this is the conda packaging recipe (unfortunately, the package I downloaded doesn't have the recipe bundled in it) or something that will happen with a `python setup.py install` from the source directory also.  I'll dig a bit more tomorrow.

Can you provide more context. 
- It seems unusual that you're installing bokeh 0.12.1 and cloning master (are you just cloning master to get the examples?)
- What did you run to get the error?

I wonder if there was a template not added to the manifest.

> On Sep 1, 2016, at 22:04, Sarah Bird notifications@github.com wrote:
> 
> Can you provide more context.
> 
> It seems unusual that you're installing bokeh 0.12.1 and cloning master (are you just cloning master to get the examples?)
> What did you run to get the error?
> —
> You are receiving this because you are subscribed to this thread.
> Reply to this email directly, view it on GitHub, or mute the thread.

@birdsarah I only cloned master to get at the examples. yes

I also missed copy/pasting the cmdline.  I just picked two random server examples so that it would need to serve the index page.

I think @bryevdv is on to something.  I was able to make it happen if I uninstall the bokeh conda package and install bokeh from my source tree as well.  I'll look in the build scripts and submit a PR.

I haven't tracked down whether this is the conda packaging recipe (unfortunately, the package I downloaded doesn't have the recipe bundled in it) or something that will happen with a `python setup.py install` from the source directory also.  I'll dig a bit more tomorrow.

Can you provide more context. 
- It seems unusual that you're installing bokeh 0.12.1 and cloning master (are you just cloning master to get the examples?)
- What did you run to get the error?

I wonder if there was a template not added to the manifest.

> On Sep 1, 2016, at 22:04, Sarah Bird notifications@github.com wrote:
> 
> Can you provide more context.
> 
> It seems unusual that you're installing bokeh 0.12.1 and cloning master (are you just cloning master to get the examples?)
> What did you run to get the error?
> —
> You are receiving this because you are subscribed to this thread.
> Reply to this email directly, view it on GitHub, or mute the thread.

@birdsarah I only cloned master to get at the examples. yes

I also missed copy/pasting the cmdline.  I just picked two random server examples so that it would need to serve the index page.

I think @bryevdv is on to something.  I was able to make it happen if I uninstall the bokeh conda package and install bokeh from my source tree as well.  I'll look in the build scripts and submit a PR.


Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -495,6 +495,7 @@ def package_tree(pkgroot):
 
 package_path(join(SERVER, 'static'))
 package_path(join(ROOT, 'bokeh', 'core', '_templates'))
+package_path(join(ROOT, 'bokeh', 'server', 'views'), ('.html'))
 package_path(join(ROOT, 'bokeh', 'sampledata'), sampledata_suffixes)
 
 if '--user' in sys.argv:


Test patch: