spatialmath-python icon indicating copy to clipboard operation
spatialmath-python copied to clipboard

Spatialmath import broken

Open max99689 opened this issue 3 years ago • 9 comments

Trying to import the "base" attribute of the "spatialmath" module gives me an error message. I am trying to import it using the following statement at the beginning of a jupyter notebook: import spatialmath.base as tr

The error message is: `--------------------------------------------------------------------------- AttributeError Traceback (most recent call last) in ----> 1 import spatialmath.base

~/test_prep_sem_3/viewpoints_generation/automated-part-inspection/.venv/lib/python3.6/site-packages/spatialmath/init.py in ----> 1 from spatialmath.pose2d import SO2, SE2 2 from spatialmath.pose3d import SO3, SE3 3 from spatialmath.baseposematrix import BasePoseMatrix 4 from spatialmath.geom2d import Line2, Polygon2 5 from spatialmath.geom3d import Line3, Plane3

~/test_prep_sem_3/viewpoints_generation/automated-part-inspection/.venv/lib/python3.6/site-packages/spatialmath/pose2d.py in 24 import numpy as np 25 ---> 26 from spatialmath.base import argcheck 27 from spatialmath import base as base 28 from spatialmath.baseposematrix import BasePoseMatrix

~/test_prep_sem_3/viewpoints_generation/automated-part-inspection/.venv/lib/python3.6/site-packages/spatialmath/base/init.py in 6 from spatialmath.base.quaternions import * # lgtm [py/polluting-import] 7 from spatialmath.base.transforms2d import * # lgtm [py/polluting-import] ----> 8 from spatialmath.base.transforms3d import * # lgtm [py/polluting-import] 9 from spatialmath.base.transformsNd import * # lgtm [py/polluting-import] 10 from spatialmath.base.vectors import * # lgtm [py/polluting-import]

~/test_prep_sem_3/viewpoints_generation/automated-part-inspection/.venv/lib/python3.6/site-packages/spatialmath/base/transforms3d.py in 22 23 from spatialmath import base as smb ---> 24 import spatialmath.base.symbolic as sym 25 26 _eps = np.finfo(np.float64).eps

AttributeError: module 'spatialmath' has no attribute 'base'`

max99689 avatar Jun 02 '22 07:06 max99689

Some more information about the issue above:

  • the error only appears on Linux (Ubuntu 18.04 LTS with Python 3.6.9)
  • it is working with Windows 10 and Python 3.9.2

max99689 avatar Jun 02 '22 12:06 max99689

@max99689 Did you try the latest version of the master branch? It should be fixed in 87cabfe.

StephLin avatar Jun 04 '22 06:06 StephLin

Is this resolved?

petercorke avatar Jun 12 '22 01:06 petercorke

Installing it using pip still results in the same error, but including the files from the master branch of the repository fixes the issue.

max99689 avatar Jun 13 '22 06:06 max99689

I had the same problem

Gaspard-Bourgeois avatar Jun 24 '22 14:06 Gaspard-Bourgeois

Do you have the same setup as @max99689 ?

petercorke avatar Jun 25 '22 00:06 petercorke

To be exact, we tried with 3 differents computers configured in Ubuntu 18.04 LTS with Python 3.6.9, it was not working even in a venv environment. And eveything was fine in Ubuntu 20.04 LTS with Python3.8

Gaspard-Bourgeois avatar Jun 25 '22 07:06 Gaspard-Bourgeois

Installing it using pip still results in the same error, but including the files from the master branch of the repository fixes the issue.

I think the issue here is not complicated. The current master branch already contains the patch #53 that should resolve the import problem, but the current version on pypi doesn't yet.

In my opinion, maybe publishing a new version to pypi can make users easier to use this project with Python 3.6.

StephLin avatar Jul 17 '22 13:07 StephLin

Running into this problem with 3.6 on ubuntu 20.04. Agree with @StephLin that the PyPI package needs updating

CallumJHays avatar Sep 19 '22 03:09 CallumJHays

sorry to have been slow here. A version of current master branch is now on PyPI.

petercorke avatar Oct 09 '22 11:10 petercorke