blockdiag installation procedure

blockdiag is a programmatic tool for generating block diagrams. You can easily write something like a screen transition diagram with a program, and you can link with Spyinx. Block diagram generation tool blockdiag

environment

OS:Mac OS X 10.9.5 Python:Ver.2.7.7

Installation procedure

Create /usr/local/Library/Formula/freetype2.rb.

require 'formula'

class Freetype2 <Formula
  url 'http://sourceforge.net/projects/freetype/files/freetype2/2.4.4/freetype-2.4.4.tar.gz/download'
  homepage 'http://freetype.sourceforge.net/index2.html'
  md5 '9273efacffb683483e58a9e113efae9f'
  version '2.4.4'

  # depends_on 'cmake'

  def install
    system "./configure", "--disable-debug", "--disable-dependency-tracking",
                          "--prefix=#{prefix}"
    # system "cmake . #{std_cmake_parameters}"
    system "make install"
  end
end

Install freetype.

$ brew install freetype2

Install PIL.

$ sudo easy_install pil

If successful, the following words will be displayed.

・ ・ ・
Installed /Library/Python/2.7/site-packages/PIL-1.1.7-py2.7-macosx-10.9-intel.egg
Processing dependencies for pil
Finished processing dependencies for pil

Install blockdiag.

$ sudo easy_install blockdiag

How to build

Create text.diag.

blockdiag {
Screen 1->Screen 2->Screen 3;
Screen 2->Screen 4->Screen 1;
}

Build test.diag

Output as png

$ blockdiag test.diag

test.png is created. test.png

Output with SVG

$ blockdiag -Tsvg test.diag

test.svg is output

Output as PDF

$ blockdiag -Tpdf test.diag

If you get an error

If an error occurs 1

If you get the following error when installing PIL.

・ ・ ・
_imagingft.c:73:10: fatal error: 'freetype/fterrors.h' file not found
#include <freetype/fterrors.h>
         ^
1 error generated.
error: command 'cc' failed with exit status 1

Execute the following command to make a symbolic link.

$ sudo ln -s /usr/local/Cellar/freetype2/2.4.4/include/freetype2/freetype /usr/local/include/freetype

If an error occurs 2

When "The _imagingft C module is not installed" is displayed by the blockdiag command

$ blockdiag test.diag
ERROR: The _imagingft C module is not installed

(Proposal 1) Uninstall PIL once

$ sudo easy_install -m PIL
$ sudo rm -rf /Library/Python/2.7/site-packages/PIL-1.1.7-py2.7-macosx-10.9-intel.egg

Reinstall PIL

$ sudo easy_install pil

(Proposal 2) Check if Pillow is installed elsewhere

$ pip freeze
・ ・ ・
Pillow==2.5.3
・ ・ ・

Uninstall Pillow

% sudo pip uninstall pillow

If you run blockdiag in this state, you will get angry if there is no Pillow

% blockdiag test.diag                                                   
Traceback (most recent call last):
  File "/usr/local/bin/blockdiag", line 5, in <module>
    from pkg_resources import load_entry_point
  File "build/bdist.macosx-10.9-intel/egg/pkg_resources.py", line 2867, in <module>

  File "build/bdist.macosx-10.9-intel/egg/pkg_resources.py", line 432, in _build_master
    corresponding to the path entry, and they are added.  `entry` is
  File "build/bdist.macosx-10.9-intel/egg/pkg_resources.py", line 728, in require
    requirements specified when this environment was created, or False
  File "build/bdist.macosx-10.9-intel/egg/pkg_resources.py", line 622, in resolve
    shadow_set = self.__class__([])
pkg_resources.DistributionNotFound: Pillow

Install Pillow

% sudo easy_install Pillow

No more errors

$ blockdiag test.diag
$

Recommended Posts

blockdiag installation procedure
Pylearn 2 installation procedure
Linux mint installation procedure
AWS CLI installation procedure
django-debug-toolbar installation procedure memo
ubuntu20.04 + Geth installation procedure
Anaconda3 environment installation procedure
Scrapy environment installation procedure
CentOS 8 installation procedure (latest version)
Docker Easy Installation Procedure (CentOS)
Python 3.6 installation procedure [for Windows]
ubuntu 20.04 + VirtalBox installation procedure summary
OpenCV installation procedure on Raspberry Pi
PySpark 1.5.2 + Elasticsearch 2.1.0 Installation procedure and execution
Teamviewer for Linux installation procedure (CentOS)
Summary of Oracle Database XE installation procedure
Django installation
boto3 installation
Pythia Installation
Docker installation
Volatility installation
Python installation
WSL2 (Windows Subsystem for Linux) installation procedure
InstantOS 1 installation
Jupyter installation
Python installation
pip installation
ChaSen installation
Backtrader installation
pip installation
[Ansible installation procedure] From installation to execution of playbook
Kotlin / Native development environment construction & installation procedure & tutorial