symforce-org / symforce

Fast symbolic computation, code generation, and nonlinear optimization for robotics
https://symforce.org
Apache License 2.0
1.41k stars 145 forks source link

ModuleNotFoundError: No module named 'lcmtypes.sym' when importing Optimizer #239

Closed karl-rosaen-skydio closed 1 year ago

karl-rosaen-skydio commented 2 years ago

Describe the bug I'm running the code from the main tutorial and get an error during imports.

To Reproduce

python3.8 -m venv env
source env/bin/activate
pip install -e .
python
>>> import symforce
>>> symforce.get_symbolic_api()
'symengine'
>>> from symforce import cc_sym

so far so good, but when typing in the code from the main tutorial and running it, I get an error, which can be reproduced by

>>> from symforce.opt.optimizer import Optimizer
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/karlrosaen/dev/symforce/symforce/opt/optimizer.py", line 11, in <module>
    from lcmtypes.sym._index_entry_t import index_entry_t
ModuleNotFoundError: No module named 'lcmtypes.sym'

Expected behavior I'd expect to be able to import the module

Environment (please complete the following information):

aaron-skydio commented 2 years ago

Do you still see this on 48fd72d6244efbf10d06cd65ab24e6ea44c0c7da or later? I'm not entirely sure if this will be fixed by that or not

aaron-skydio commented 1 year ago

Confirmed this still exists, and will show up with pip install -e . (possibly only on setuptools >=64, not sure). This is because we install the lcmtypes in a custom addition to the InstallIWithExtras command in our setup.py when doing pip install .. For editable installs, this command does not run, but we have duplicated some of its functionality (namely the symengine_wrapper install) into the CMakeBuild command. We need to also do this for the lcmtypes.sym install.