`show_bloq` not working

Đang mở Phù hợp với người mới
#2,007 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 3 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
66/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
jupyter, python
Lĩnh vực
backend

Hướng nghiên cứu

Bắt đầu trong qualtran/drawing/_show_funcs.py và qualtran/drawing/graphviz.py, sau đó lần theo cách show_bloq kết xuất đồ thị thông qua pydot. Traceback cho thấy việc kết xuất thất bại vì tệp thực thi dot của Graphviz không có trong PATH; hãy kiểm tra hướng dẫn cài đặt của dự án và các bài kiểm thử liên quan để biết dự án dự kiến xử lý phần phụ thuộc này như thế nào. Công việc hoàn tất khi ví dụ tối thiểu chạy được hoặc cung cấp hướng dẫn rõ ràng cho người dùng khi không có dot.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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)
Ngôn ngữ chính
Python
Star
397
Fork
127
Merge trung bình
2 ngày 19 giờ
Pull request đã merge (30 ngày)
4

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của quantumlib/Qualtran

Tất cả issue của quantumlib/Qualtran

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.