'ImportError: cadquery was unable to determine freecad library path

I am trying to run code from this source. The code is written in python 2, so I am using virtual environment with anaconda. The code replies on rather old versions of cadquery 1.2.0, which I installed into conda environment using pip. I also installed FreeCAD with the procedure described in the this page. When I ran the coed I get the following error:

ImportError: cadquery was unable to determine freecad library path

The full output is:

  File "generate_hilbert_curve.py", line 18, in <module>
    import cadquery as cq
  File "/Users/vid/opt/anaconda3/envs/python2/lib/python2.7/site-packages/cadquery/__init__.py", line 2, in <module>
    from .freecad_impl.geom import Plane,BoundBox,Vector,Matrix,sortWiresByBuildOrder
  File "/Users/vid/opt/anaconda3/envs/python2/lib/python2.7/site-packages/cadquery/freecad_impl/__init__.py", line 153, in <module>
    path = _fc_path()
  File "/Users/vid/opt/anaconda3/envs/python2/lib/python2.7/site-packages/cadquery/freecad_impl/__init__.py", line 145, in _fc_path
    raise ImportError('cadquery was unable to determine freecad library path')
ImportError: cadquery was unable to determine freecad library path

What are potential sources of error and possible solutions?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source