Graphviz Dot failing to remove overlaps due to missing library - command-line

I am trying to run the following dot command from the command line:
dot -v ~/Documents/FlowGraph/dot_sample_1_full.dot -Tpng 'Documents/FlowGraph/sampleOutput.png' -Ksfdp -Goverlap=false
but it is failing with this output:
dot - graphviz version 2.36.0 (20140111.2315)
Using render: cairo:cairo
Using device: png:cairo:cairo
libdir = "/usr/local/lib/graphviz"
Activated plugin library: libgvplugin_neato_layout.6.dylib
Using layout: sfdp:neato_layout
The plugin configuration file:
/usr/local/lib/graphviz/config6
was successfully loaded.
render : cairo dot fig map pic pov ps quartz svg tk vml xdot
layout : circo dot fdp neato nop nop1 nop2 osage patchwork sfdp twopi
textlayout : textlayout
device : bmp canon cgimage cmap cmapx cmapx_np dot eps exr fig gif gv icns ico imap imap_np ismap jp2 jpe jpeg jpg pct pdf pic pict plain plain-ext png pov ps ps2 psd sgi svg svgz tga tif tiff tk vml vmlz x11 xdot xdot1.2 xdot1.4 xlib
loadimage : (lib) bmp eps gif jpe jpeg jpg pdf png ps svg
fontname: "Times-Roman" resolved to: (ps:pango Times, REGULAR) (PangoCairoCoreTextFont) "Times"
margin 8
pack info:
mode node
size 0
flags 0
ctrl->overlap=-1
Error: remove_overlap: Graphviz not built with triangulation library
I've Googled and found this thread, which suggested:
gts has to be installed before graphivz so enter 'sudo brew remove
graphviz' to remove graphivz and 'sudo brew install gts' and 'sudo
install graphivz' to install graphivz with gts.
but that didn't seem to work. I'm still getting the error so either I didn't do it right, or that wasn't the solution for me.
How do I add the triangulation library to graphviz?

I had a similar problem on macOS with sfdp and the following is what solved it.
$ brew uninstall graphviz
$ brew install gts
$ brew install --with-gts graphviz

Homebrew doesn't support command line install options anymore, so the previous answers will not work anymore.
However, by accident i discovered that removing graphviz, installing gts, then installing graphviz works. It seems that graphviz will use gts if it isnt installed, but for some reason, it isnt a dependency.
brew remove graphviz
brew install gts
brew install graphviz

Related

Open WebP images in GCE Deep Learning VM

In python code, I need to process webp images. But when I try to open it with python PIL module, I have an error:
OSError: cannot identify image file 'my_image.webp
My Deep Learning image is created from GCP Marketplace VM (tensorflow image), but it seems that webp format is not "activated" at the pillow level.
Is the webp format supported in python by default?
What do I need to do/install/import on the VM to be able to open webp images with python PIL?
My python code steps:
>>>import PIL
​
>>>print(PIL.__version__)
6.0.0.post0
>>>from PIL import features
>>>print (features.check_module('webp'))
False
>>> PIL.Image.open('my_image.webp')
/usr/local/lib/python3.5/dist-packages/PIL/Image.py:2703: UserWarning: image file could not be identified because WEBP support not installed
warnings.warn(message)
---------------------------------------------------------------------------
OSError Traceback (most recent call last)
<ipython-input-4-99a62d35da67> in <module>
----> 1 PIL.Image.open('BATIMENT0000000045936174_flatRoof.webp')
/usr/local/lib/python3.5/dist-packages/PIL/Image.py in open(fp, mode)
2703 warnings.warn(message)
2704 raise IOError("cannot identify image file %r"
-> 2705 % (filename if filename else fp))
2706
2707 #
OSError: cannot identify image file 'my_image.webp'
Open JupyterLab UI of your GCP VM and run a Terminal session. In the terminal run these commands to install webp library:
pip uninstall Pillow
pip uninstall Pillow-SIMD
sudo apt install libwebp-dev
pip install Pillow-SIMD
Restart your Jupyter kernel. Now PIL is able te read webp images.
Ran into a similar issue on one of my servers.
Used the commands mentioned above, but was still getting False when running features.check_module('webp')
Turns out when reinstalling Pillow-SIMD, you need to make sure you're not using the cached version of the build, otherwise you won't get the WEBP support. So changing the last step to: pip install Pillow-SIMD --no-cache-dir solved it for me.
I would've added this as a comment but I don't have enough rep!

