Where do I add Graphviz's Executable on a Mac - python-3.x

I'm trying to use Graphviz but am getting the error message:
graphviz.backend.ExecutableNotFound: failed to execute ['dot', '-Tpdf', '-O', 'test-output/aoc.gv.pdf'], make sure the Graphviz executables are on your systems' PATH
The code I am running is cut and pasted from the documentation:
from graphviz import Digraph, Graph
dot = Digraph(comment='The Round Table')
dot.node('A', 'King Arthur')
dot.node('B', 'Sir Bedevere the Wise')
dot.node('L', 'Sir Lancelot the Brave')
dot.edges(['AB', 'AL'])
dot.edge('B', 'L', constraint='false')
dot.render('test-output/aoc.gv.pdf')
The file will output to the correct folder and the file is there and it has 170 bytes but it will not open. I have tried other extensions such as just 'gv' and they do not work either. I'm using the latest version of Graphviz which is 0.10.1 and I have tried opening this file on a PC and it does not work on PC either (I have a Mac). This problem is similar to
Graphviz's executables are not found (Python 3.4)
and
Why is pydot unable to find GraphViz's executables in Windows 8?
However, there are major stumbling blocks to my understanding these posts. Number one, I have very little understanding of how Python is executed on a computer, so I really don't even know what an environment variable is. Second, when they refer to computer's PATH I can only assume that they're talking about the directory of the file which is executing the Graphviz module, but I'm not sure about that. So I've added this line of code:
import sys
str1 = "/library/frameworks/python.framework/versions/3.6/lib/python3.6/site-packages/graphviz/"
sys.path.append(str1)
But that is not working. Third, if I were to implement this step:
Add this string to the end of your Variable value list (including semicolon): ;C:\Program Files (x86)\Graphviz2.34\bin
Then I would have to translate that into its Mac counterpart and I'm not able to. Any help would be appreciated.

The diagnostic is saying that dot is not in your $PATH, it does not appear in any of the directories mentioned by that env var. You want to get to a point where trying the following command reports some version number:
$ dot -V
dot - graphviz version 2.40.1 (20161225.0304)
$
$ which dot
/usr/local/bin/dot
$
$ echo $PATH | tr : ' ' | fmt -w1 | grep local
/usr/local/bin
If you are not yet using Brew, you should. It's the easiest way to get this and many other programs onto your Mac. Visit https://brew.sh/ and follow the instructions. Then type:
$ brew install graphviz
...
$ /usr/local/bin/dot -V
That should work just fine. If dot -V says "not found" then simply append the proper directory to your PATH:
$ export PATH="${PATH}:/usr/local/bin"
If your bash shell can run it, then your python program should be able to, as well.

I tried these commands to help me locate the DOT file path on my mac. It was not: "/usr/local/bin/dot" on my system.
dot -V
dot - graphviz version 2.49.2
which dot
/opt/homebrew/bin/dot
I had installed Graphviz, but I was still running into trouble finding the right path. I am using Protege, and I had to modify the path for OwlViz since it was displaying the entire hierarchy at (0,0). I copied the path that I got by running the which dot command to the OWLViz tab on the preference dialog, and restarted protege and it worked perfectly! Good luck!

Problem solved. It took me a while to figure out that I had to download some non-pythonic software before I could get the pythonic software to work.
brew install graphviz
Was step 1 and I had done that before but I was getting an error message. It told me to change ownership of some files so I did that. Then tried
brew install graphviz
again and that did the trick.

Related

Unable to get python3 to work in Git on Windows10

