adam icon indicating copy to clipboard operation
adam copied to clipboard

Incompatibility with Python 3.8: Use of Python 3.9+ type annotations (list[...], tuple[...]) leads to TypeError

Open johnny-ning opened this issue 6 months ago • 4 comments

Dear adam developers,

Thank you for your great work on the adam project! I am using adam together with legged_gym and followed the installation instructions that specify using Python 3.8.

However, when running the code, I encountered the following error:

TypeError: 'type' object is not subscriptable

This happened at this line:

def get_links(self) -> list[Link]:

It seems that recent versions of the codebase are using Python 3.9+ type annotations like list[...], tuple[...], which are not supported in Python 3.8. In Python 3.8, these should be replaced with the corresponding typing types, for example:

from typing import List
def get_links(self) -> List[Link]:

Could you please clarify:

1.Is Python 3.8 still officially supported?

2.If so, would it be possible to revert to Python 3.8-compatible type annotations (typing.List, typing.Tuple, etc.)?

3.Or should we upgrade to Python 3.9+ despite the current documentation?

Thank you very much for your help!

johnny-ning avatar Jul 11 '25 11:07 johnny-ning

In https://github.com/ami-iit/adam/pull/126 and https://github.com/conda-forge/adam-robotics-feedstock/pull/12 the minimum version was raised to 3.10, so I guess the docs are just outdated, probably we should also not refer to a EOL Ubuntu distro like 20.04 . Anyhow, I guess @Giulero can confirm this.

traversaro avatar Jul 11 '25 12:07 traversaro

Hi @johnny-ning! Thanks for opening the issue :) Yeah, as @traversaro mentioned, the documentation is outdated, and Python 3.8 is not supported anymore. I'll open a pr to update the docs!

Giulero avatar Jul 11 '25 12:07 Giulero

Hi @traversaro and @Giulero, thanks for your quick reply!

Since Python 3.8 is no longer supported in the latest version of adam, I'm wondering:

Is there a specific older release or commit of adam that is known to work with Python 3.8 (e.g., before list[...] and tuple[...] syntax was introduced)?

I would like to use adam together with Isaac Gym, which currently only supports Python 3.8. If there's a suitable past version (maybe a specific tag or commit), I’d be very grateful if you could point it out.

Thanks again for your support!

johnny-ning avatar Jul 12 '25 12:07 johnny-ning

Hi @johnny-ning! I see!

v0.3.2 should be compatible with Python 3.8 (v0.3.2 should be the release where we introduced the "new" type annotations). Could you double check? Thanks a lot!

Giulero avatar Jul 15 '25 08:07 Giulero