Installation

In general the simplest way to start using KiBot is using docker. This is because you can download docker images containing all the needed dependencies. Once you are familiarized with KiBot, installing it locally will offer better performance. Docker can run KiBot for Windows, macOS and Linux.

When you don’t use docker images: KiBot main target is Linux, but some users successfully use it on Windows. For Windows you’ll need to install tools to mimic a Linux environment, like WSL2 (part of Windows 10 and newer). Running KiBot on macOS should be possible now that KiCad migrated to Python 3.x, volunteers to test it are welcome.

You can also run KiBot using docker images in a CI/CD environment like GitHub or GitLab. In this case you don’t need to install anything locally.

Installation using docker

The basic idea is to:

  1. Install docker

  2. Download the docker image

  3. Run the docker image containing KiBot

There are many ways to achieve this, here is a more detailed description for Linux:

  1. Install docker on your system. You just need the Docker Engine, but you can use Docker Desktop (which includes Docker Engine).

    • To install Docker Engine visit this site

    • Once docker is installed make sure your user has rights to run docker, the docs explains how to run a simple example:

      docker run hello-world
      

      You should be able to run it without the need to use root or sudo. Otherwise you’ll need to follow the instructions about what to do after installation (i.e. add your user to the docker group and reload groups, try here).

  2. To download the docker image for KiCad 8 just run:

    docker pull ghcr.io/inti-cmnb/kicad8_auto_full:latest
    

    Replace 8 by the KiCad version you are using (i.e. kicad7_auto_full for KiCad 7). This will download all the needed tools.

    • If you need to test the current development code replace latest by dev.

    • If you need to save disk space, and you don’t need high quality 3D renders and PDF reports you can try the smaller images. They are named like this: kicad8_auto (without full)

  3. Start the docker image. As a first approach you can try using a script like this: (downloadable)

    #!/bin/sh
    export USER_ID=$(id -u)
    export GROUP_ID=$(id -g)
    docker run --rm -it \
        --user $USER_ID:$GROUP_ID \
        --env NO_AT_BRIDGE=1 \
        --env DISPLAY=$DISPLAY \
        --workdir="/home/$USER" \
        --volume=/tmp/.X11-unix:/tmp/.X11-unix \
        --volume="/etc/group:/etc/group:ro" \
        --volume="/etc/passwd:/etc/passwd:ro" \
        --volume="/etc/shadow:/etc/shadow:ro" \
        --volume="/home/$USER:/home/$USER:rw" \
        ghcr.io/inti-cmnb/kicad8_auto_full:latest /bin/bash
    

    Here you should replace ghcr.io/inti-cmnb/kicad8_auto_full:latest by the name of the docker image you downloaded. Don’t forget to make the script executable using, assuming you used the same name used in the repo:

    chmod +x docker_kibot_linux.sh
    

    This script will:

    • Use the system users in your docker image. So you can change users like in your system.

    • Start using the same user you are using in your main system.

    • Mount the home of your user in the docker image, so you can access your files from the docker image.

    • Export your graphics environment information so you can even run the KiCad in the docker image and display it in your graphics environment. Note that you might need to run:

      xhost +local:docker
      

      from a graphics terminal so applications in the docker image can get access to your screen.

    • Start with a shell (/bin/bash) with your home as the current directory

    • Note that when you exit this docker image (just executing exit from the created shell) the docker instance will be stopped and any change to the image itself will be discarded (–rm)

    Once running the docker image you can try:

kibot --version

A more elaborated script for docker images on Linux

The following (script) can be used to run KiBot from a docker image with some versatility.

The script takes two optional arguments:

  1. The name of the command to run inside the docker container. By default is /bin/bash, so you get a bash shell.

  2. The name of the docker image to use. Currently kicad8_auto_full:latest, but might change in the future.

It will use the current directory, so you can do things like:

docker_kibot_linux_allow.sh "kibot --quick-start"

To run KiBot in quick-start mode in the current directory. Note that this assumes the current directory can be accessed from your user home.

You can also check the version of KiBot found in different docker images like this:

docker_kibot_linux_allow.sh "kibot --version" kicad8_auto_full:latest
docker_kibot_linux_allow.sh "kibot --version" kicad8_auto_full:dev

Or you can even run the KiCad inside the docker image:

docker_kibot_linux_allow.sh kicad

Even run an old version of KiCad:

docker_kibot_linux_allow.sh kicad kicad7_auto_full:latest

Note that the script gives access to the current user to connect to your display, this is normally what you want to do.

