CadQuery / ocp-build-system

A system to build Python wheel PyPI packages for OCP.
Apache License 2.0
8 stars 11 forks source link

cadquery-ocp overwrites vtkmodules #14

Closed akaszynski closed 3 weeks ago

akaszynski commented 1 year ago

Issue

Installing cadquery-ocp from PyPI silently overwrites vtkmodules, which might conflict with an existing installation of vtk. Here's a minimum working example that demonstrates this behavior:

$ python -m venv ocp-venv
$ source ocp-venv/bin/activate
$ pip install vtk==9.2.6
$ pip install cadquery-ocp==7.7.0
$ python -c "import vtk"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/tmp/ocp-venv/lib/python3.10/site-packages/vtk.py", line 5, in <module>
    from vtkmodules.vtkWebCore import *
ImportError: Initialization failed for vtkWebCore, not compatible with vtkmodules.vtkCommonCore

Suggested Resolution

Require vtk when installing cadquery-ocp. It seems you'll have to pin the version of vtk.

jmwright commented 1 year ago

We build and bundle VTK ourselves because the glibc version for the VTK package installed through pip is too new for many systems That's probably why this happens.

https://github.com/CadQuery/ocp-build-system/actions/runs/4286749530

I'm not sure of the best way to fix this.

jmwright commented 3 weeks ago

This should be fixed with cadquery-ocp 7.7.2.1. cadquery-vtk is a separate wheel now instead of being embedded. It should not silently overwrite the local vtkmodules, and if it does, you can pip uninstall cadquery-vtk and add the old VTK back.

https://pypi.org/project/cadquery-ocp/

Please reopen if the problem persists.