# Gitea Actions with Python

**URL:** <https://forum.gitea.com/t/gitea-actions-with-python/7605>\
**Category:** Actions\
**Created:** [July 23, 2023, 6:14pm UTC](https://forum.gitea.com/t/gitea-actions-with-python/7605 "2023-07-23T18:14:09Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Borzoff](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/borzoff/32/3908_2.png) [@Borzoff](https://forum.gitea.com/u/Borzoff)\
**Post date:** [July 23, 2023, 6:14pm UTC](https://forum.gitea.com/t/gitea-actions-with-python/7605/1 "2023-07-23T18:14:09Z")

</div>

Hello, I use actions to test the project on python, I used to do it through github, but when I transferred to gitea and add to actions:

```auto
uses: https:/github.com/actions/setup-python@v4
      with:
        python-version: "3.11"

```

I have a mistake:

The version ‘3.11’ with architecture ‘x64’ was not found for this operating system. %0AThe list of all available versions can be found here: [https://raw.githubusercontent.com/actions/python-versions/mainversions-manifest.json](https://raw.githubusercontent.com/actions/python-versions/mainversions-manifest.json)

Whole YML file:

```auto
name: Lint and check types

on: [push, pull_request]

jobs:
  build:
    runs-on: ubuntu-20.04
    
    steps:
    - uses: actions/checkout@v3
    - name: Set up Python 3.11
      uses: https://github.com/actions/setup-python@v4
      with:
        python-version: "3.11"
  
    - name: Install poetry
      run: |
        pip install pipx
        pipx install poetry        

    - name: Validate the structure of the pyproject.toml
      run: |
        poetry check        

    - name: Verify that poetry.lock is consistent with pyproject.toml
      run: |
        poetry lock --check        
    
    - name: Install dependencies
      run: |
        poetry install        

    - name: Check code formatting by black
      run: |
        poetry run black . --check
                
    - name: Lint code by ruff
      run: |
        poetry run ruff .
                
    - name: Check types by pyright
      run: |
        poetry run pyright        

```

---

<div class="post-metadata">

**Author:** ![dR3b](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/dr3b/32/3913_2.png) [@dR3b](https://forum.gitea.com/u/dR3b)\
**Post date:** [July 24, 2023, 1:28pm UTC](https://forum.gitea.com/t/gitea-actions-with-python/7605/2 "2023-07-24T13:28:58Z")

</div>

I got the same error with “setup-python@v4”.  
A local build with: “act” runs without problems!

```auto
act -j build

```

```auto
[build/build] ✅ Success - Main Test sphinx-build
[build/build] ⭐ Run Post Set up Python 3.11
[build/build] 🐳 docker exec cmd=[node /var/run/act/actions/actions-setup-python@v4/dist/cache-save/index.js] user= workdir=
[build/build] ✅ Success - Post Set up Python 3.11
[build/build] 🏁 Job succeeded

```

---

<div class="post-metadata">

**Author:** ![dbischof90](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/dbischof90/32/3917_2.png) [@dbischof90](https://forum.gitea.com/u/dbischof90)\
**Post date:** [July 26, 2023, 1:03pm UTC](https://forum.gitea.com/t/gitea-actions-with-python/7605/3 "2023-07-26T13:03:34Z")

</div>

Did you figure this out? I have the exact same problem.

---

<div class="post-metadata">

**Author:** ![OfficialBoyfriend](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/officialboyfriend/32/3925_2.png) [@OfficialBoyfriend](https://forum.gitea.com/u/OfficialBoyfriend)\
**Post date:** [July 27, 2023, 4:30pm UTC](https://forum.gitea.com/t/gitea-actions-with-python/7605/4 "2023-07-27T16:30:25Z")

</div>

```auto
name: Django CI

on:
  push:
    branches: ["dev"]

jobs:
  ProjectTest:
    runs-on: ubuntu-latest
    container: catthehacker/ubuntu:act-latest
    steps:
      - uses: actions/checkout@v3
      - name: Set up Python 3.10
        uses: actions/setup-python@v3
        with:
          python-version: "3.10.12"

```

As shown above, add `container: catthehacker/ubuntu:act-latest` and try again. This works for me.

---

<div class="post-metadata">

**Author:** ![dbischof90](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/dbischof90/32/3917_2.png) [@dbischof90](https://forum.gitea.com/u/dbischof90)\
**Post date:** [July 29, 2023, 7:02am UTC](https://forum.gitea.com/t/gitea-actions-with-python/7605/5 "2023-07-29T07:02:52Z")

</div>

„Just use another image“ is a pragmatic solution but I’d like to understand the issue behind it. What goes on there?

---

<div class="post-metadata">

**Author:** ![abrezn-c](https://avatars.discourse-cdn.com/v4/letter/a/cdc98d/32.png) [@abrezn-c](https://forum.gitea.com/u/abrezn-c)\
**Post date:** [January 18, 2024, 5:56pm UTC](https://forum.gitea.com/t/gitea-actions-with-python/7605/6 "2024-01-18T17:56:58Z")

</div>

i’m setting up Gitea and having the same issue when using setup-python.  
simply switching to use the catthehacker image does work. but i’m unsatisfied not knowing why. i’ve tried a large variety of variants attempting to replicate creating it but have failed every time.

could someone please help explain how this catthehacker image is provisioned to make it work?

---

<div class="post-metadata">

**Author:** ![ravenouse](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/ravenouse/32/6720_2.png) [@ravenouse](https://forum.gitea.com/u/ravenouse)\
**Post date:** [March 3, 2025, 8:54pm UTC](https://forum.gitea.com/t/gitea-actions-with-python/7605/7 "2025-03-03T20:54:04Z")

</div>

You can also install the python via Alpine package manager. This method works for me.

```yml
name: Gitea CI

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

jobs:
  test:
    runs-on: practice-runner
    steps:
      - uses: actions/checkout@v4
      
      - name: Set up Python and run all tests
        run: |
          # Set up Python and venv
          apk add --no-cache python3 py3-pip
          python3 -m venv /tmp/venv
          . /tmp/venv/bin/activate
          
          # Install dependencies
          python -m pip install --upgrade pip
          pip install -r requirements.txt
          pip install -r requirements-dev.txt
          
          # Run linting
          flake8 .
          
          # Run tests
          pytest

```

---

<div class="post-metadata">

**Author:** ![lunny](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/lunny/32/4701_2.png) [@lunny](https://forum.gitea.com/u/lunny)\
**Post date:** [March 17, 2025, 6:06am UTC](https://forum.gitea.com/t/gitea-actions-with-python/7605/8 "2025-03-17T06:06:15Z")

</div>

Closed on March 17, 2025, 6:06am UTC