Be careful with the quotes, the first argument is the command that we pass to docker. From the point of view of the script, and docker, is just one string, but can be multiple arguments once inside the docker container (“kibot –version” becomes “kibot” “–version”).

Additionaly this script can run Blender from the docker image, just rename it blender and run the script pretending this is blender. In this case all arguments are passed to Blender and you can’t select which docker image is used.

Installation on Ubuntu or Debian

The easiest way is to use the repo, but if you want to manually install the individual .deb files you can:

Get the Debian package from the releases section and run:

sudo apt install ./kibot*_all.deb

Important note: Sometimes the release needs another packages that aren’t part of the stable Debian distribution. In this case the packages are also included in the release page. As an example version 0.6.0 needs:

sudo apt install ./python3-mcpy_2.0.2-1_all.deb ./kibot_0.6.0-1_all.deb

Important note: The KiCad Automation Scripts packages are a mandatory dependency. The KiBoM, InteractiveHtmlBom and PcbDraw are recommended.

About Blender on Debian systems

The Debian maintainer disagrees with Intel people about the AI denoiser used by Blender and distributes a package with it disabled. If you use the official Debian package you’ll need to enable the no_denoiser option. This might seem simple, but the problem is that on CI/CD environments Blender won’t use GPU accelerated render, so the lack of a denoiser means you need 10 times more time to render the image.

To make things worst the pcb2blender plug-in is very dependant on the Blender version (Blender fault). The simplest solution is to run Blender from the docker images, even on a local system. For this you can use the following script.

Installation on Arch Linux

AUR repository for kibot

yay -S kibot

Installation using pip

pip install --no-compile kibot

Note that pip has the dubious idea of compiling everything it downloads. There is no advantage in doing it and it interferes with the mcpy macros. Also note that in modern Linux systems pip was renamed to pip3, to avoid confusion with pip from Python 2.

If you are installing at system level I recommend generating the compilation caches after installing. As root just run:

kibot --help-outputs > /dev/null

Note that pip will automatically install all the needed Python dependencies. But it won’t install other interesting dependencies. In particular you should take a look at the KiCad Automation Scripts dependencies. If you have a Debian based OS I strongly recommend trying to use the .deb packages for all the tools.

Also note that in modern Linux system you might need to add the –break-system-packages option.

If you want to install the code only for the current user add the --user option.

If you want to install the last git code from GitHub using pip use:

pip3 install --user git+https://github.com/INTI-CMNB/KiBot.git

You can also clone the repo, change to its directory and install using:

pip3 install --user -e .

In this way you can change the code and you won’t need to install again.

Notes about virtualenv

If you try to use a Python virtual environment you’ll need to find a way to make the KiCad module (pcbnew) available on it. From the linked GitHub issue , to make the pcbnew available on the virtual env, you will need to run the following command:

python -m venv --system-site-packages venv

Then python started in the venv will look at the packages in the system location, which is where KiCad puts its python code.

In addition: note that the virtual env will change the system share data paths. They will no longer point to things like /usr/share/ but to a virtual env place. So you’ll need to either define environment variables to tell KiBot where are the libs or just add symlinks from the virtual env to the system level libs.

Installation on other targets

  • Install KiCad 6.0.11 or newer

  • Install Python 3.7 or newer

  • Install the Python Yaml and requests modules

  • Run the script src/kibot

Dependencies

Notes:

  • When installing from the Debian repo, you don’t need to worry about dependencies, just pay attention to recommended and suggested packages.

  • All dependencies are available in the full docker images.

  • When installing using pip the dependencies marked with PyPi dependency will be automatically installed.

  • The dependencies marked with Auto-download can be downloaded on-demand by KiBot. Note this is poorly tested and is mostly oriented to 64 bits Linux systems. Please report problems.

  • The kibot-check tool can help you to know which dependencies are missing.

  • Note that on some systems (i.e. Debian) ImageMagick disables PDF manipulation in its policy.xml file. Comment or remove lines like this: <policy domain="coder" rights="none" pattern="PDF" /> (On Debian: /etc/ImageMagick-6/policy.xml).

    Here is an example for the case of Debian 12:

    sed -i 's/<policy domain="coder" rights="none" pattern="PDF" \/>/<!-- <policy domain="coder" rights="none" pattern="PDF" \/> -->/g' /etc/ImageMagick-6/policy.xml
    sed -i 's/<policy domain="coder" rights="none" pattern="PS" \/>/<!-- <policy domain="coder" rights="none" pattern="PS" \/> -->/g' /etc/ImageMagick-6/policy.xml
    

    For more information consult this post

  • Debian Link to Debian stable package.

  • Python module This is a Python module, not a separated tool.

  • Tool This is an independent tool, can be a binary or a Python script.

