facebookresearch / beanmachine

A library that allows for inference on probabilistic models
https://beanmachine.org/
MIT License
264 stars 49 forks source link

Install JupyterLab instead of Jupyter #1479

Open ndmlny-qs opened 2 years ago

ndmlny-qs commented 2 years ago

Issue Description

In setup.py we install jupyter, however, if a user uses Jupyter and runs a tutorial, then they might see improper rendering of math. See the images from the Hidden Markov tutorial below as an example.

Correct math rendering on the website. correct-rendering-website

Incorrect rendering in Jupyter. incorrect-rendering-jupyter

This can be fixed by switching out a Jupyter installation with a JupyerLab installation and adding the jupyerlab-katex plugin as a dependency.

Fixed rendering in Jupyter. correct-rendering-jupyter

Steps to Reproduce

Use the instructions in the README.md and ensure you install Bean Machine using the pip install -e ".[dev]" command. If you do not install the dev environment, then you will not get a working Jupyter installation.

Expected Behavior

Tutorials would work the same way as on the website.

Additional Context

If we are going to suggest a user use conda, then we should have conda install pip as a dependency as well.

ndmlny-qs commented 2 years ago

@feynmanliang and @horizon-blue The change is mostly for user experience when trying out Bean Machine and the tutorials on their local machine. If the switch from Jupyter notebook to JupyterLab is not something y'all want internally then I'm happy to remove the changes from setup.py, see the https://github.com/facebookresearch/beanmachine/tree/issue1479/jupyterlab-install branch for the proposed changes.

The change does have the side effect of incrementally moving the widget proposal into a usable state as the tools were designed for JupyterLab and not the plain Jupyter notebook session; https://github.com/facebookresearch/beanmachine/tree/ot-visual-widget-proposal. I don't think there is a difference in the behavior of the Bokeh tools in JupyterLab vs JupyterNB, but I have not tested them in both environments.