map_chain.get_graph().print_ascii()
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
Cell In[20], line 2
1 # map_chain.get_graph()
----> 2 map_chain.get_graph().print_ascii()
File D:\aitest\code\pk-langchain\.venv\Lib\site-packages\langchain_core\runnables\graph.py:523, in Graph.print_ascii(self)
521 def print_ascii(self) -> None:
522 """Print the graph as an ASCII art string."""
--> 523 print(self.draw_ascii())
File D:\aitest\code\pk-langchain\.venv\Lib\site-packages\langchain_core\runnables\graph.py:516, in Graph.draw_ascii(self)
513 # Import locally to prevent circular import
514 from langchain_core.runnables.graph_ascii import draw_ascii # noqa: PLC0415
--> 516 return draw_ascii(
517 {node.id: node.name for node in self.nodes.values()},
518 self.edges,
519 )
File D:\aitest\code\pk-langchain\.venv\Lib\site-packages\langchain_core\runnables\graph_ascii.py:296, in draw_ascii(vertices, edges)
293 xlist: list[float] = []
294 ylist: list[float] = []
--> 296 sug = _build_sugiyama_layout(vertices, edges)
298 for vertex in sug.g.sV:
299 # NOTE: moving boxes w/2 to the left
300 xlist.extend(
301 (
302 vertex.view.xy[0] - vertex.view.w / 2.0,
303 vertex.view.xy[0] + vertex.view.w / 2.0,
304 )
305 )
File D:\aitest\code\pk-langchain\.venv\Lib\site-packages\langchain_core\runnables\graph_ascii.py:203, in _build_sugiyama_layout(vertices, edges)
201 if not _HAS_GRANDALF:
202 msg = "Install grandalf to draw graphs: `pip install grandalf`."
--> 203 raise ImportError(msg)
205 #
206 # Just a reminder about naming conventions:
207 # +------------X
(...) 212 # Y
213 #
215 vertices_ = {id_: Vertex(f" {data} ") for id_, data in vertices.items()}
ImportError: Install grandalf to draw graphs: `pip install grandalf`.
Windows PowerShell
版权所有 (C) Microsoft Corporation。保留所有权利。
尝试新的跨平台 PowerShell https://aka.ms/pscore6
[PyCharm] Your PSReadLine module version (2.0.0) is outdated, which may cause the problem with black lines across the terminal screen:
https://learn.microsoft.com/windows/terminal/troubleshooting#black-lines-in-powershell-51-6x-70
Install the latest version by running: 'Install-Module PSReadLine -MinimumVersion 2.0.3 -Scope CurrentUser -Force'
After the installation, open a new terminal tab.
(pk-langchain) PS D:\aitest\code\pk-langchain> pip install grandalf
Collecting grandalf
Downloading grandalf-0.8-py3-none-any.whl.metadata (1.7 kB)
Collecting pyparsing (from grandalf)
Using cached pyparsing-3.2.5-py3-none-any.whl.metadata (5.0 kB)
Downloading grandalf-0.8-py3-none-any.whl (41 kB)
Using cached pyparsing-3.2.5-py3-none-any.whl (113 kB)
Installing collected packages: pyparsing, grandalf
Successfully installed grandalf-0.8 pyparsing-3.2.5
(pk-langchain) PS D:\aitest\code\pk-langchain> pip install grandalf pygraphviz
Requirement already satisfied: grandalf in d:\aitest\code\pk-langchain\.venv\lib\site-packages (0.8)
Collecting pygraphviz
Downloading pygraphviz-1.14.tar.gz (106 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: pyparsing in d:\aitest\code\pk-langchain\.venv\lib\site-packages (from grandalf) (3.2.5)
Building wheels for collected packages: pygraphviz
Building wheel for pygraphviz (pyproject.toml) ... error
error: subprocess-exited-with-error
× Building wheel for pygraphviz (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [94 lines of output]
C:\Users\unknowspeople\AppData\Local\Temp\pip-build-env-iq2lewq4\overlay\Lib\site-packages\setuptools\config\_apply_pyprojecttoml.py:82: SetuptoolsDeprecationWarning: `project.license` as a TOML table is deprecated
!!
********************************************************************************
Please use a simple string containing a SPDX expression for `project.license`. You can also use `project.license-files`. (Both options available on setuptools>=77.0.0).
By 2026-Feb-18, you need to update your project and remove deprecated calls
or your builds will no longer be supported.
See https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license for details.
********************************************************************************
!!
corresp(dist, value, root_dir)
C:\Users\unknowspeople\AppData\Local\Temp\pip-build-env-iq2lewq4\overlay\Lib\site-packages\setuptools\config\_apply_pyprojecttoml.py:61: SetuptoolsDeprecationWarning: License classifiers are deprecated.
!!
********************************************************************************
Please consider removing the following classifiers in favor of a SPDX license expression:
License :: OSI Approved :: BSD License
See https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license for details.
********************************************************************************
!!
dist._finalize_license_expression()
C:\Users\unknowspeople\AppData\Local\Temp\pip-build-env-iq2lewq4\overlay\Lib\site-packages\setuptools\dist.py:759: SetuptoolsDeprecationWarning: License classifiers are deprecated.
!!
********************************************************************************
Please consider removing the following classifiers in favor of a SPDX license expression:
License :: OSI Approved :: BSD License
See https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license for details.
********************************************************************************
!!
self._finalize_license_expression()
running bdist_wheel
running build
running build_py
creating build\lib.win-amd64-cpython-312\pygraphviz
copying pygraphviz\agraph.py -> build\lib.win-amd64-cpython-312\pygraphviz
copying pygraphviz\graphviz.py -> build\lib.win-amd64-cpython-312\pygraphviz
copying pygraphviz\scraper.py -> build\lib.win-amd64-cpython-312\pygraphviz
copying pygraphviz\testing.py -> build\lib.win-amd64-cpython-312\pygraphviz
copying pygraphviz\__init__.py -> build\lib.win-amd64-cpython-312\pygraphviz
creating build\lib.win-amd64-cpython-312\pygraphviz\tests
copying pygraphviz\tests\test_attribute_defaults.py -> build\lib.win-amd64-cpython-312\pygraphviz\tests
copying pygraphviz\tests\test_clear.py -> build\lib.win-amd64-cpython-312\pygraphviz\tests
copying pygraphviz\tests\test_close.py -> build\lib.win-amd64-cpython-312\pygraphviz\tests
copying pygraphviz\tests\test_drawing.py -> build\lib.win-amd64-cpython-312\pygraphviz\tests
copying pygraphviz\tests\test_edge_attributes.py -> build\lib.win-amd64-cpython-312\pygraphviz\tests
copying pygraphviz\tests\test_graph.py -> build\lib.win-amd64-cpython-312\pygraphviz\tests
copying pygraphviz\tests\test_html.py -> build\lib.win-amd64-cpython-312\pygraphviz\tests
copying pygraphviz\tests\test_layout.py -> build\lib.win-amd64-cpython-312\pygraphviz\tests
copying pygraphviz\tests\test_node_attributes.py -> build\lib.win-amd64-cpython-312\pygraphviz\tests
copying pygraphviz\tests\test_readwrite.py -> build\lib.win-amd64-cpython-312\pygraphviz\tests
copying pygraphviz\tests\test_repr_mimebundle.py -> build\lib.win-amd64-cpython-312\pygraphviz\tests
copying pygraphviz\tests\test_scraper.py -> build\lib.win-amd64-cpython-312\pygraphviz\tests
copying pygraphviz\tests\test_string.py -> build\lib.win-amd64-cpython-312\pygraphviz\tests
copying pygraphviz\tests\test_subgraph.py -> build\lib.win-amd64-cpython-312\pygraphviz\tests
copying pygraphviz\tests\test_unicode.py -> build\lib.win-amd64-cpython-312\pygraphviz\tests
copying pygraphviz\tests\__init__.py -> build\lib.win-amd64-cpython-312\pygraphviz\tests
running egg_info
writing pygraphviz.egg-info\PKG-INFO
writing dependency_links to pygraphviz.egg-info\dependency_links.txt
writing top-level names to pygraphviz.egg-info\top_level.txt
reading manifest file 'pygraphviz.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching '*.swg'
warning: no files found matching '*.png' under directory 'doc'
warning: no files found matching '*.html' under directory 'doc'
warning: no files found matching '*.txt' under directory 'doc'
warning: no files found matching '*.css' under directory 'doc'
warning: no previously-included files matching '*~' found anywhere in distribution
warning: no previously-included files matching '*.pyc' found anywhere in distribution
warning: no previously-included files matching '.svn' found anywhere in distribution
no previously-included directories found matching 'doc\build'
adding license file 'LICENSE'
writing manifest file 'pygraphviz.egg-info\SOURCES.txt'
copying pygraphviz\graphviz.i -> build\lib.win-amd64-cpython-312\pygraphviz
copying pygraphviz\graphviz_wrap.c -> build\lib.win-amd64-cpython-312\pygraphviz
running build_ext
building 'pygraphviz._graphviz' extension
creating build\temp.win-amd64-cpython-312\Release\pygraphviz
"C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.43.34808\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -DSWIG_PYTHON_STRICT_BYTE_CHAR -DGVDLL -ID:\aitest\code\pk-langchain\.venv\include -ID:\aitest\miniconda3\include -ID:\aitest\miniconda3\Include "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.43.34808\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\cppwinrt" /Tcpygraphviz/graphviz_wrap.c /Fobuild\temp.win-amd64-cpython-312\Release\pygraphviz\graphviz_wrap.obj
graphviz_wrap.c
pygraphviz/graphviz_wrap.c(9): warning C4005: “SWIG_PYTHON_STRICT_BYTE_CHAR”: 宏重定义
pygraphviz/graphviz_wrap.c(9): note: 之前在命令行上声明的“SWIG_PYTHON_STRICT_BYTE_CHAR”
pygraphviz/graphviz_wrap.c(3023): fatal error C1083: 无法打开包括文件: “graphviz/cgraph.h”: No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.43.34808\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for pygraphviz
Failed to build pygraphviz
error: failed-wheel-build-for-install

浙公网安备 33010602011771号