Lark : image1 image2 image3

  • Mandatory

PyYAML : image4 image5 image6

  • Mandatory

Requests : image7 image8 image9

  • Mandatory

KiCad Automation tools : v2.3.4 image10 PyPi dependency Auto-download

  • Mandatory for: convert_pcb, dxf_sch_print, gencad, hpgl_sch_print, netlist, pdf_pcb_print, pdf_sch_print, ps_sch_print, render_3d, run_drc, run_erc, step, svg_pcb_print, svg_sch_print, update_xml, vrml

  • Optional to:

    • Compare schematics for diff (v2.2.0)

    • Show KiAuto installation information for info (v2.0.0)

    • Compare schematics for kiri (v2.2.0)

    • Print the page frame in GUI mode for pcb_print (v1.6.7)

KiKit : v1.6.0 image11 Auto-download

  • Mandatory for: panelize, stencil_3d, stencil_for_jig

  • Optional to separate multiboard projects for general use

KiCad PCB/SCH Diff : v2.5.3 image12 Auto-download

  • Mandatory for: diff, kiri

LXML : image13 image14 Auto-download

  • Mandatory for: pcb_print, pcbdraw

OpenSCAD : image15 image16

  • Mandatory for: stencil_3d, stencil_for_jig

Xvfb : image17 image18

  • Mandatory for: stencil_3d, stencil_for_jig

Xvfbwrapper : image19 image20 Auto-download

  • Mandatory for: stencil_3d, stencil_for_jig

KiCost : v1.1.8 image21 Auto-download

  • Mandatory for kicost

  • Optional to find components costs and specs for bom

Blender : v3.4.0 image22 image23

  • Mandatory for blender_export

Interactive HTML BoM : v2.7.0 image24 Auto-download

  • Mandatory for ibom

KiBoM : v1.9.1 image25 Auto-download

  • Mandatory for kibom

markdown2 : image26 image27 image28

  • Mandatory for kikit_present

QRCodeGen : image29 image30 image31 Auto-download

  • Mandatory for qr_lib

Colorama : image32 image33 image34

  • Optional to get color messages in a portable way for general use

Git : image35 image36 Auto-download

  • Optional to:

    • Compare with files in the repo for diff

    • Find commit hash and/or date for kikit_present

    • Compare with files in the repo for kiri

    • Find origin url for navigate_results

    • Find origin url for navigate_results_rb

    • Find commit hash and/or date for pcb_replace

    • Find commit hash and/or date for sch_replace

    • Find commit hash and/or date for set_text_variables

RSVG tools : image37 image38 Auto-download

  • Optional to:

    • SVG logos for the BoM for bom

    • Create outputs preview for navigate_results

    • Create PNG icons for navigate_results

    • Create outputs preview for navigate_results_rb

    • Create PNG icons for navigate_results_rb

    • Create PDF, PNG, PS and EPS formats for pcb_print

    • Create PNG, JPG and BMP images for pcbdraw

ImageMagick : image39 image40 Auto-download

  • Optional to:

    • Automatically crop images for blender_export

    • Create outputs preview for navigate_results

    • Create outputs preview for navigate_results_rb

    • Create monochrome prints and scaled PNG files for pcb_print

    • Create JPG and BMP images for pcbdraw

    • Automatically crop images for render_3d

Bash : image41 image42

  • Optional to:

    • Run external commands to create replacement text for pcb_replace

    • Run external commands to create replacement text for sch_replace

    • Run external commands to create replacement text for set_text_variables

Ghostscript : image43 image44 Auto-download

  • Optional to:

    • Create outputs preview for navigate_results

    • Create outputs preview for navigate_results_rb

    • Create PNG, PS and EPS formats for pcb_print

numpy : image45 image46 Auto-download

  • Optional to automatically adjust SVG margin for pcbdraw

Pandoc : image47 image48

  • Optional to create PDF/ODF/DOCX files for report

  • Note: In CI/CD environments: the kicad_auto_test docker image contains it.

RAR : image49 image50 Auto-download

  • Optional to compress in RAR format for compress

XLSXWriter : v1.1.2 image51 image52 image53 Auto-download

  • Optional to create XLSX files for bom