`show_bloq` not working

オープン 初心者向け
#2,007 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 3 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
66/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
jupyter, python
領域
backend

調査の方向性

まず qualtran/drawing/_show_funcs.py と qualtran/drawing/graphviz.py を確認し、次に show_bloq が pydot を通じてグラフをどのように描画するかを追ってください。トレースバックによると、Graphviz の実行ファイル dot が PATH にないため、描画に失敗しています。この依存関係をどのように扱う想定なのか、プロジェクトのインストールガイドと関連テストを確認してください。最小の例が動作するか、dot が利用できない場合にユーザーへ明確な案内が表示されれば完了です。

索引モデルが issue の本文から書いたものです。

説明

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)
主要言語
Python
スター
397
フォーク
127
平均マージ
2日 19時間
マージ済み PR(30日)
4

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

quantumlib/Qualtran のほかの issue

quantumlib/Qualtran の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。