aws-actions / setup-sam

Action to set up AWS SAM CLI and add it to the PATH
Apache License 2.0
151 stars 23 forks source link

setup-sam is failing; AttributeError: module '__main__' has no attribute '__file__' #40

Closed yskkin closed 2 years ago

yskkin commented 2 years ago
    ### snip
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-python@v2
        with:
          python-version: "3.8"
      - uses: aws-actions/setup-sam@v1
      - uses: aws-actions/configure-aws-credentials@v1
        with:
          aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
          aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
          aws-region: ${{ secrets.AWS_DEFAULT_REGION }}
      - run: sam validate
      ### snip

This workflow is starting to fail. It worked fine on 5 Jan 18:26+09:00. Rerunning same workflow against same commit fails on 6 Jan 11:28+09:00.

Run aws-actions/setup-sam@v1
/opt/hostedtoolcache/Python/3.8.12/x64/bin/python3 --version
Python 3.8.12
/opt/hostedtoolcache/Python/3.8.12/x64/bin/python3 -m venv /home/runner/work/_temp/setup-sam-eRWxCs/.venv
/home/runner/work/_temp/setup-sam-eRWxCs/.venv/bin/python -m pip install --upgrade pip
Requirement already satisfied: pip in /home/runner/work/_temp/setup-sam-eRWxCs/.venv/lib/python3.8/site-packages (21.1.1)
Collecting pip
  Downloading pip-21.3.1-py3-none-any.whl (1.7 MB)
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 21.1.1
    Uninstalling pip-21.1.1:
      Successfully uninstalled pip-21.1.1
Successfully installed pip-21.3.1
/home/runner/work/_temp/setup-sam-eRWxCs/.venv/bin/python -m pip install --upgrade setuptools wheel
Requirement already satisfied: setuptools in /home/runner/work/_temp/setup-sam-eRWxCs/.venv/lib/python3.8/site-packages (56.0.0)
Collecting setuptools
  Downloading setuptools-60.3.0-py3-none-any.whl (953 kB)
Collecting wheel
  Downloading wheel-0.37.1-py2.py3-none-any.whl (35 kB)
Installing collected packages: wheel, setuptools
  Attempting uninstall: setuptools
    Found existing installation: setuptools 56.0.0
    Uninstalling setuptools-56.0.0:
      Successfully uninstalled setuptools-56.0.0