I have installed the latest windows 10 version of Git v 24 and use the standard recommended install as shown on a number of websites including https://zarkom.net/blogs/how-to-install-git-and-git-bash-on-windows-9140
he has said that his install recommends for vers 19 are still ok for v24 and just click on Next etc. I have had this confirmed with other help guides but on install I type in after the $ sign either python and or python3 and nothing happens but I can see when running a test file the bash:
/c/Users/nigel/AppData/Local/Microsoft/WindowsApps/python3: Permission denied
I don't have python3 installed there but in standard C:\Users\nigel\AppData\Local\Programs\Python.
I have powershell running ok and am using Sublime Text 3 ok I can run code I prepare in Powershell version 5.6.. whatever it is now standard install part of Windows10. No issues running Python IDLE either.
When I search the reg with regedit and type in git bash I cannot trace this odd link to Microsoft/*/Python as above but in that folder there is an odd link not seen previously not sure what installed that other than sometime ago I might have started an instll of python via M store but sure I didn't but this odd python language server may have got installed through something else?
C:\Users\nigel\AppData\Local\Microsoft\Python Language Server\stubs.v1 is all I can find but in windowapps I found 0kb of a couple of files that are odd ie python.exe and python3.exe and size says 0kb.
I cant seem to find how to amend git so that it stops looking in this odd location and looks in correct folder as stated above ie C:\Users\nigel\AppData\Local\Programs\Python
I would appreciate any help although I am using powershell and ST3 ok on my python courses on UDEMY. I have tried to look at environmental path etc but cant see any reference to this odd path link with windowapps ? I have amended path ok previously for other editors or ensured that the path was pointing to correct python. The only other version of python I have is with Jupyter/ananconda but that is self contained my word ie it doesn't fire up unless I am in Anaconda or jupyter hope that makes sense which I use on another course ie bootcamp course

Why isn't Coq recognizing compiled libraries?

I'm trying to get Coq working as a plugin for Sublime Text 3 on MacOS. I have everything working save for code that requires import statements.
The exact same code works perfectly when run in CoqIDE (which runs Coqc version 8.9), but when I try to run from Coqc verion 8.8 (homebrew install), when I reach my statement:
From LF Require Export Basics.
it throws the error:
Cannot find a physical path bound to logical path matching suffix <> and prefix LF.
When I remove From LF I get:
Basics.vo contains library LF.Basics and not library Basics
which indicates (at least to me) that the libraries are, indeed, compiling and making correctly, and something else is wrong.
Here are the commands that I run:
coq_makefile -f _CoqProject -o CoqMakefile
make -f CoqMakefile -B
My _CoqProject looks like this:
-R . LF
Basics.v
Induction.v
Anyone have any ideas or any experience with this?

Atom Script can't find the path for Python 3 on Mac

When using the script addon for Atom it brings up:
Unable to run
/usr/bin/python3
Did you start Atom from the command line?
atom .
Is it in your PATH?
PATH: /usr/bin/python3:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Frameworks/Python.framework/Versions/3.7/bin:/usr/bin/python3:/usr/local/share/dotnet:/Library/Frameworks/Mono.framework/Versions/Current/Commands:~/.dotnet/tools
How do I get Atom to recognize Python 3?
I tried installing Python using Homebrew and it is installed to /usr/local/bin/python3 as well as using the Terminal to add all of the suggested path locations to /etc/paths.
You need to properly configure the script package to use a profile that points to the correct python3.
Open a Terminal and navigate to the directory containing your scripts.
$ pwd
/Users/cerberus/Scripts
Get the path to python3
If you installed it via Homebrew, then it should be at:
$ python3 -V
Python 3.7.3
$ which python3
/usr/local/bin/python3
You can also check that Homebrew already updated PATH to add /usr/local/bin, but unless you did something wrong with the Python installation, this part is unnecessary.
$ echo $PATH
.../usr/local/bin/:/...
Now, start Atom from the command line as explained in the package docs
Make sure to launch Atom from the console/terminal. This gives atom
all your useful environment variables. Additionally, make sure to run
it with the project path you need.
$ cd /path/to/scripts
$ atom .
OR
$ atom /path/to/scripts
Go to Packages > Command Palette > Toggle (or use CMD+SHIFT+P)
Select Script: Run Options
Input the path to your scripts and the path to the python3 command
NOTE: On my machine, just setting python3 also works. But if you are having problems with your python path, you can try to specify the full path (/usr/local/bin/python3) as shown.
Save the profile (ex. as "Python3")
Now, when you want to run your Python scripts, use the Script: Run with Profile command and then select the profile you just created.
That should work now.

Graphviz executables not found. Python 3

I`m trying to get this code to run:
Getting started with Graphviz and Python
http://matthiaseisen.com/articles/graphviz/
import graphviz as gv
g1 = gv.Graph(format='svg')
g1.node('A')
g1.node('B')
g1.edge('A', 'B')
print(g1.source)
this part works fine, but...
filename = g1.render(filename='img/g1')
print (filename)
-> make sure the Graphviz executables are on your systems' PATH
I found similar questions/answers, but I dont know much about the Windows registry, so I dont dare to experiment a lot there. I downloaded Graphviz as zip-file, and I did conda install graphviz at some point. Python 3.6 is installed per default. C:\Users\Oliver\Appdata\Local\Programs\Python36.
I go to Control Panel - System - Advanced System - Environment Variables, but what exactly do I have to change there?
I could finally solve this:
The graphviz zip I had direcly extracted directly in my Downloads-folder (or wherever you want to have it).
Control Panel - System - Advanced System - Environment Variables
Then in the lower half, System Variables (not User variables), double-klick Path: klick New and browse to the graphviz bin-folder.

Error "syntax error near unexpected token '&' - trying to run a file from command line within an application

I am a newbie to Linux and I am only really using it to use a program for my final year thesis. I have got to grips with the language for the program but am having issues with actually running it in Linux. The program is called "CACTUS" and all documentation can be found here.
I have extracted the application file and I have made the executable as instructed in the install.txt file:
"Installation of CACTUS for Linux or Mac machines.
Unzip the directory and put in desired location. On terminal cd into the
correct directory (you should be able to see the makefiles).
Create the executable by typing:
$make
or
$make -f Makefile.gfortran
on the terminal. The executable will be called cactus and be located in the
directory one level above.You can add the executable's location to your path
so that you can call it by simple typing cactus on the terminal instead of
the complete path.
cd into the Test/RegTest directory
$cd ./Test/RegTest
and run the RegTest by executing runreg.py with the path to the CACTUS
executable as an argument (or just the name of the executable if you added it
to your path).
$./runreg.py ../../../cactus
or
$./runreg.py cactus
The output should say 'No differences' for all three tests. Note: if you have
Python 3 installed used runreg_p3.py instead.
CONGRATULATIONS! You have successfully installed CACTUS.
I have run this and I didn't get the "No Differences" returned on the runreg.py. I continued anyway as I did not know why or how I could fix this. (This may be a root cause of my overally problem here)
As I progressed I have been trying to open an input file "TestVAWT.in" from TestCase2 with the following command:
./TestVAWT.in ../../../cactus
From this I get the error in the title returned. Am I correct in assuming that it has tried to run the TestVAWT.in file on the command line without referring to the Cactus application which I presume would be able to read the '&' prefix of the code along with the rest of the input file. Or is it something else I am missing here.
I would appreciate any help as I have been banging my head against a wall for some time now.
Note: I am using Ubuntu 14.04 LTS.
Best Regards
Richard
Don't know the application, but looks kind of strange to me.
Please try adding the Input-File as a parameter:
cactus TestVAWT.in

Resources