uoip / g2opy

Python binding of SLAM graph optimization framework g2o
669 stars 177 forks source link

Can't import anything #30

Closed medakk closed 5 years ago

medakk commented 5 years ago

I installed g2o as per the instructions. Finally, I ran the setup code in a virtualenv:

(slam) $ python setup.py install
running install
copying ./lib/g2o.cpython-37m-x86_64-linux-gnu.so -> /home/karthik/.virtualenvs/slam/lib/python3.6/site-packages

When trying to use the library, I face the following problems:

1) If I am in the g2opy folder, I can import g2o, but there is nothing inside it:

In [1]: import g2o                                                                                                                                                                                          

In [2]: g2o.SparseOptimizer                                                                                                                                                                                 
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-2-d3a9f43dbd15> in <module>
----> 1 g2o.SparseOptimizer

AttributeError: module 'g2o' has no attribute 'SparseOptimizer'

In [3]: dir(g2o)                                                                                                                                                                                            
Out[3]: ['__doc__', '__loader__', '__name__', '__package__', '__path__', '__spec__']

Outside this folder, even the import fails. I can fix this by adding the g2opy folder to path. Is this needed to install the library?

medakk commented 5 years ago

Closing because this is the same issue was this.