Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when importing cadquery: nptyping.error.InvalidArgumentsError #1046

Closed
njourdane opened this issue Apr 8, 2022 · 4 comments · Fixed by #1050
Closed

Error when importing cadquery: nptyping.error.InvalidArgumentsError #1046

njourdane opened this issue Apr 8, 2022 · 4 comments · Fixed by #1050

Comments

@njourdane
Copy link

njourdane commented Apr 8, 2022

When trying to import cadquery I get the following error:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File ".../cadquery/cadquery/__init__.py", line 14, in <module>
    from .occ_impl import exporters
  File ".../cadquery/cadquery/occ_impl/exporters/__init__.py", line 10, in <module>
    from ...cq import Workplane
  File ".../cadquery/cadquery/cq.py", line 61, in <module>
    from .sketch import Sketch
  File ".../cadquery/cadquery/sketch.py", line 28, in <module>
    from .occ_impl.sketch_solver import (
  File ".../cadquery/cadquery/occ_impl/sketch_solver.py", line 236, in <module>
    class SketchConstraintSolver(object):
  File ".../cadquery/cadquery/occ_impl/sketch_solver.py", line 265, in SketchConstraintSolver
    self, x0: Array[(Any,), float]
  File ".../cadquery/.venv/lib/python3.9/site-packages/nptyping/ndarray.py", line 73, in __getitem__
    shape_expression, dtype = _get_from_tuple(item)
  File ".../cadquery/.venv/lib/python3.9/site-packages/nptyping/ndarray.py", line 128, in _get_from_tuple
    raise InvalidArgumentsError(
nptyping.error.InvalidArgumentsError: Unexpected argument '(typing.Any,)', expecting Shape[<ShapeExpression>] or Literal[<ShapeExpression>]

I don't use Conda but pip, using the ocpvtk wheel I built yesterday, but someone else got the same error using Conda.

This error is really recent, because there was no problem to install and import cadquery yesterday.

So it's strange, because:

If I use the python cadquery venv I created yesterday I can import cadquery and import typish (without installing it manually). But if I create a new venv (using the same ocpvtk wheel), I get ModuleNotFoundError: No module named 'typish' when trying to import cadquery.

Then if I install typish module and try again, I get the error described above (the suspicious line in the stacktrace is here).

@njourdane
Copy link
Author

njourdane commented Apr 8, 2022

Ok, the issue appears because of the new release of np-typing (2.0) published yesterday.

I can fix the error with pip install 'nptyping<2'.

@sethfischer
Copy link
Contributor

A work-around until this is fixed in master. When following Command Line Installation, specify nptyping 1.4.4.

conda install -c cadquery -c conda-forge cadquery=master nptyping=1.4.4

@lorenzncode
Copy link
Member

Is it preferred to make changes to support nptyping v2.0.0?

@jmwright
Copy link
Member

@lorenzncode Supporting nptyping 2.x would probably be ideal, but we have to make sure that it doesn't cause problems anywhere else in CQ's dependency tree as well. If it does cause other problems, then we'll have to pin the version to 1.4.4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants