Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

HTML repr error #449

Closed
tomwhite opened this issue Apr 24, 2024 · 0 comments · Fixed by #450
Closed

HTML repr error #449

tomwhite opened this issue Apr 24, 2024 · 0 comments · Fixed by #450
Labels
bug Something isn't working

Comments

@tomwhite
Copy link
Member

From xarray-contrib/flox#356.

Running the getting started example in a notebook gives:

---------------------------------------------------------------------------
TemplateNotFound                          Traceback (most recent call last)
File ~/miniconda3/envs/cubed-test-install/lib/python3.9/site-packages/cubed/vendor/dask/widgets/widgets.py:40, in get_template(name)
     39 try:
---> 40     return get_environment().get_template(name)
     41 except TemplateNotFound as e:

File ~/miniconda3/envs/cubed-test-install/lib/python3.9/site-packages/jinja2/environment.py:1010, in Environment.get_template(self, name, parent, globals)
   1008     name = self.join_path(name, parent)
-> 1010 return self._load_template(name, globals)

File ~/miniconda3/envs/cubed-test-install/lib/python3.9/site-packages/jinja2/environment.py:969, in Environment._load_template(self, name, globals)
    967         return template
--> 969 template = self.loader.load(self, name, self.make_globals(globals))
    971 if self.cache is not None:

File ~/miniconda3/envs/cubed-test-install/lib/python3.9/site-packages/jinja2/loaders.py:125, in BaseLoader.load(self, environment, name, globals)
    123 # first we try to get the source for this template together
    124 # with the filename and the uptodate function.
--> 125 source, filename, uptodate = self.get_source(environment, name)
    127 # try to load the code from the bytecode cache if there is a
    128 # bytecode cache configured.

File ~/miniconda3/envs/cubed-test-install/lib/python3.9/site-packages/jinja2/loaders.py:204, in FileSystemLoader.get_source(self, environment, template)
    203 else:
--> 204     raise TemplateNotFound(template)
    206 with open(filename, encoding=self.encoding) as f:

TemplateNotFound: array.html.j2

The above exception was the direct cause of the following exception:

TemplateNotFound                          Traceback (most recent call last)
File ~/miniconda3/envs/cubed-test-install/lib/python3.9/site-packages/IPython/core/formatters.py:344, in BaseFormatter.__call__(self, obj)
    342     method = get_real_method(obj, self.print_method)
    343     if method is not None:
--> 344         return method()
    345     return None
    346 else:

File ~/miniconda3/envs/cubed-test-install/lib/python3.9/site-packages/cubed/array_api/array_object.py:63, in Array._repr_html_(self)
     60     nbytes = "unknown"
     61     cbytes = "unknown"
---> 63 return get_template("array.html.j2").render(
     64     array=self,
     65     grid=grid,
     66     nbytes=nbytes,
     67     cbytes=cbytes,
     68     arrs_in_plan=f"{self.plan.num_arrays()} arrays in Plan",
     69     arrtype="np.ndarray",
     70 )

File ~/miniconda3/envs/cubed-test-install/lib/python3.9/site-packages/cubed/vendor/dask/widgets/widgets.py:42, in get_template(name)
     40     return get_environment().get_template(name)
     41 except TemplateNotFound as e:
---> 42     raise TemplateNotFound(
     43         f"Unable to find {name} in dask.widgets.TEMPLATE_PATHS {TEMPLATE_PATHS}"
     44     ) from e

TemplateNotFound: Unable to find array.html.j2 in dask.widgets.TEMPLATE_PATHS ['/Users/tom/miniconda3/envs/cubed-test-install/lib/python3.9/site-packages/cubed/vendor/dask/widgets/templates']

It looks like array.html.j2 is not present in the installed package.

@tomwhite tomwhite added the bug Something isn't working label Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant