Registry / serialization / cadquery-ocp

cadquery-ocp

JSON →
library7.9.3.1.1pypypi✓ verified 25d ago

cadquery-ocp provides a low-level Python wrapper for the Open CASCADE Technology (OCCT) 3D geometry kernel, offering thin bindings to almost all OCCT C++ libraries. It is a fundamental dependency for the CadQuery parametric CAD framework and is regularly updated to react quickly to new OCCT releases. The current version is 7.9.3.1.

pip install cadquery-ocp
INSTALL
IMPORT
SIG · CADQUERY-OCP
C
cadquery-ocp
serializationpythonv7.9.3.1.1
Install
14.2s avg
Import
Disk
1019MB
Pass rate
5/ 10
Env Coverage5 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v7.9.3.1.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
build_error
glibc
py 3.103.95 runs
installs and imports cleanly · install 14.2s · import 0.000s · 1126.4MB
1019MB installed
● package 1019MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

BRepPrimAPI_MakeBox
from OCP.BRepPrimAPI import BRepPrimAPI_MakeBox
General pattern: `from OCP.ThePackageName import TheClassName` for direct OCCT API bindings.
gp_Pnt
from OCP.gp import gp_Pnt
General pattern: `from OCP.ThePackageName import TheClassName` for direct OCCT API bindings.

This quickstart demonstrates how to create a basic 3D shape (a box) directly using the low-level OCP bindings for the Open CASCADE Technology API. It imports specific classes like `BRepPrimAPI_MakeBox` and `gp_Pnt` from their respective OCP packages to construct the shape.

from OCP.BRepPrimAPI import BRepPrimAPI_MakeBox from OCP.gp import gp_Pnt # Create a 10x20x30mm box starting at (0,0,0) box_maker = BRepPrimAPI_MakeBox(gp_Pnt(0, 0, 0), 10.0, 20.0, 30.0) ocp_shape = box_maker.Shape() # The ocp_shape object can then be used by other OCP functions # or converted into a CadQuery object for higher-level operations. # Example (requires CadQuery): # import cadquery as cq # cq_box = cq.Shape.cast(ocp_shape) # print(cq_box.isValid()) print(f"Created OCP shape: {ocp_shape.__class__.__name__}")
Debug
Known issues
gotchaDirect usage of the OCP (OCCT C++ API) is significantly more verbose and complex than using higher-level libraries like CadQuery. It requires a strong understanding of the underlying Open CASCADE Technology C++ classes and concepts.
fix
For most parametric CAD tasks, it is recommended to use the CadQuery library (which builds on OCP) for a more Pythonic and fluent API. Only drop down to OCP when direct OCCT access is essential.
affects: All versions
gotchaInstallation via `pip` can sometimes encounter issues due to complex binary dependencies, especially on less common system configurations or Python versions. `conda` is often recommended for a more robust installation experience, particularly when also installing CadQuery.
fix
If `pip install cadquery-ocp` fails, try using `conda install -c conda-forge -c cadquery ocp`. Ensure your Python environment meets the required versions.
affects: All versions
gotchaThe `cadquery-ocp` library has specific Python version requirements (>=3.10, <3.15 for version 7.9.3.1). Installing with an incompatible Python version will lead to installation failures or runtime errors.
fix
Ensure you are using a compatible Python version, e.g., Python 3.10, 3.11, 3.12, or 3.13 for OCP 7.9.3.1. It is highly recommended to use a virtual environment.
affects: All versions of `cadquery-ocp` (check `requires_python` in PyPI)
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'OCP'
The Python interpreter cannot find the 'OCP' module, which is the primary import name for the cadquery-ocp library, often due to an incomplete installation, an incorrect Python environment, or an incompatible Python version.
fix
Ensure `cadquery-ocp` is correctly installed in your active Python environment, typically by running `pip install cadquery-ocp` or, for more robust dependency management, `mamba install -c conda-forge -c cadquery cadquery-ocp` if using Conda/Mamba. Verify that your Python version is supported (e.g., Python 3.9 through 3.12 for recent versions of cadquery-ocp).
ERROR: No matching distribution found for cadquery-ocp
This error occurs during pip installation when PyPI does not have a pre-compiled binary wheel of cadquery-ocp compatible with your specific operating system, Python version, and sometimes glibc version on Linux.
fix
Try using the Conda/Mamba package manager, which often provides more robust binary distributions for complex packages like cadquery-ocp: `mamba install -c conda-forge -c cadquery cadquery-ocp`. Alternatively, check the cadquery-ocp PyPI page for supported Python versions and platforms, and consider trying a different Python version if yours is not supported.
ImportError: DLL load failed while importing OCP: The specified module could not be found.
This is a Windows-specific error indicating that a Dynamic Link Library (DLL) that cadquery-ocp depends on (part of the underlying Open CASCADE Technology C++ library) cannot be found by the Python interpreter.
fix
Ensure that all required Visual C++ Redistributables are installed on your system. Sometimes, a fresh installation in a clean virtual environment or using Conda/Mamba (`mamba install -c conda-forge -c cadquery cadquery-ocp`) can resolve this by providing all necessary dependencies. If installing locally, ensure the relevant DLLs are in your system PATH or accessible to the Python environment.
ImportError: libGL.so.1: cannot open shared object file: No such file or directory
This is a Linux-specific error where the `cadquery-ocp` library, or its underlying OCCT components, requires OpenGL libraries (specifically `libGL.so.1`) for graphical operations, but these libraries are not found on the system.
fix
Install the necessary OpenGL development libraries for your Linux distribution. For Debian/Ubuntu-based systems, use `sudo apt-get install libgl1-mesa-glx` (or `libgl1-mesa-dev`). For Fedora/RHEL-based systems, use `sudo dnf install mesa-libGL-devel` (or `sudo yum install mesa-libGL-devel`).
error: command 'gcc' failed with exit status 1
`cadquery-ocp` attempted to compile from source because a pre-built wheel was unavailable for your system, and essential C++ development tools were missing or improperly configured.
fix
The most reliable fix is often to use `conda` or `mamba`, which provides pre-compiled binaries: `conda install -c cadquery cadquery-ocp`. Alternatively, install essential build tools for your operating system (e.g., `sudo apt-get install build-essential` on Debian/Ubuntu, or Xcode Command Line Tools on macOS) before attempting `pip install cadquery-ocp`.
Upgrade
Version history
7.9.3.1.1latest on PyPI · released May 28, 2026
Audit
Dependencies
CadQueryoptionalOCP is the underlying binding for the CadQuery library, which provides a more user-friendly 'fluent API' for parametric CAD. While OCP can be used independently, its primary use case is with CadQuery.
Open CASCADE Technology (OCCT)requiredOCP is a direct Python binding for the C++ OCCT library; extensive knowledge of OCCT's C++ API is often required for direct OCP usage.
VTKoptionalSome `cadquery-ocp` wheels are built with VTK support, which may be implicitly included depending on the installation method and platform.
Agent activity
74 hits · last 30 days
node
72
OpenAI (training)
1
Resources
cadquery-ocp — pip install cadquery-ocp · libregistry