Programing

Graphviz 2.38을 설치 한 후“RuntimeError : Graphviz 실행 파일이 시스템 경로에 있는지 확인하십시오.”

crosscheck 2020. 9. 13. 10:04
반응형

Graphviz 2.38을 설치 한 후“RuntimeError : Graphviz 실행 파일이 시스템 경로에 있는지 확인하십시오.”


Graphviz 2.38MSI 버전을 다운로드 하고 폴더 아래에 설치 C:\Python34한 다음 실행 pip install Graphviz하면 모든 것이 잘되었습니다. 시스템 경로에서 C:\Python34\bin. 테스트 스크립트를 실행하려고 할 때 줄 filename=dot.render(filename='test')에 메시지가 표시됩니다.

 RuntimeError: failed to execute ['dot', '-Tpdf', '-O', 'test'], make sure the Graphviz executables are on your systems' path

"C:\Python34\bin\dot.exe"시스템 경로 를 입력하려고했지만 작동하지 않았고 "GRAPHVIZ_DOT"value를 사용 하여 새 환경 변수 만들었지 만 "C:\Python34\bin\dot.exe"여전히 작동하지 않습니다. Graphviz 및 pip uninstall graphviz를 제거한 다음 다시 설치하고 pip install을 다시 시도했지만 아무것도 작동하지 않습니다.

전체 역 추적 메시지는 다음과 같습니다.

Traceback (most recent call last):
  File "C:\Python34\lib\site-packages\graphviz\files.py", line 220, in render
    proc = subprocess.Popen(cmd, startupinfo=STARTUPINFO)
  File "C:\Python34\lib\subprocess.py", line 859, in __init__
    restore_signals, start_new_session)
  File "C:\Python34\lib\subprocess.py", line 1112, in _execute_child
    startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Documents\Kissmetrics\curves and lines\eventNodes.py", line 56, in <module>
    filename=dot.render(filename='test')
  File "C:\Python34\lib\site-packages\graphviz\files.py", line 225, in render
    'are on your systems\' path' % cmd)
RuntimeError: failed to execute ['dot', '-Tpdf', '-O', 'test'], make sure the Graphviz executables are on your systems' path

아무도 그것에 대해 경험이 있습니까?


import os
os.environ["PATH"] += os.pathsep + 'D:/Program Files (x86)/Graphviz2.38/bin/'

Windows에서는 처음에이 두 줄을 추가하십시오. 여기서 'D : / Program Files (x86) /Graphviz2.38/bin/' 은 bin 파일이있는 주소로 대체됩니다.

그것은 문제를 해결합니다.


시스템에 graphviz 패키지를 설치해야합니다 (python 패키지뿐만 아니라). 우분투 당신은 시도해야합니다 :

sudo apt-get install graphviz

이것은 MAC에서 나를 위해 문제를 해결했습니다 .

  brew install graphviz

Windows의 경우 :

  1. https://graphviz.gitlab.io/_pages/Download/Download_windows.html 에서 Windows 패키지를 설치합니다.
  2. Python graphviz패키지 설치
  3. C:\Program Files (x86)\Graphviz2.38\bin사용자 경로에 추가
  4. C:\Program Files (x86)\Graphviz2.38\bin\dot.exe시스템 경로에 추가

이것은 나를 위해 일했습니다!


다음을 사용해보십시오.

conda install python-graphviz

를 사용하는 경우 graphviz 실행 파일은 conda 디렉토리와 다른 경로에 있습니다 pip install graphviz.


OSX Sierra, Python 2.7, Graphviz 2.38

pip install graphvizconda install graphviz둘 다 사용 하면 문제가 해결됩니다.

pip당신과 동일한 경로 문제 conda만 가져오고 가져 오기 오류 만 발생합니다.


Windows 의 환경 변수 (시스템) PATH아래를 추가 하십시오.

C : \ Program Files (x86) \ Graphviz2.38 \ bin

거기에서 .exe 파일을 찾을 수 있습니다.

작동하지 않는 경우

Python lib가 아닌 프로그램 파일 에서 Graphviz2.38 / bin 폴더를 찾으십시오.

그런 다음 PATH에 추가하십시오.

.exe 파일이있는 폴더를 찾는 것이 중요합니다.


시도해보십시오 conda install graphviz. 나는 같은 문제가 있었고 MacOS에서 언급 된 명령으로 해결했습니다.


Using conda install graphviz and conda install python-graphviz to install GraphViz on Windows10 the path needed was C:/ProgramData/Anaconda3/Library/bin/graphviz/ for me. I.e. adding

