1

I am trying to setup AOSP VTS test on Windows. When installing, there is a pip_requirements.txt which tries to download the enum package which later will be installed during the test execution. When the test case is being run, there is an enum related issue that is causing the vts-run to fail. The error that comes during the test run is as shown below.

 ..\AppData\Local\Temp\pip-install-zp3vtjdn\enum\setup.py", line 24, in <module>
            version = main_module.__version__
        AttributeError: module 'enum' has no attribute '__version__'

Ref to the VTS test execution steps: https://codelabs.developers.google.com/codelabs/android-vts/index.html?index=..%2F..index#1

pip download -d %VTS_PYPI_PATH% -r pip_requirements.txt

NOTE: Even if the pip_requirements.txt is ignored, looks like the vts-tradefed application is going to install the enum and few other modules, which will still cause this issue. The application refers to a set of .jar files, whose source code confirms this. Also, to verify I tried running vts without downloading the modules using the above steps. But still got the same enum related error.

The property of the enum.__file__ is as shown below:

>python
Python 3.7.4 (tags/v3.7.4:e09359112e, Jul  8 2019, 20:34:20) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import enum
>>> print(enum.__file__)
C:\Python37\lib\enum.py

After some analysis, I found that the enum package that is being downloaded by the pip is downloading the following "https://pypi.org/project/enum/". This package has a enum.py too which is probably the reason for causing the attribute error:

AttributeError: module 'enum' has no attribute '__version__'

The PyPI page link mentions that:

Superseded by Python standard library.

Python 3 now has in its standard library an enum implementation (also available for older Python versions as the third-party enum34 distribution) that supersedes this library.

My understanding is: since the Python3 enum package superseeds the PyPI enum package, the Python3 enum package should be used instead of the PyPI enum package right?

Is my understanding right? If so, then how to achieve that? i.e. when pip tries to download/install the enum package, how to redirect it to use the Python3 enum pacakage and not use the enum package by PyPI?

Thanks in advance!!

AnkT
  • 11
  • 3
  • I'm not sure if running VTS on Windows is a good idea (but it may work - I don't know, actually I don't know anything about VTS). As AOSP development goes on Linux, I would recommend using Linux for all related things. Even on Linux conflicts often happen with tools versions, I guess for Windows it may be even worse. That's why Docker containers gain popularity, for CI tests and AOSP builds as well. So I would recommend running Linux in VM (Linux without GUI may be enough) on Windows, with a Docker container inside (for VTS tools itself). Or you may try Docker on Windows 10 – Mixaz Oct 11 '19 at 21:10

1 Answers1

0

The Python 3 Enum is not a drop-in replacement for the PyPI enum -- they have different APIs. If the package being installed really needs the PyPI version then the stdlib version won't work.

Ethan Furman
  • 63,992
  • 20
  • 159
  • 237