How to install YoloV3 in python using some codes in anaconda?

Anaconda Prompt
I used to follow this article: https://medium.com/deepquestai/train-object-detection-ai-with-6-lines-of-code-6d087063f6ff, but I can't proceed because I can't install YoloV3. The line which I followed here is pip install https://github.com/OlafenwaMoses/ImageAI/releases/download/essential-v4/pretrained-yolov3.h5 but it appears error on anaconda.
The output is Cannot unpack file c:\users\appdata\local\temp\pip-unpack-vo7bb6\pretrained-yolov3.h5 (downloaded from c:\users\appdata\local\temp\pip-req-build-pfzpqr, content-type: application/octet-stream); cannot detect archive format
Cannot determine archive format of c:\users\appdata\local\temp\pip-req-build-pfzpqr
Follow the instructions in the article exactly. The YOLO model is not a PIP package but a file to download and put in the same folder as your other code. It's not using pip but wget
!wget https://github.com/OlafenwaMoses/ImageAI/releases/download/essential-v4/pretrained-yolov3.h5

Open Babel can't convert from mol2 to png because Cairo library is not loaded

I first installed Open Babel through brew. When I tried to run the command: "obabel -:"CC(=O)Cl" -opng -O mymol.png", I got this error message: " Open Babel Error in PNG Format
PNG2Format not found. Probably the Cairo library is not loaded." I then proceeded to use brew to uninstall Open Babel. Then, I installed Cairo with brew and then installed Open Babel with brew again. Still though, I try to create a PNG output and it gives me the same error message. I just do not know what's going on??
I’ve found that when using brew to install open-babel, I do not need to install Cairo in a separate step. The open-babel formula includes a '--with-cairo’ option that installs all the required dependencies, including Cairo.
Here is how I installed open-babel with Cairo support:
$ brew install --with-cairo open-babel

Doxygen fail to generate graphs in Linux

I just tried to set up my Doxfile to generate graphs but i get:
Problems running dot: exit code=127, command='dot',
arguments='"/MyProject/extras/doc/target/html/_c_c_blade_8cpp__incl.dot" -Tpng -o
"/MyProject/extras/doc/target/html/_c_c_blade_8cpp__incl.png"'
finished...
*** Doxygen has finished
And no graphs are generated. Whats going on?
The problem waas on Mint linux doxygen don't install plugins to draw graphs automatically, installing package graphviz solve the problem
sudo apt-get install graphviz -y

PIL installation under CentOS selftest fine but jpeg not working

I built and installed PIL on my CentOS 6.2 with Python 2.7 by executing build, build_ext -i and install. I had to change the library paths so that all supports are given.
When I run the selftest.py it says that everything is ok and all supports are given (especially JPEG).
When running my program which opens a jpeg, adds something, and saves it I get the error:
File "/opt/python2.7.2/lib/python2.7/site-packages/PIL/Image.py", line 401, in _getencoder
raise IOError("encoder %s not available" % encoder_name)
IOError: encoder jpeg not available
My program works fine on other systems and it runs on the centOS machine fine when I change it to png. I ran all commands with python2.7, and I already tried to reinstall PIL.
So in short: before installing PIL it runs within the selftest successfully, but after installing it it does not work any more.
I found the solution in the ubuntu forums
1/ Call 'pip install -I pil --no-install' to download and unpack the PIL source into your
build directory;
2/ Get into your build directory and edit setup.py;
3/ Find the line that says 'add_directory(library_dirs, "/usr/lib")' (line 214 here);
4/ Add the line 'add_directory(library_dirs, "/usr/lib/i386-linux-gnu")' afterwards;
5/ Call 'pip install -I pil --no-download' to finish the installation.