import os
os.environ["PATH"] += os.pathsep + 'C:/ProgramData/Anaconda3/Library/bin/graphviz/'

solved the issue for me.


conda install python-graphviz

For Windows, install the Python Graphviz which will include the executables in the path.


Step 1: Install Graphviz binary

Windows:

  1. Download Graphviz from http://www.graphviz.org/download/
  2. Add below to PATH environment variable (mention the installed graphviz version):
    • C:\Program Files (x86)\Graphviz2.38\bin
    • C:\Program Files (x86)\Graphviz2.38\bin\dot.exe
  3. Close any opened Juypter notebook and the command prompt
  4. Restart Jupyter / cmd prompt and test

Linux:

  1. sudo apt-get update
  2. sudo apt-get install graphviz
  3. or build it manually from http://www.graphviz.org/download/

Step 2: Install graphviz module for python

pip:

  • pip install graphviz

conda:

  • conda install graphviz

After you've installed the package (link if you haven't), add the path to dot.exe as a new system variable.

Default path is:

C:\Program Files (x86)\Graphviz2.38\bin\dot.exe

enter image description here


I had the same issue on Linux with Jupyter.

To solve it I've added the dot library to python sys.path

First: check if dot is installed,

Then:
find his path whereis dot -> /local/notebook/miniconda2/envs/ik2/bin/dot

Finally in python script : sys.path.append("/local/notebook/miniconda2/envs/ik2/bin/dot")


I had the same error message on Mac OS (El Capitan), using the PyCharm IDE. I had installed Graphviz using brew, as recommended in RZK's answer, and installed the graphviz python package using PyCharm (I could check Graphviz was installed correctly by trying dot -V in a terminal and getting: dot - graphviz version 2.40.1 (20161225.0304)). Yet I was still getting the error message when trying to call Graphviz from PyCharm.

I had to add the path /usr/local/bin in PyCharm options, as recommended in the answer to this question to resolve the problem.


For Linux users who don't have root access and hence can't use sudo command as suggested in other answers...

First, activate your conda virtual-environment (if you want to use one) by:

source activate virtual-env-name

Then install graphviz, even if you have already done it using pip:

conda install graphviz

then copy the result of the following command:

whereis dot

In my case, its output is:

/home/nader/anaconda2/bin/dot

and add it to your PATH variable. Just run the command below

nano ~/.bashrc

and add these lines to the end of the opened file:

PATH="/home/username/anaconda2/bin/dot:$PATH"
export PATH

now press Ctrl+O and then Ctrl+X to save and exit.

Problem should be solved by now.

Pycharm users, please note: Pycharm does not always see the PATH variable the same as your terminal. This solution does not work for Pycharm, and maybe other IDEs. But you can fix this by adding this line of code:

os.environ["PATH"] += os.pathsep + '/home/nader/anaconda2/bin'

to your python program. Do not forget to

import os

first :)

Edit: If you don't want to use conda, you can still install graphviz from here without any root permissions and add the bin folder to your PATH variable. I didn't test this.


1) Graphviz – download unzip in a particular place in the system (pip does not work in windows ) and include the bin folder in the path (‘set environment variables in windows’ OR) set manually in each program

import os
os.environ["PATH"] += os.pathsep + 'C:/GraphViz/bin'

2) Then put the model to plot

clf = xgb.train(params, d_train, 1000, evals=evallist, early_stopping_rounds=10)
xgb.plot_tree(clf)
plt.rcParams['figure.figsize'] = [50, 10]
plt.show()

First, you should use pip install, and then download another package in http://www.graphviz.org/Download_windows.php and add the install location into the environmental path, then it works.


1.install windows package from: https://graphviz.gitlab.io/_pages/Download/Download_windows.html and download msi file

Add in Environmental variables 2. Add C:\Program Files (x86)\Graphviz2.38\bin to User path

  1. Add C:\Program Files (x86)\Graphviz2.38\bin\dot.exe to System Path

  2. Restart your python notebook.

It will work.


OS Mojave 10.14., Python 3.6

Using pip install graphviz had good feedback in terminal, but lead to this error when I tried to make a graph in a Jupyter notebook. I then ran brew install graphviz, which gave an error in terminal. Then I ran conda install graphviz and the graph worked.

From @Leighton's comment: pip only gets path problem same as yours and conda only gets import error.


trying doing this in python import sys !conda install --yes --prefix {sys.prefix} graphviz import graphviz

참고URL : https://stackoverflow.com/questions/35064304/runtimeerror-make-sure-the-graphviz-executables-are-on-your-systems-path-aft

반응형