question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support in papermill

See original GitHub issue

Firstly, Altair is awesome! Trying to get it to work with papermill & jupyter notebooks and running into some issues:

Unsure if this is the proper way to ask this question, but I have some visualizations done in matplotlib that take different parameters and work with papermill (I can run a script to create various versions of a main notebook with slight shifts in the mean / std used in a plot of the normal distribution for example).

I have been trying to replicate the papermill run using Altair (altair==3.0.1) but not able to get an actual output. The process runs without any error, but the final image is not showing in the output notebooks. I did include alt.renderers.enable(‘notebook’).

Below is an example of the basic code I have tried:

# top cell for params
x_marker = "petalLength"

# next cell 
import altair as alt
alt.renderers.enable('notebook')
from vega_datasets import data

# ensure injected-params work 
print(x_marker)

# final cell
iris = data.iris()

alt.Chart(iris).mark_point().encode(
    x=x_marker,
    y='petalWidth',
    color='species'
)

I then run the following in CL:

papermill papermill_altair_test.ipynb pmill_alt_out.ipynb -p x_ma
rker "sepalLength"

While it builds a notebook w/ proper parameter the image does not render and I just receive <vega.vegalite.VegaLite at 0xd793930>

I know in the documentation it states this could mean I need alt.renderers.enable('notebook'), which I have already included.

Just curious if this is expected behavior or if I might be missing a step?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:14 (9 by maintainers)

github_iconTop GitHub Comments

4reactions
RoyalTScommented, Jul 7, 2021

I have just become that person! Apparently adding alt.renderers.enable('mimetype') to the notebook and then running papermill over it will make altair plots visible in the output notebook in Jupyter Lab.

1reaction
Alcampopianocommented, May 11, 2019

@dwanneruchi

Papermill works for me in Jupyterlab with the following setup:

Altair version: 3.0.1 Jupyterlab version: 1.0.0a3

AFAIK you must use the following command to get the pre-release of JL at the moment:

python -m pip install -U --pre jupyterlab

Then, as you may know, you have to set the cell’s metadata with a “parameters” tag, as follows:

sc

Within a module (or using the CLI), call Papermill to execute the template notebook with the parameterization:

import papermill as pm

pm.execute_notebook(
   'papermill_template.ipynb',
   'papermill_target.ipynb',
   parameters=dict(x_var='Horsepower')
)

After that, the target notebook is created and the Altair charts are rendered as expected.

Al

Read more comments on GitHub >

github_iconTop Results From Across the Web

Support Us - Paper Mill Playhouse
Support Us · Donate to Paper Mill · Membership and its Benefits · Planned Giving · Education & Community Programs · Events ·...
Read more >
Home - papermill 2.4.0 documentation
Papermill is a tool for parameterizing and executing Jupyter Notebooks. ... sunset by the python org papermill will similarly drop support in the...
Read more >
papermill Documentation - Read the Docs
Provide help for Python notebooks by inspecting the parameters cell, via --help-notebook. • Support added for parameterizing Powershell kernels.
Read more >
Papermill PySpark support - python - Stack Overflow
Papermill will work with PySpark kernels, so long as they implement Jupyter's kernel spec. Configuring your kernel will depend on the kernel ...
Read more >
Entry Level Paper Mill Support Jobs, Employment | Indeed.com
119 Entry Level Paper Mill Support jobs available on Indeed.com. Apply to Utility Worker, Production Worker, Entry Level Operator and more!
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found