aws / porting-advisor-for-graviton

Apache License 2.0
159 stars 27 forks source link

setup-environment.sh isn't using python3.10 or higher even if it is available in PATH while creating PAG binary #32

Closed santosh-at-github closed 1 year ago

santosh-at-github commented 1 year ago

Describe the bug

While trying to create binary for the PAG, I get into errors. When I run "setup-environment.sh" in debug mode (bash -x), I see that it usages default Python version on the instance (python 3.9 in case of Amazon Linux 2023) even if a newer python version (3.11) is available in PATH.

Here is the error I am getting when I run the PAG binary:

[ec2-user@ip-172-31-30-166 porting-advisor-for-graviton]$ ./dist/porting-advisor-linux-x86_64 sample-projects/java-samples
Traceback (most recent call last):
  File "porting-advisor.py", line 23, in <module>
  File "advisor/__init__.py", line 26, in main
  File "PyInstaller/loader/pyimod02_importers.py", line 499, in exec_module
  File "advisor/main.py", line 28, in <module>
ModuleNotFoundError: No module named 'advisor.reports.report_factory'
[28175] Failed to execute script 'porting-advisor' due to unhandled exception!
[ec2-user@ip-172-31-30-166 porting-advisor-for-graviton]$

Expected behavior

setup-environment.sh should automatically identify python executable with version 3.10 or higher available in PATH or throw error if not found.

Steps to Reproduce

Steps to reproduce the behavior:

  1. Launch AL2023 instance using AMI ami-06ca3ca175f37dd66 in us-east-1 region.
  2. SSH to the instance and execute below commands
    sudo yum install python3.11 python3-pip java-11-amazon-corretto maven git -y
    pip3 install pip --upgrade
    git clone https://github.com/aws/porting-advisor-for-graviton.git
    cd porting-advisor-for-graviton
    ./build.sh
    ./dist/porting-advisor-linux-x86_64 
  3. The built binary throws error related to advisor while trying to execute it.
  4. And when I try to install advisor, it also throws error:
    AssertionError: Multiple .egg-info directories found

Screenshots

If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information)

Additional context

Add any other context about the problem here.

jamolina commented 1 year ago

Thanks for reaching out @santosh-at-github. We will review the issue and your PR and merge it after doing some tests and checks.

jamolina commented 1 year ago

Fixed by #33 . Thank you very much for your contribution!