# Actions/setup-python caching

**URL:** <https://forum.gitea.com/t/actions-setup-python-caching/7773>\
**Category:** Actions\
**Created:** [August 24, 2023, 5:38am UTC](https://forum.gitea.com/t/actions-setup-python-caching/7773 "2023-08-24T05:38:13Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Feelinglight](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/feelinglight/32/3996_2.png) [@Feelinglight](https://forum.gitea.com/u/Feelinglight)\
**Post date:** [August 24, 2023, 5:38am UTC](https://forum.gitea.com/t/actions-setup-python-caching/7773/1 "2023-08-24T05:38:13Z")

</div>

Hello.  
Please help me to understand the behavior of Gitea Actions.  
I have run the runner in docker and it works correctly.

```bash
sudo docker run --restart always \
    -v $(pwd)/config/config.yaml:/config.yaml \.
    -v $(pwd)/data:/data \.
    -v /var/run/docker.sock:/var/run/docker.sock \.
    --env-file="$(pwd)/.env" \
    -p 8088:8088 \
    -e CONFIG_FILE=/config.yaml \.
    -e GITEA_RUNNER_NAME="VM runner" \
    --name gitea_runner.
    -d gitea/act_runner:latest.

```

I have enabled the cache as described in the documentation ([Act Runner | Gitea Documentation](https://docs.gitea.com/usage/actions/act-runner#configuring-cache-when-starting-a-runner-using-docker-image)) and **actions/cache** is also working correctly.

The problem is that some actions such as **setup-python** download their artifacts every time.  
**setup-python** loads the tar.gz archive into the **/opt/hostedtoolcache** folder on the runner.  
This folder is specified in the environment variables of the running runners (e.g., `RUNNER_TOOL_CACHE`)

But every time action runs, new docker runner starts and this folder is empty. So, setup-python downloads the archive again.

Is there a possibility to cache the **/opt/hostedtoolcache** folder?

Also, if i specify cache flag:

```bash
- name: Set up Python 3.x
  uses: actions/setup-python@v4
  with:
    python-version: '3.7.17'
    architecture: 'x64'
    cache: 'pip'

```

runner downloads packages to the **/root/.cache/pip** folder, but this folder also remains only in the runner on which **setup-python** was run and subsequent runs install the dependencies again.
