Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

unable to launch specviz from command line #552

Closed
skendrew opened this issue Apr 21, 2021 · 25 comments
Closed

unable to launch specviz from command line #552

skendrew opened this issue Apr 21, 2021 · 25 comments
Labels
question Further information is requested specviz

Comments

@skendrew
Copy link

I have an extracted JWST pipeline output spectrum from MIRI LRS. In python, I can read it into a Spectrum1D object directly -so the file should be readable by specviz. However when I do

jdaviz --layout specviz miri_lrs_slit_pt_nod2_v2_x1d.fits

on the command line, the browser window launches but shows only the following:

image

@pllim
Copy link
Contributor

pllim commented Apr 21, 2021

On my machine (Linux), I sometimes have to minimize it and then show it again for it to finish loading. Not sure if that will also fix your problem. Which browser is this? Try a different browser too by providing --browser option.

@pllim pllim added question Further information is requested specviz labels Apr 21, 2021
@skendrew
Copy link
Author

I'm using Safari. Minimizing did nothing. Tried Firefox and was the same.

@pllim
Copy link
Contributor

pllim commented Apr 21, 2021

What about Chrome? Didn't work on Firefox for me either and I don't use Safari but worked on Chrome on Linux.

@skendrew
Copy link
Author

skendrew commented Apr 21, 2021

Tried Chrome and still the same! I'm on a Mac, 10.15.7 (Catalina)

The screen output on the command line is as follows:
(miricle) sarahkloaner:b77-e2e skendrew$ jdaviz --layout specviz --browser chrome miri_lrs_slit_pt_nod2_v2_x1d.fits
[Voila] Using /var/folders/9l/lthyqbnd6md29c4bpkgdp_980001p3/T to store connection files
[Voila] Storing connection files in /var/folders/9l/lthyqbnd6md29c4bpkgdp_980001p3/T/voila_jfyeq94u.
[Voila] Serving static files from /Users/skendrew/anaconda3/envs/miricle/lib/python3.8/site-packages/voila/static.
[Voila] Voilà is running at:
http://localhost:8866/
[Voila] WARNING | Notebook notebook.ipynb is not trusted
[Voila] Kernel started: 1212ae83-7f24-4ca0-b3eb-c0a5ffcf0582
WARNING:tornado.general:403 GET /voila/files/favicon.ico (::1): File not whitelisted
WARNING:tornado.access:403 GET /voila/files/favicon.ico (::1) 1.01ms

@pllim
Copy link
Contributor

pllim commented Apr 21, 2021

Thanks for checking! 😿

@duytnguyendtn
Copy link
Collaborator

Out of curiosity, if you try to load Specviz without data, does it come up at all?

@skendrew
Copy link
Author

it does not load, it complains about the lack of a file:

(miricle) sarahkloaner:b77-e2e skendrew$ jdaviz --layout specviz --browser chrome
Usage: jdaviz [OPTIONS] FILENAME
Try 'jdaviz --help' for help.

Error: Missing argument 'FILENAME'.
(miricle) sarahkloaner:b77-e2e skendrew$

@skendrew
Copy link
Author

(it does work in a notebook, fwiw. but somewhat buggy.)

@havok2063
Copy link
Collaborator

I've also experienced the same thing. Loading jdaviz in desktop mode results in perpetually executing notebook display. I think I've tried Cubeviz and Specviz in Chrome.

@pllim
Copy link
Contributor

pllim commented Apr 21, 2021

jdaviz --layout=specviz --browser=/path/to/your/chrome-executable-name filename

Example on Linux:

jdaviz --layout=specviz --browser=/usr/bin/chromium-browser myfits.fits

@havok2063
Copy link
Collaborator

I just tested it again with jdaviz --layout=specviz filename and it works for me.

@skendrew
Copy link
Author

no, sorry, none of them working. it does open the correct browser and a new tab, but always shows the same screen as I put in my original message.

@havok2063
Copy link
Collaborator

If you open up the browser console (right click, go to Inspect or Developer Tools, click Console tab) and reload the page, do you see any errors or output?

@skendrew
Copy link
Author

this is from the developer console in Chrome:

Executing cell 1 of 1
:8866/voila/files/favicon.ico:1 Failed to load resource: the server responded with a status of 403 (Forbidden)
voila.js:455 Uncaught (in promise) TypeError: Cannot read property 'kernelChanged' of undefined
at new so (voila.js:455)
at new Ys (voila.js:469)
at getWidgetManager ((index):376)
at window.init ((index):409)
DevTools failed to load SourceMap: Could not load content for http://localhost:8866/voila/static/voila.js.map: HTTP error: status code 403, net::ERR_HTTP_RESPONSE_CODE_FAILURE

@havok2063
Copy link
Collaborator

