`show_bloq` not working

Open Beginner friendly
#2,007 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
66/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
jupyter, python
Domain
backend

Research direction

Start in qualtran/drawing/_show_funcs.py and qualtran/drawing/graphviz.py, then trace how show_bloq renders a graph through pydot. The traceback shows rendering fails because the Graphviz dot executable is missing from PATH; check the project’s installation guidance and related tests for how this dependency is expected to be handled. Done means the minimal example works or gives users clear guidance when dot is unavailable.

Written by the indexing model from the issue text.

Description

The show_bloq feature is not working. For example in the first tutorial "wiring up", I get the following FileNotFound error

---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
File [~/Qualtran/.venv/lib/python3.14/site-packages/pydot/core.py:1824](http://localhost:8889/lab/tree/tutorials/quantum-programming/.venv/lib/python3.14/site-packages/pydot/core.py#line=1823), in Dot.create(self, prog, format, encoding)
   1823 try:
-> 1824     stdout_data, stderr_data, process = call_graphviz(
   1825         program=prog,
   1826         arguments=arguments,
   1827         working_dir=tmp_dir,
   1828     )
   1829 except OSError as e:

File [~/Qualtran/.venv/lib/python3.14/site-packages/pydot/core.py:249](http://localhost:8889/lab/tree/tutorials/quantum-programming/.venv/lib/python3.14/site-packages/pydot/core.py#line=248), in call_graphviz(program, arguments, working_dir, **kwargs)
    247 program_with_args = [program] + arguments
--> 249 process = subprocess.Popen(
    250     program_with_args,
    251     env=env,
    252     cwd=working_dir,
    253     shell=False,
    254     stderr=subprocess.PIPE,
    255     stdout=subprocess.PIPE,
    256     **kwargs,
    257 )
    258 stdout_data, stderr_data = process.communicate()

File [/usr/lib/python3.14/subprocess.py:1039](http://localhost:8889/usr/lib/python3.14/subprocess.py#line=1038), in Popen.__init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, user, group, extra_groups, encoding, errors, text, umask, pipesize, process_group)
   1036             self.stderr = io.TextIOWrapper(self.stderr,
   1037                     encoding=encoding, errors=errors)
-> 1039     self._execute_child(args, executable, preexec_fn, close_fds,
   1040                         pass_fds, cwd, env,
   1041                         startupinfo, creationflags, shell,
   1042                         p2cread, p2cwrite,
   1043                         c2pread, c2pwrite,
   1044                         errread, errwrite,
   1045                         restore_signals,
   1046                         gid, gids, uid, umask,
   1047                         start_new_session, process_group)
   1048 except:
   1049     # Cleanup if the child failed starting.

File [/usr/lib/python3.14/subprocess.py:1990](http://localhost:8889/usr/lib/python3.14/subprocess.py#line=1989), in Popen._execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, restore_signals, gid, gids, uid, umask, start_new_session, process_group)
   1989 if err_filename is not None:
-> 1990     raise child_exception_type(errno_num, err_msg, err_filename)
   1991 else:

FileNotFoundError: [Errno 2] No such file or directory: 'dot'

During handling of the above exception, another exception occurred:

FileNotFoundError                         Traceback (most recent call last)
Cell In[4], line 2
      1 from qualtran.drawing import show_bloq
----> 2 show_bloq(do_nothing)

File [~/Qualtran/qualtran/drawing/_show_funcs.py:40](http://localhost:8889/lab/tree/tutorials/quantum-programming/qualtran/drawing/_show_funcs.py#line=39), in show_bloq(bloq, type)
     38 type = type.lower()
     39 if type == 'graph':
---> 40     show_bloq_graph(bloq)
     41 elif type == 'dtype':
     42     show_bloq_dtype_graph(bloq)

File [~/Qualtran/qualtran/drawing/_show_funcs.py:151](http://localhost:8889/lab/tree/tutorials/quantum-programming/qualtran/drawing/_show_funcs.py#line=150), in show_bloq_graph(bloq)
    147 import IPython.display
    149 from .graphviz import PrettyGraphDrawer
--> 151 IPython.display.display(PrettyGraphDrawer(bloq).get_svg())

File [~/Qualtran/qualtran/drawing/graphviz.py:369](http://localhost:8889/lab/tree/tutorials/quantum-programming/qualtran/drawing/graphviz.py#line=368), in GraphDrawer.get_svg(self)
    367 def get_svg(self) -> IPython.display.SVG:
    368     """Get an IPython SVG object displaying the graph."""
--> 369     return IPython.display.SVG(self.get_svg_bytes())

File [~/Qualtran/qualtran/drawing/graphviz.py:365](http://localhost:8889/lab/tree/tutorials/quantum-programming/qualtran/drawing/graphviz.py#line=364), in GraphDrawer.get_svg_bytes(self)
    363 def get_svg_bytes(self) -> bytes:
    364     """Get the SVG code (as bytes) for drawing the graph."""
--> 365     return self.get_graph().create(prog='dot', format='svg', encoding='utf-8')

File [~/Qualtran/.venv/lib/python3.14/site-packages/pydot/core.py:1833](http://localhost:8889/lab/tree/tutorials/quantum-programming/.venv/lib/python3.14/site-packages/pydot/core.py#line=1832), in Dot.create(self, prog, format, encoding)
   1831     args = list(e.args)  # type: ignore
   1832     args[1] = f'"{prog}" not found in path.'  # type: ignore
-> 1833     raise OSError(*args)
   1834 else:
   1835     raise

FileNotFoundError: [Errno 2] "dot" not found in path.

I've installed qualtran and dependencies from the repository. I'm using the latest version of jupyter-lab (4.6.6) from pip. I run into the same error when using vscode with jupyter extension.

Minimal code that produces the error:

from qualtran import BloqBuilder
from qualtran import QInt
from qualtran.drawing import show_bloq


# Start program construction
bb = BloqBuilder()

# Add input/output registers named 'x'
x = bb.add_register('x', QInt(8))

do_nothing = bb.finalize(x=x)

show_bloq(do_nothing)
Dominant language
Python
Stars
397
Forks
127
Avg merge
2d 22h
Merged PRs (30d)
1

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from quantumlib/Qualtran

All issues in quantumlib/Qualtran

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.