Skip to content

BUG: d3viz html template is not found after installation #333

Open
@l8l

Description

@l8l

Describe the issue:

I followed the example described here: https://pytensor.readthedocs.io/en/latest/library/d3viz/index.html

I did not change any line of the example code provided and everything executes fine (including the installation of pydot-ng) until the line d3v.d3viz(predict, 'examples/mlp.html'), where an error is thrown, even though the import statement import pytensor.d3viz as d3v returns no error.

The error is: No such file or directory: '<HOME>/.local/lib/python3.11/site-packages/pytensor/d3viz/html/template.html'. When checking the directory, I can see that the directory '<HOME>/.local/lib/python3.11/site-packages/pytensor/d3viz/ actually does exist but there is no /html/ folder inside.

I also made sure that graphviz is installed on the system.

What to do about this? Thanks!

Reproducable code example:

import pytensor.d3viz as d3v
d3v.d3viz(predict, 'examples/mlp.html')
# where predict is the function specified in this example: https://pytensor.readthedocs.io/en/latest/library/d3viz/index.html

Error message:

FileNotFoundError                         Traceback (most recent call last)
Cell In[16], line 2
      1 import pytensor.d3viz as d3v
----> 2 d3v.d3viz(predict, 'examples/mlp.html')

File ~/.local/lib/python3.11/site-packages/pytensor/d3viz/d3viz.py:88, in d3viz(fct, outfile, copy_deps, *args, **kwargs)
     86 # Read template HTML file
     87 template_file = os.path.join(__path__, "html", "template.html")
---> 88 with open(template_file) as f:
     89     template = f.read()
     91 # Copy dependencies to output directory

FileNotFoundError: [Errno 2] No such file or directory: '~/.local/lib/python3.11/site-packages/pytensor/d3viz/html/template.html'

PyTensor version information:

Pytensor Version 2.12.1, installed with pip
Python Version 3.11.3
Linux

Context for the issue:

The graph visualization feature would be very important for my work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions