michaelgale / cq-gridfinity

A python library to build parameterized gridfinity compatible objects such a baseplates and boxes.
MIT License
72 stars 5 forks source link

Add dependency `cadquery` to `setup.py` #2

Closed sethfischer closed 8 months ago

sethfischer commented 8 months ago

Add dependency cadquery to setup.py to avoid the following error after installation.

$ gridfinitybox 
Traceback (most recent call last):
  File "/home/user/.cache/pypoetry/virtualenvs/gridfinity-builds-BcGLuRFC-py3.9/bin/gridfinitybox", line 5, in <module>
    from cqgridfinity.scripts.gridfinitybox import main
  File "/home/user/.cache/pypoetry/virtualenvs/gridfinity-builds-BcGLuRFC-py3.9/lib/python3.9/site-packages/cqgridfinity/__init__.py", line 15, in <module>
    from .gf_obj import GridfinityObject
  File "/home/user/.cache/pypoetry/virtualenvs/gridfinity-builds-BcGLuRFC-py3.9/lib/python3.9/site-packages/cqgridfinity/gf_obj.py", line 28, in <module>
    from OCP.BRepMesh import BRepMesh_IncrementalMesh
ModuleNotFoundError: No module named 'OCP'

Installed from PyPI with poetry add cqgridfinity:

$ poetry add cqgridfinity
The currently activated Python version 3.8.10 is not supported by the project (^3.9).
Trying to find and use a compatible version. 
Using python3.9 (3.9.5)
Creating virtualenv gridfinity-builds-BcGLuRFC-py3.9 in /home/user/.cache/pypoetry/virtualenvs
Using version ^0.3.0 for cqgridfinity

Updating dependencies
Resolving dependencies... (1.6s)

Package operations: 2 installs, 0 updates, 0 removals

  • Installing cqkit (0.5.3)
  • Installing cqgridfinity (0.3.0)
OmarAlKhamis commented 8 months ago

Having the same issue here

michaelgale commented 8 months ago

Although I could add a dependency for cadquery for cqgridfinity, it is assumed that you have a working CadQuery environment already. Unlike cqkit and other "pure" python packages which can be installed with pip or from source, CadQuery has binary dependencies which are specific to your platform/OS. Therefore, they need to be installed either manually (compiling from source) or using conda. Adding the cadquery dependency to cqgridifinity will just be a formality and will simply indicate whether you have a working CadQuery install; however it cannot perform that installation using the normal pip triggered dependency resolution.

michaelgale commented 8 months ago

I've added the CadQuery dependency to setup.py. This will trip any installation attempts which do not have CQ installed (hopefully!).