Open dellaert opened 1 month ago
Actually, even after disabling the stub generation, the library installs fine but the same circular import
issue remains:
(py310) (base) macbook-pro-8:github dellaert$ /Users/dellaert/miniforge3/envs/py310/bin/python /Users/dellaert/git/github/python/gtsam/tests/test_Pose3.py
Traceback (most recent call last):
File "/Users/dellaert/git/github/python/gtsam/tests/test_Pose3.py", line 16, in <module>
from gtsam.utils.test_case import GtsamTestCase
File "/Users/dellaert/.local/lib/python3.10/site-packages/gtsam/__init__.py", line 9, in <module>
from gtsam import gtsam, utils
ImportError: cannot import name 'gtsam' from partially initialized module 'gtsam' (most likely due to a circular import) (/Users/dellaert/.local/lib/python3.10/site-packages/gtsam/__init__.py)
Did something about this change in the last PRs? It's weird as it still works in CI. I remember that this circular thing was an issue a long time ago, but it's weird it pops up again now.
ls /Users/dellaert/.local/lib/python3.10/site-packages/gtsam
Data examples imuBias.py tests
__init__.py gtsam.cpython-312-darwin.so noiseModel.py utils
__pycache__ gtsfm.py symbol_shorthand.py
Seems the .so file was built for 3.12, but I made sure all cmake versions where 3.10... Does this ring a possible bell, @varunagrawal ?
Check the GTSAM_PYTHON_VERSION and Cmake variables for the Python version in general. This looks like it is being set to different things in different variables.
This issue has bitten me before as well but it's a simple manual change hence I never tried to fix it.
They are all 3.10
And, I did:
cmake -DPYTHON_EXECUTABLE=/Users/dellaert/miniforge3/envs/py310/bin/python ..
And it installs in right directory. But somehow something is generating 3.12 binaries?
It works in a conda 3.12 environment (again with custom cmake)
@dellaert I assume you nuked the entire build folder right? Could you paste your cmake
log here?
Did you give it a try on Ubuntu with 3.10?
PS Should CI not test all python versions we support? It should also test that cmake works out of the box in a conda or virtualenv…
I could do a quick test with a devcontainer…
I can test with a Docker in a sec
I am in a python3 conda environment, on MacOS 14.6.1,
(py310) (base) macbook-pro-8:build dellaert$ python --version Python 3.10.14