what version of Voila do you have installed? check if it's voila==0.2.8. If so, try downgrading to 0.2.7 with pip install voila==0.2.7. I've had some issues with the recent release of Voila, and this error looks similar to those.

@skendrew
Copy link
Author

skendrew commented Apr 21, 2021

had 0.2.9, downgraded to 0.2.7 and still same.

there's a couple of warning messages in the terminal:

**http://localhost:8866/
[Voila] WARNING | Notebook notebook.ipynb is not trusted
[Voila] Kernel started: 6ef68ab6-3b22-4ea7-a0f0-815a4622a1d5
WARNING:tornado.general:403 GET /voila/files/favicon.ico (::1): File not whitelisted
WARNING:tornado.access:403 GET /voila/files/favicon.ico (::1) 0.96ms
[Voila] WARNING | Notebook notebook.ipynb is not trusted
[Voila] Kernel started: 3cff2c57-8f5f-4307-9d8d-b69453d5abe9
WARNING:tornado.general:403 GET /voila/files/favicon.ico (::1): File not whitelisted
WARNING:tornado.access:403 GET /voila/files/favicon.ico (::1) 0.47ms
WARNING:tornado.general:404 GET /api/kernels/1315e026-1150-4016-982c-3e89e803be05/channels?session_id=71ea2c04-ec20-445b-b4f7-87739a595c78 (::1): Kernel does not exist: 1315e026-1150-4016-982c-3e89e803be05
WARNING:tornado.access:404 GET /api/kernels/1315e026-1150-4016-982c-3e89e803be05/channels?session_id=71ea2c04-ec20-445b-b4f7-87739a595c78 (::1) 20.25ms
WARNING:tornado.general:403 GET /voila/static/voila.js.map (::1): voila.js.map is not in root static directory
WARNING:tornado.access:403 GET /voila/static/voila.js.map (::1) 1.11ms
^C[Voila] Stopping...
[Voila] Kernel shutdown: 6ef68ab6-3b22-4ea7-a0f0-815a4622a1d5
**

@havok2063
Copy link
Collaborator

hmm. And do you see the same error as before in the developer console?

@skendrew
Copy link
Author

yes same error

@havok2063
Copy link
Collaborator

Hi @skendrew we've merged a potential fix for this. It's not in a release yet, so you'll need to use the latest main branch of jdaviz. Can you pull the latest changes, and upgrade voila to the latest 0.2.10, and try again? If you still get an error, can you paste the content from the Voila terminal window as well as the browser developer console?

@skendrew
Copy link
Author

skendrew commented May 13, 2021

Hi @havok2063 I pip uninstalled jdaviz and then pulled the code from GitHub & installed from there. With Safari I now get a blank screen with 500: Internal Server Error.

The terminal output looks like this:

(miricle) sarahkloaner:b77-e2e skendrew$ jdaviz --layout specviz miri_lrs_slit_pt_nod1_v2_x1d.fits
[Voila] Using /var/folders/9l/lthyqbnd6md29c4bpkgdp_980001p3/T to store connection files
[Voila] Storing connection files in /var/folders/9l/lthyqbnd6md29c4bpkgdp_980001p3/T/voila_feheztf0.
[Voila] Serving static files from /Users/skendrew/anaconda3/envs/miricle/lib/python3.8/site-packages/voila/static.
[Voila] Voilà is running at:
http://localhost:8866/
[Voila] WARNING | Notebook notebook.ipynb is not trusted
ERROR:tornado.application:Uncaught exception GET / (::1)
HTTPServerRequest(protocol='http', host='localhost:8866', method='GET', uri='/', version='HTTP/1.1', remote_ip='::1')
Traceback (most recent call last):
File "/Users/skendrew/anaconda3/envs/miricle/lib/python3.8/site-packages/tornado/web.py", line 1704, in _execute
result = await result
File "/Users/skendrew/anaconda3/envs/miricle/lib/python3.8/site-packages/voila/handler.py", line 154, in get
async for html_snippet, resources in self.exporter.generate_from_notebook_node(notebook, resources=resources, extra_context=extra_context):
File "/Users/skendrew/anaconda3/envs/miricle/lib/python3.8/site-packages/voila/exporter.py", line 100, in generate_from_notebook_node
async for output in self.template.generate_async(nb=nb_copy, resources=resources, **extra_context, static_url=self.static_url):
File "/Users/skendrew/anaconda3/envs/miricle/lib/python3.8/site-packages/nbconvert/exporters/templateexporter.py", line 148, in template
self._template_cached = self._load_template()
File "/Users/skendrew/anaconda3/envs/miricle/lib/python3.8/site-packages/nbconvert/exporters/templateexporter.py", line 355, in _load_template
return self.environment.get_template(template_file)
File "/Users/skendrew/anaconda3/envs/miricle/lib/python3.8/site-packages/jinja2/environment.py", line 883, in get_template
return self._load_template(name, self.make_globals(globals))
File "/Users/skendrew/anaconda3/envs/miricle/lib/python3.8/site-packages/jinja2/environment.py", line 857, in _load_template
template = self.loader.load(self, name, globals)
File "/Users/skendrew/anaconda3/envs/miricle/lib/python3.8/site-packages/jinja2/loaders.py", line 429, in load
raise TemplateNotFound(name)
jinja2.exceptions.TemplateNotFound: index.html.j2
ERROR:tornado.access:500 GET / (::1) 64.59ms
WARNING:tornado.general:403 GET /voila/static/theme-light.css (::1): theme-light.css is not in root static directory
WARNING:tornado.access:403 GET /voila/static/theme-light.css (::1) 2.69ms
WARNING:tornado.general:403 GET /voila/static/index.css (::1): index.css is not in root static directory
WARNING:tornado.access:403 GET /voila/static/index.css (::1) 3.15ms
WARNING:tornado.access:404 GET /voila/files/apple-touch-icon-precomposed.png (::1) 1.16ms
WARNING:tornado.general:403 GET /voila/files/favicon.ico (::1): File not whitelisted
WARNING:tornado.access:403 GET /voila/files/favicon.ico (::1) 0.66ms
WARNING:tornado.access:404 GET /voila/files/apple-touch-icon.png (::1) 0.76ms