Successfully installed setuptools-60.3.0 wheel-0.37.1
/home/runner/work/_temp/setup-sam-eRWxCs/.venv/bin/python -m pip install --upgrade aws-sam-cli==1.*
/home/runner/work/_temp/setup-sam-eRWxCs/.venv/bin/python: Error while finding module specification for 'pip' (AttributeError: module '__main__' has no attribute '__file__')
Error: The process '/home/runner/work/_temp/setup-sam-eRWxCs/.venv/bin/python' failed with exit code 1
Log for successful attempt ``` Run aws-actions/setup-sam@v1 /opt/hostedtoolcache/Python/3.8.12/x64/bin/python3 --version Python 3.8.12 /opt/hostedtoolcache/Python/3.8.12/x64/bin/python3 -m venv /home/runner/work/_temp/setup-sam-oxJIY4/.venv /home/runner/work/_temp/setup-sam-oxJIY4/.venv/bin/python -m pip install --upgrade pip Requirement already satisfied: pip in /home/runner/work/_temp/setup-sam-oxJIY4/.venv/lib/python3.8/site-packages (21.1.1) Collecting pip Downloading pip-21.3.1-py3-none-any.whl (1.7 MB) Installing collected packages: pip Attempting uninstall: pip Found existing installation: pip 21.1.1 Uninstalling pip-21.1.1: Successfully uninstalled pip-21.1.1 Successfully installed pip-21.3.1 /home/runner/work/_temp/setup-sam-oxJIY4/.venv/bin/python -m pip install --upgrade setuptools wheel Requirement already satisfied: setuptools in /home/runner/work/_temp/setup-sam-oxJIY4/.venv/lib/python3.8/site-packages (56.0.0) Collecting setuptools Downloading setuptools-60.2.0-py3-none-any.whl (953 kB) Collecting wheel Downloading wheel-0.37.1-py2.py3-none-any.whl (35 kB) Installing collected packages: wheel, setuptools Attempting uninstall: setuptools Found existing installation: setuptools 56.0.0 Uninstalling setuptools-56.0.0: Successfully uninstalled setuptools-56.0.0 Successfully installed setuptools-60.2.0 wheel-0.37.1 /home/runner/work/_temp/setup-sam-oxJIY4/.venv/bin/python -m pip install --upgrade aws-sam-cli==1.* Collecting aws-sam-cli==1.* Downloading aws_sam_cli-1.36.0-py3-none-any.whl (5.0 MB) Collecting cookiecutter~=1.7.2 Downloading cookiecutter-1.7.3-py2.py3-none-any.whl (34 kB) Collecting regex==2021.9.30 Downloading regex-2021.9.30-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (763 kB) Collecting tomlkit==0.7.2 Downloading tomlkit-0.7.2-py2.py3-none-any.whl (32 kB) Collecting tzlocal==3.0 Downloading tzlocal-3.0-py3-none-any.whl (16 kB) Collecting serverlessrepo==0.1.10 Downloading serverlessrepo-0.1.10-py2.py3-none-any.whl (23 kB) Collecting click~=7.1 Downloading click-7.1.2-py2.py3-none-any.whl (82 kB) Collecting aws-lambda-builders==1.9.0 Downloading aws_lambda_builders-1.9.0-py3-none-any.whl (102 kB) Collecting PyYAML~=5.3 Downloading PyYAML-5.4.1-cp38-cp38-manylinux1_x86_64.whl (662 kB) Collecting aws-sam-translator==1.42.0 Downloading aws_sam_translator-1.42.0-py3-none-any.whl (216 kB) Collecting chevron~=0.12 Downloading chevron-0.14.0-py3-none-any.whl (11 kB) Collecting boto3==1.*,>=1.18.32 Downloading boto3-1.20.28-py3-none-any.whl (131 kB) Collecting Flask~=1.1.2 Downloading Flask-1.1.4-py2.py3-none-any.whl (94 kB) Collecting docker~=4.2.0 Downloading docker-4.2.2-py2.py3-none-any.whl (144 kB) Collecting requests==2.25.1 Downloading requests-2.25.1-py2.py3-none-any.whl (61 kB) Collecting watchdog==2.1.2 Downloading watchdog-2.1.2-py3-none-manylinux2014_x86_64.whl (74 kB) Collecting jmespath~=0.10.0 Downloading jmespath-0.10.0-py2.py3-none-any.whl (24 kB) Collecting typing-extensions==3.10.0.0 Downloading typing_extensions-3.10.0.0-py3-none-any.whl (26 kB) Collecting dateparser~=1.0 Downloading dateparser-1.1.0-py2.py3-none-any.whl (288 kB) Collecting six~=1.11 Downloading six-1.16.0-py2.py3-none-any.whl (11 kB) Requirement already satisfied: wheel in /home/runner/work/_temp/setup-sam-oxJIY4/.venv/lib/python3.8/site-packages (from aws-lambda-builders==1.9.0->aws-sam-cli==1.*) (0.37.1) Requirement already satisfied: setuptools in /home/runner/work/_temp/setup-sam-oxJIY4/.venv/lib/python3.8/site-packages (from aws-lambda-builders==1.9.0->aws-sam-cli==1.*) (60.2.0) Collecting jsonschema~=3.2 Downloading jsonschema-3.2.0-py2.py3-none-any.whl (56 kB) Collecting s3transfer<0.6.0,>=0.5.0 Downloading s3transfer-0.5.0-py3-none-any.whl (79 kB) Collecting botocore<1.24.0,>=1.23.28 Downloading botocore-1.23.28-py3-none-any.whl (8.5 MB) Collecting certifi>=2017.4.17 Downloading certifi-2021.10.8-py2.py3-none-any.whl (149 kB) Collecting urllib3<1.27,>=1.21.1 Downloading urllib3-1.26.7-py2.py3-none-any.whl (138 kB) Collecting idna<3,>=2.5 Downloading idna-2.10-py2.py3-none-any.whl (58 kB) Collecting chardet<5,>=3.0.2 Downloading chardet-4.0.0-py2.py3-none-any.whl (178 kB) Collecting backports.zoneinfo Downloading backports.zoneinfo-0.2.1-cp38-cp38-manylinux1_x86_64.whl (74 kB) Collecting Jinja2<4.0.0,>=2.7 Downloading Jinja2-3.0.3-py3-none-any.whl (133 kB) Collecting poyo>=0.5.0 Downloading poyo-0.5.0-py2.py3-none-any.whl (10 kB) Collecting jinja2-time>=0.2.0 Downloading jinja2_time-0.2.0-py2.py3-none-any.whl (6.4 kB) Collecting binaryornot>=0.4.4 Downloading binaryornot-0.4.4-py2.py3-none-any.whl (9.0 kB) Collecting python-slugify>=4.0.0 Downloading python_slugify-5.0.2-py2.py3-none-any.whl (6.7 kB) Collecting pytz Downloading pytz-2021.3-py2.py3-none-any.whl (503 kB) Collecting python-dateutil Downloading python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB) Collecting websocket-client>=0.32.0 Downloading websocket_client-1.2.3-py3-none-any.whl (53 kB) Collecting Jinja2<4.0.0,>=2.7 Downloading Jinja2-2.11.3-py2.py3-none-any.whl (125 kB) Collecting itsdangerous<2.0,>=0.24 Downloading itsdangerous-1.1.0-py2.py3-none-any.whl (16 kB) Collecting Werkzeug<2.0,>=0.15 Downloading Werkzeug-1.0.1-py2.py3-none-any.whl (298 kB) Collecting MarkupSafe>=0.23 Downloading MarkupSafe-2.0.1-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (30 kB) Collecting arrow Downloading arrow-1.2.1-py3-none-any.whl (63 kB) Collecting pyrsistent>=0.14.0 Downloading pyrsistent-0.18.0-cp38-cp38-manylinux1_x86_64.whl (118 kB) Collecting attrs>=17.4.0 Downloading attrs-21.4.0-py2.py3-none-any.whl (60 kB) Collecting text-unidecode>=1.3 Downloading text_unidecode-1.3-py2.py3-none-any.whl (78 kB) Installing collected packages: six, urllib3, python-dateutil, jmespath, MarkupSafe, botocore, text-unidecode, s3transfer, pyrsistent, Jinja2, idna, chardet, certifi, backports.zoneinfo, attrs, arrow, Werkzeug, websocket-client, tzlocal, requests, regex, PyYAML, pytz, python-slugify, poyo, jsonschema, jinja2-time, itsdangerous, click, boto3, binaryornot, watchdog, typing-extensions, tomlkit, serverlessrepo, Flask, docker, dateparser, cookiecutter, chevron, aws-sam-translator, aws-lambda-builders, aws-sam-cli Successfully installed Flask-1.1.4 Jinja2-2.11.3 MarkupSafe-2.0.1 PyYAML-5.4.1 Werkzeug-1.0.1 arrow-1.2.1 attrs-21.4.0 aws-lambda-builders-1.9.0 aws-sam-cli-1.36.0 aws-sam-translator-1.42.0 backports.zoneinfo-0.2.1 binaryornot-0.4.4 boto3-1.20.28 botocore-1.23.28 certifi-2021.10.8 chardet-4.0.0 chevron-0.14.0 click-7.1.2 cookiecutter-1.7.3 dateparser-1.1.0 docker-4.2.2 idna-2.10 itsdangerous-1.1.0 jinja2-time-0.2.0 jmespath-0.10.0 jsonschema-3.2.0 poyo-0.5.0 pyrsistent-0.18.0 python-dateutil-2.8.2 python-slugify-5.0.2 pytz-2021.3 regex-2021.9.30 requests-2.25.1 s3transfer-0.5.0 serverlessrepo-0.1.10 six-1.16.0 text-unidecode-1.3 tomlkit-0.7.2 typing-extensions-3.10.0.0 tzlocal-3.0 urllib3-1.26.7 watchdog-2.1.2 websocket-client-1.2.3 ```
mr-randall commented 2 years ago

New version of setup tools appears to be cause. (https://setuptools.pypa.io/en/latest/history.html)

Update: More details in https://github.com/pypa/setuptools/issues/3002#issuecomment-1006266993

yskkin commented 2 years ago

Confirmed this is fixed by upstream change.