iwatake2222 / rotop

top command for ROS 2

Home Page:https://pypi.org/project/rotop/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

top_runner.py: "object is not subscriptable" - Ubuntu 20.04.6 - ROS 2 Galactic

slowrunner opened this issue · comments

Using either

pip3 install rotop
...
Requirement already satisfied: six>=1.5 in /usr/lib/python3/dist-packages (from python-dateutil>=2.8.2->pandas->rotop) (1.14.0)
ERROR: pandas 2.0.3 has requirement numpy>=1.20.3; python_version < "3.10", but you'll have numpy 1.17.4 which is incompatible.
...

rotop

or git clone and python3 main.py

Error:

Traceback (most recent call last):
  File "main.py", line 14, in <module>
    from src.rotop import main
  File "/home/ubuntu/wali_desk/systests/rotop/src/rotop/__init__.py", line 14, in <module>
    from . import data_container
  File "/home/ubuntu/wali_desk/systests/rotop/src/rotop/data_container.py", line 17, in <module>
    import pandas as pd
  File "/home/ubuntu/.local/lib/python3.8/site-packages/pandas/__init__.py", line 22, in <module>
    from pandas.compat import is_numpy_dev as _is_numpy_dev  # pyright: ignore # noqa:F401
  File "/home/ubuntu/.local/lib/python3.8/site-packages/pandas/compat/__init__.py", line 16, in <module>
    from pandas._typing import F
  File "/home/ubuntu/.local/lib/python3.8/site-packages/pandas/_typing.py", line 139, in <module>
    np.random.BitGenerator,
AttributeError: module 'numpy.random' has no attribute 'BitGenerator'

after pip3 install --upgrade numpy:

$ pip3 list | grep numpy
numpy                                1.24.4   

$ dpkg -l | grep ros-galactic-desktop
ii  ros-galactic-desktop                                0.9.3-2focal.20221208.082310 


$ python3 main.py 
Traceback (most recent call last):
  File "main.py", line 14, in <module>
    from src.rotop import main
  File "/home/ubuntu/wali_desk/systests/rotop/src/rotop/__init__.py", line 14, in <module>
    from . import data_container
  File "/home/ubuntu/wali_desk/systests/rotop/src/rotop/data_container.py", line 19, in <module>
    from .top_runner import TopRunner
  File "/home/ubuntu/wali_desk/systests/rotop/src/rotop/top_runner.py", line 25, in <module>
    class TopRunner:
  File "/home/ubuntu/wali_desk/systests/rotop/src/rotop/top_runner.py", line 120, in TopRunner
    def get_row_start_list(lines: list[str])->list[int]:
TypeError: 'type' object is not subscriptable

Thank you for reporting the issue!
I have not tested it on Ubuntu 20.04.

The new version with bug fix has been released, and confirmed on Ubuntu 20.04 as well.
pip3 install rotop==1.0.4

However, the following command to upgrade dependent library is still needed.
pip3 install numpy -U

Phenomenal - Thanks - Got a new Create3 (ROS 2) robot that recommended Galactic/U20.04 so I started there.