TutteInstitute / datamapplot

Creating beautiful plots of data maps
MIT License
779 stars 50 forks source link

deckgl_template #42

Open dhruv-anand-aintech opened 1 month ago

dhruv-anand-aintech commented 1 month ago

Might be a missing file in the new 0.4 release

[line 1](vscode-notebook-cell:?execution_count=13&line=1)FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/lib/python3.11/site-packages/datamapplot/deckgl_template.html'
{
    "name": "FileNotFoundError",
    "message": "[Errno 2] No such file or directory: '/usr/local/lib/python3.11/site-packages/datamapplot/deckgl_template.html'",
    "stack": "---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
Cell In[13], line 1
----> 1 import datamapplot
      2 import numpy as np
      4 datamapplot.create_interactive_plot(
      5     np.array(umap_data[:, :2]),
      6     np.array(hdbscan_labels.astype(str)),
      7     hover_text=df[title_col],
      8 )

File /usr/local/lib/python3.11/site-packages/datamapplot/__init__.py:1
----> 1 from datamapplot.create_plots import create_plot, create_interactive_plot
      2 from datamapplot.plot_rendering import render_plot
      3 from datamapplot.interactive_rendering import render_html

File /usr/local/lib/python3.11/site-packages/datamapplot/create_plots.py:17
     15 from datamapplot.plot_rendering import render_plot
     16 from datamapplot.medoids import medoid
---> 17 from datamapplot.interactive_rendering import (
     18     render_html,
     19     label_text_and_polygon_dataframes,
     20     InteractiveFigure,
     21 )
     24 def create_plot(
     25     data_map_coords,
     26     labels=None,
   (...)
     49     **render_plot_kwds,
     50 ):
     51     \"\"\"Create a static plot from ``data_map_coords`` with text labels provided by ``labels``.
     52     This is the primary function for DataMapPlot and provides the easiest interface to the
     53     static plotting functionality. This function provides a number of options, but also
   (...)
    171 
    172     \"\"\"

File /usr/local/lib/python3.11/site-packages/datamapplot/interactive_rendering.py:28
     25 from datamapplot.alpha_shapes import create_boundary_polygons, smooth_polygon
     26 from datamapplot.medoids import medoid
---> 28 _DECKGL_TEMPLATE_STR = (files(\"datamapplot\") / \"deckgl_template.html\").read_text(
     29     encoding=\"utf-8\"
     30 )
     32 _TOOL_TIP_CSS = \"\"\"
     33             font-size: 0.8em;
     34             font-family: {{title_font_family}};
   (...)
     40             max-width: 25%;
     41 \"\"\"
     43 _NOTEBOOK_NON_INLINE_WORKER = \"\"\"
     44     const parsingWorkerBlob = new Blob([`
     45       async function DecompressBytes(bytes) {
   (...)
     80     `], { type: 'application/javascript' });
     81 \"\"\"

File /usr/local/lib/python3.11/pathlib.py:1058, in Path.read_text(self, encoding, errors)
   1054 \"\"\"
   1055 Open the file in text mode, read it, and close the file.
   1056 \"\"\"
   1057 encoding = io.text_encoding(encoding)
-> 1058 with self.open(mode='r', encoding=encoding, errors=errors) as f:
   1059     return f.read()

File /usr/local/lib/python3.11/pathlib.py:1044, in Path.open(self, mode, buffering, encoding, errors, newline)
   1042 if \"b\" not in mode:
   1043     encoding = io.text_encoding(encoding)
-> 1044 return io.open(self, mode, buffering, encoding, errors, newline)

FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/lib/python3.11/site-packages/datamapplot/deckgl_template.html'"
}
Ibrokhimsadikov commented 1 month ago

I am facing same issue!

AndreaFrancis commented 1 month ago

I encountered the same issue while working with BERTopic. I resolved it by switching to version 0.3.0, and the error disappeared

lmcinnes commented 1 month ago

This is very odd -- as far as I can tell all the relevant pieces to ensure the file exists are in place. I'll have to see if I can debug the packaging.

lmcinnes commented 1 month ago

So it was a simple issue in the end that messed up the packaging. Hopefully there will be a 0.4.1 on PyPI shortly that should resolve the issue.