cfn-lint version: (cfn-lint --version). cfn-lint 0.37.1
Description of issue.. Attempting to use --build-graph and getting the following error. This is with any template I try.
❯ cfn-lint --build-graph tomcat.yaml
2020-10-26 11:42:06,181 - cfnlint.template - ERROR - Could not write the graph in DOT format. Please install either pygraphviz or pydot modules.
I have verified that dot is available:
❯ which dot
/usr/local/bin/dot
❯ dot -V
dot - graphviz version 2.44.1 (20200629.0846)
I have graphviz is installed via brew:
❯ brew install graphviz
Warning: graphviz 2.44.1 is already installed and up-to-date
To reinstall 2.44.1, run brew reinstall graphviz
I have verified path:
/Users/joshkonkol/.pyenv/shims:/Library/Frameworks/Python.framework/Versions/3.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware Fusion.app/Contents/Public:/usr/local/go/bin
Hi @jkonkol, you need the python library for graphviz or dot.
If you installed cfn-lint with pip install cfn-lint, you can run pip install pygraphviz or pip install pydot
I have verified both are installed.
❯ pip install pygraphviz
Requirement already satisfied: pygraphviz in /Users/joshkonkol/.pyenv/versions/3.7.3/lib/python3.7/site-packages (1.6)
WARNING: You are using pip version 20.2.3; however, version 20.2.4 is available.
You should consider upgrading via the '/Users/joshkonkol/.pyenv/versions/3.7.3/bin/python3.7 -m pip install --upgrade pip' command.
❯ pip install pydot
Requirement already satisfied: pydot in /Users/joshkonkol/.pyenv/versions/3.7.3/lib/python3.7/site-packages (1.4.1)
Requirement already satisfied: pyparsing>=2.1.4 in /Users/joshkonkol/.pyenv/versions/3.7.3/lib/python3.7/site-packages (from pydot) (2.4.7)
WARNING: You are using pip version 20.2.3; however, version 20.2.4 is available.
You should consider upgrading via the '/Users/joshkonkol/.pyenv/versions/3.7.3/bin/python3.7 -m pip install --upgrade pip' command.
Thank you for the idea, keep 'em coming!!
How was cfn-lint installed? pip or brew? Might be issues with --build-graph if cfn-lint was installed with brew
I have verified it was installed using pip install cfn-lint
I tried running brew uninstall cfn-lint but got an error that it didn't exist.
Thanks
Could you paste the output of these commands to help with debugging?
pip show cfn-lint pydot pygraphviz
which cfn-lint
which cfn-lint | xargs cat
❯ pip show cfn-lint pydot pygraphviz
Name: cfn-lint
Version: 0.39.0
Summary: Checks CloudFormation templates for practices and behaviour that could potentially be improved
Home-page: https://github.com/aws-cloudformation/cfn-python-lint
Author: kddejong
Author-email: [email protected]
License: MIT no attribution
Location: /Users/joshkonkol/.pyenv/versions/3.7.3/lib/python3.7/site-packages
Requires: jsonschema, junit-xml, pyyaml, six, networkx, aws-sam-translator, jsonpatch
Required-by:
---
Name: pydot
Version: 1.4.1
Summary: Python interface to Graphviz's Dot
Home-page: https://github.com/pydot/pydot
Author: Ero Carrera
Author-email: [email protected]
License: MIT
Location: /Users/joshkonkol/.pyenv/versions/3.7.3/lib/python3.7/site-packages
Requires: pyparsing
Required-by:
---
Name: pygraphviz
Version: 1.6
Summary: Python interface to Graphviz
Home-page: http://pygraphviz.github.io
Author: Aric Hagberg
Author-email: [email protected]
License: BSD
Location: /Users/joshkonkol/.pyenv/versions/3.7.3/lib/python3.7/site-packages
Requires:
Required-by:
❯ which cfn-lint
/Library/Frameworks/Python.framework/Versions/3.7/bin/cfn-lint
❯ which cfn-lint | xargs cat
#!/Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7
# -*- coding: utf-8 -*-
import re
import sys
from cfnlint.__main__ import main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(main())
It looks like you have two installations of cfn-lint.
One in /Library/Frameworks/Python.framework/Versions/3.7/bin/cfn-lint, and one in /Users/joshkonkol/.pyenv/versions/3.7.3/lib/python3.7/.
You probably installed both with pip install cfn-lint, both the second is using pyenv.
Can you run /Users/joshkonkol/.pyenv/versions/3.7.3/bin/cfn-lint ?
❯ /Users/joshkonkol/.pyenv/versions/3.7.3/bin/cfn-lint ?
2020-10-27 07:56:06,324 - cfnlint.decode - ERROR - Template references a directory, not a file: 1
E0000 Template references a directory, not a file: 1
1:1:1
❯ /Users/joshkonkol/.pyenv/versions/3.7.3/bin/cfn-lint --version
cfn-lint 0.39.0
❯ cfn-lint --version
cfn-lint 0.39.0
❯ which cfn-lint
/Users/joshkonkol/.pyenv/shims/cfn-lint
❯ /Users/joshkonkol/.pyenv/versions/3.7.3/bin/cfn-lint ?
2020-10-27 07:56:06,324 - cfnlint.decode - ERROR - Template references a directory, not a file: 1
E0000 Template references a directory, not a file: 1
1:1:1
You will also have to specify a file.
❯ which cfn-lint
/Users/joshkonkol/.pyenv/shims/cfn-lint
Did you notice that this is different from the output yesterday? I don't know what you did, but chances are it will work now
This was helpful. I did indeed have two versions of cfn-lint. I removed the old version and updated my path and it does indeed work.
Thanks for your help
Most helpful comment
This was helpful. I did indeed have two versions of cfn-lint. I removed the old version and updated my path and it does indeed work.
Thanks for your help