@skendrew
Copy link
Author

I am trying to use a different browser but this doesn't work anymore in the same way that I did before. If I put --browser=chrome (the exact same command as I mention in the comments above), the terminal tells me 69:77: execution error: Can’t get application "chrome". (-1728) and no browser opens. I've tried with the full path to the application (/Applications/Google Chrome.app) with same result.

@pllim
Copy link
Contributor

pllim commented May 13, 2021

@havok2063
Copy link
Collaborator

@skendrew Hmm.. it looks like it could be an issue where Voila cannot find the correct template to use when rendering the notebook as html. Are you working in a clean conda environment? I've had similar issues with this index.html.j2 for Voila in my conda envs where it was looking in the wrong place. To resolve it I reinstalled voila in that environment, then deactivated and reactivated the conda env, to clear the conda cache. Can you try the following :

  • run which voila and verify that it is pointing to your correct conda environment
  • check that you're using nbconvert > 6 and traitlets > 5
  • run hash -r in the terminal shell to clear your PATH cache
  • or deactivate and reactivate the conda environment

Could there be a conflicting voila configuration? You can also try running in the terminal, in the conda env, voila --Voila.show_config=True to see if that returns anything odd. It would return a printout of any custom config parameters. If it returns nothing, that means the default Voila configuration is being used.

I just tried creating a clean python 3.8 environment, installing the latest jdaviz git repo, and it worked for me. It took a moment to start up but the spectrum loaded.

conda create -n jtest python=3.8 ipython
conda activate jtest

cd ~/path/to/git/checkout/jdaviz
git pull
pip install -e .

jdaviz --layout specviz ~/Work/jwst/1.1/jw00212-o035_t007_miri_ch2-medium_x1d.fits

[Voila] Using /var/folders/js/s2zfzbv16019vjh0dft_l_w0000263/T to store connection files
[Voila] Storing connection files in /var/folders/js/s2zfzbv16019vjh0dft_l_w0000263/T/voila_5qtawz1c.
[Voila] Serving static files from /Users/bcherinka/anaconda3/envs/jtest/lib/python3.8/site-packages/voila/static.
[Voila] Voilà is running at:
http://localhost:8866/
[Voila] WARNING | Notebook notebook.ipynb is not trusted
[Voila] Kernel started: 8a320fd6-2966-4ce1-a084-3effee9c9e5c
WARNING:tornado.general:403 GET /voila/files/favicon.ico (::1): File not whitelisted
WARNING:tornado.access:403 GET /voila/files/favicon.ico (::1) 1.47ms

I also tried jdaviz --layout specviz --browser=chrome ~/Work/jwst/1.1/jw00212-o035_t007_miri_ch2-medium_x1d.fits and that worked as well.

@skendrew
Copy link
Author

skendrew commented May 13, 2021

I didn't try all of that but I created the clean conda environment and then it did work with safari. I haven't got time to sort out the different browser options right now, but it looks like the basic issue of not launching is fixed!

@havok2063
Copy link
Collaborator

Ok, great! I'm glad it's working now. When in doubt burn it down and start again!

@pllim pllim closed this as completed May 13, 2021
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
question Further information is requested specviz
Projects
None yet
Development

No branches or pull requests

4 participants