python 3.12?
same problem, here is answer gen by copilot
The error message indicates that the installation of the dtw package is failing because it cannot find the imp module. The imp module was deprecated in Python 3.4 and removed in Python 3.12. The dtw package likely has a dependency that still uses the imp module, which is causing the installation to fail.
To resolve this issue, you can try the following steps:
-
Check for an Updated Version: Ensure that you are trying to install the latest version of the
dtwpackage. The issue might have been fixed in a newer release. -
Use an Alternative Package: If the
dtwpackage is not actively maintained, consider using an alternative package that provides similar functionality. -
Modify the Package Source: If you need to use this specific package, you might need to download the source code, modify it to replace the usage of the
impmodule withimportlib, and then install it manually. -
Contact the Maintainer: Report the issue to the package maintainer so they can update the package to be compatible with Python 3.12.
For now, you can try installing an older version of Python (e.g., Python 3.10 or 3.11) where the imp module is still available, and then install the dtw package.
I encountered the same issue.
However, as far as I can tell from the source code, there’s no place where import imp is actually used.
This problem has been solved at #59
The problem seems to be that the version uploaded to PyPI only goes up to v1.4.0, while the current latest version v1.4.1 has not yet been published there:
https://pypi.org/project/dtw/#history
In the latest v1.4.1, the imp dependency has been removed.
As a result, it can be installed successfully even on Python 3.12.
I’ve confirmed that installation works correctly on my local environment (Python 3.12.10).
To install it, you can use the following command:
pip install "git+https://github.com/pollen-robotics/dtw"