Skip to content

Tips & Tricks

Quick Start

Install host dependencies:

sudo apt update
sudo apt install --yes libcairo2-dev libgl1-mesa-glx

Todo

Link GH Issues where libcairo2-dev & libgl1-mesa-glx will become optional.

Install most recent version of PartCAD CLI:

pip install -r requirements.txt
pip install --extra-index-url https://test.pypi.org/simple/ -r requirements.txt

Try it out:

pc render
code README.md

Shell Completion

Warning

Currently invocation of pc tool is taking over a second, so completion will not be responsive.

You can enable shell completion for pc CLI tool using one of the snippets below:

echo 'eval "$(_PC_COMPLETE=bash_source pc)"' >> ~/.bash_completion

Known Problems

No matching distribution found for cadquery-ocp

Error

ERROR: Could not find a version that satisfies the requirement cadquery-ocp>=7.7.0 (from build123d) (from versions: none)
ERROR: No matching distribution found for cadquery-ocp>=7.7.0

Info

Most likely this happens due to cadquery-ocp wheel is not compatible with available version of glibc.

Dependency "cairo" not found, tried pkgconfig

Error

vscode ➜ /workspaces/Winterfell (main) $ pip install --extra-index-url https://test.pypi.org/simple/ partcad-cli==0.7.50
...
Collecting pycairo>=1.20.0 (from rlPyCairo->partcad-cli==0.7.50)
  Downloading pycairo-1.27.0.tar.gz (661 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 661.5/661.5 kB 28.8 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [49 lines of output]
      + meson setup /tmp/pip-install-t3prz8p9/pycairo_19c76b7a535d4ba3b506b636c5a2a8a4 /tmp/pip-install-t3prz8p9/pycairo_19c76b7a535d4ba3b506b636c5a2a8a4/.mesonpy-3qkl9ko7 -Dbuildtype=release -Db_ndebug=if-release -Db_vscrt=md -Dwheel=true -Dtests=false --native-file=/tmp/pip-install-t3prz8p9/pycairo_19c76b7a535d4ba3b506b636c5a2a8a4/.mesonpy-3qkl9ko7/meson-python-native-file.ini
      The Meson build system
      Version: 1.6.1
      Source dir: /tmp/pip-install-t3prz8p9/pycairo_19c76b7a535d4ba3b506b636c5a2a8a4
      Build dir: /tmp/pip-install-t3prz8p9/pycairo_19c76b7a535d4ba3b506b636c5a2a8a4/.mesonpy-3qkl9ko7
      Build type: native build
      Project name: pycairo
      Project version: 1.27.0
      C compiler for the host machine: cc (gcc 12.2.0 "cc (Debian 12.2.0-14) 12.2.0")
      C linker for the host machine: cc ld.bfd 2.40
      Host machine cpu family: x86_64
      Host machine cpu: x86_64
      Program python3 found: YES (/usr/local/bin/python3.12)
      Compiler for C supports arguments -Wall: YES
      Compiler for C supports arguments -Warray-bounds: YES
      Compiler for C supports arguments -Wcast-align: YES
      Compiler for C supports arguments -Wconversion: YES
      Compiler for C supports arguments -Wextra: YES
      Compiler for C supports arguments -Wformat=2: YES
      Compiler for C supports arguments -Wformat-nonliteral: YES
      Compiler for C supports arguments -Wformat-security: YES
      Compiler for C supports arguments -Wimplicit-function-declaration: YES
      Compiler for C supports arguments -Winit-self: YES
      Compiler for C supports arguments -Winline: YES
      Compiler for C supports arguments -Wmissing-format-attribute: YES
      Compiler for C supports arguments -Wmissing-noreturn: YES
      Compiler for C supports arguments -Wnested-externs: YES
      Compiler for C supports arguments -Wold-style-definition: YES
      Compiler for C supports arguments -Wpacked: YES
      Compiler for C supports arguments -Wpointer-arith: YES
      Compiler for C supports arguments -Wreturn-type: YES
      Compiler for C supports arguments -Wshadow: YES
      Compiler for C supports arguments -Wsign-compare: YES
      Compiler for C supports arguments -Wstrict-aliasing: YES
      Compiler for C supports arguments -Wundef: YES
      Compiler for C supports arguments -Wunused-but-set-variable: YES
      Compiler for C supports arguments -Wswitch-default: YES
      Compiler for C supports arguments -Wno-missing-field-initializers: YES
      Compiler for C supports arguments -Wno-unused-parameter: YES
      Compiler for C supports arguments -fno-strict-aliasing: YES
      Compiler for C supports arguments -fvisibility=hidden: YES
      Found pkg-config: YES (/usr/bin/pkg-config) 1.8.1
      Did not find CMake 'cmake'
      Found CMake: NO
      Run-time dependency cairo found: NO (tried pkgconfig)

      ../cairo/meson.build:31:12: ERROR: Dependency "cairo" not found, tried pkgconfig

      A full log can be found at /tmp/pip-install-t3prz8p9/pycairo_19c76b7a535d4ba3b506b636c5a2a8a4/.mesonpy-3qkl9ko7/meson-logs/meson-log.txt
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

Workaround

sudo apt install --yes libcairo2-dev

libGL.so.1: cannot open shared object file: No such file or directory

Error

Traceback (most recent call last):
  File "/home/vscode/.local/bin/pc", line 5, in <module>
    from partcad_cli.click.command import cli
  File "/home/vscode/.local/lib/python3.12/site-packages/partcad_cli/click/command.py", line 3, in <module>
    import partcad as pc
  File "/home/vscode/.local/lib/python3.12/site-packages/partcad/__init__.py", line 1, in <module>
    from build123d import Location
  File "/home/vscode/.local/lib/python3.12/site-packages/build123d/__init__.py", line 3, in <module>
    from build123d.build_common import *
  File "/home/vscode/.local/lib/python3.12/site-packages/build123d/build_common.py", line 57, in <module>
    from build123d.geometry import Axis, Location, Plane, Vector, VectorLike
  File "/home/vscode/.local/lib/python3.12/site-packages/build123d/geometry.py", line 56, in <module>
    from OCP.Bnd import Bnd_Box, Bnd_OBB
ImportError: libGL.so.1: cannot open shared object file: No such file or directory

Workaround

sudo apt-get install libgl1-mesa-glx