Skip to content

Cache location /home/ubuntu/.cache/pypoetry/virtualenvs invalid when virtualenvs.create = false #1077

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
2 of 5 tasks
pascalgulikers opened this issue Apr 7, 2025 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@pascalgulikers
Copy link

Description:
The post step throws "Error: Cache folder path is retrieved for poetry but doesn't exist on disk: /home/ubuntu/.cache/pypoetry/virtualenvs. This likely indicates that there are no dependencies to cache. Consider removing the cache step if it is not needed."

But I've specified virtualenvs.create = false

Action version:
v5.5.0

Platform:

  • Ubuntu
  • macOS
  • Windows

Runner type:

  • Hosted
  • Self-hosted

Tools version:
3.13

Repro steps:
Run snok/install-poetry@v1.4.1
with:
version: 1.8.5
virtualenvs-create: false
virtualenvs-in-project: false
installer-parallel: true
virtualenvs-path: {cache-dir}/virtualenvs
env:
GITHUB_TOKEN: ***
VENV: .venv/bin/activate

Run actions/setup-python@v5
with:
python-version: 3.13
cache: poetry
check-latest: false
token: ***
update-environment: true
allow-prereleases: false
freethreaded: false
env:
GITHUB_TOKEN: ***
VENV: .venv/bin/activate

Expected behavior:
To succesfully install Python 3.13 with poetry as cache

Actual behavior:

Installed versions
Version 3.13 was not found in the local cache
Version 3.13 is available for downloading
Download from "https://github.com/actions/python-versions/releases/download/3.13.2-13708744326/python-3.13.2-linux-22.04-x64.tar.gz"
Extract downloaded archive
/usr/bin/tar xz --warning=no-unknown-keyword --overwrite -C /home/ubuntu/_work/_temp/*** -f /home/ubuntu/_work/_temp/***
Execute installation script
Check if Python hostedtoolcache folder exist...
Creating Python hostedtoolcache folder...
Create Python 3.13.2 folder
Copy Python binaries to hostedtoolcache folder
Create additional symlinks (Required for the UsePythonVersion Azure Pipelines task and the setup-python GitHub Action)
Upgrading pip...
Looking in links: /tmp/tmpiw8601l3
Requirement already satisfied: pip in /home/ubuntu/_work/_tool/Python/3.13.2/x64/lib/python3.13/site-packages (24.3.1)
Collecting pip
Downloading pip-25.0.1-py3-none-any.whl.metadata (3.7 kB)
Downloading pip-25.0.1-py3-none-any.whl (1.8 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.8/1.8 MB 58.6 MB/s eta 0:00:00

Installing collected packages: pip
Attempting uninstall: pip
Found existing installation: pip 24.3.1
Uninstalling pip-24.3.1:
Successfully uninstalled pip-24.3.1
Successfully installed pip-25.0.1
Create complete file
Successfully set up CPython (3.13.2)
/home/ubuntu/.local/bin/poetry config --list
cache-dir = "/home/ubuntu/.cache/pypoetry"
experimental.system-git-client = false
installer.max-workers = null
installer.modern-installation = true
installer.no-binary = null
installer.parallel = true
keyring.enabled = true
solver.lazy-wheel = true
virtualenvs.create = false
virtualenvs.in-project = false
virtualenvs.options.always-copy = false
virtualenvs.options.no-pip = false
virtualenvs.options.no-setuptools = false
virtualenvs.options.system-site-packages = false
virtualenvs.path = "{cache-dir}/virtualenvs" # /home/ubuntu/.cache/pypoetry/virtualenvs
virtualenvs.prefer-active-python = false
virtualenvs.prompt = "{project_name}-py{python_version}"
warnings.export = true
/home/ubuntu/.local/bin/poetry env use /home/ubuntu/_work/_tool/Python/3.13.2/x64/bin/python
Skipping virtualenv creation, as specified in config file.

[Errno 2] No such file or directory: '/home/ubuntu/.cache/pypoetry/virtualenvs/envs.toml'
Warning: Skipping virtualenv creation, as specified in config file.

[Errno 2] No such file or directory: '/home/ubuntu/.cache/pypoetry/virtualenvs/envs.toml'

poetry cache is not found

Post job cleanup.
Post job cleanup.
Error: Cache folder path is retrieved for poetry but doesn't exist on disk: /home/ubuntu/.cache/pypoetry/virtualenvs. This likely indicates that there are no dependencies to cache. Consider removing the cache step if it is not needed.

@pascalgulikers pascalgulikers added bug Something isn't working needs triage labels Apr 7, 2025
@priyagupta108
Copy link
Contributor

Hello @pascalgulikers 👋,
Thank you for your report. We'll investigate the issue and get back to you with the details!

@chiranjib-swain
Copy link

Hello @pascalgulikers 👋,

The error logs and your workflow configuration indicate that the issue is due to a missing Poetry cache directory (/home/ubuntu/.cache/pypoetry/virtualenvs) and If the virtualenvs.create is set to false and there is no active virtual environment, Poetry will install dependencies directly into the system's Python environment instead of creating a virtual environment. As a result, there will be no .cache/pypoetry/virtualenvs directory.

To fix this:

1. Enable Virtual Environments:

Set virtualenvs.create = true in your Poetry configuration. This will ensure dependencies are installed in an isolated environment, avoiding conflicts with the global/system Python environment.
For more details, refer to the Poetry documentation.

2. Remove Caching Step if No Dependencies Exist:

Remove the cache: poetry line from the actions/setup-python@v5 action if the toml file doesn't contain any dependencies. If there are no dependencies, the cache directory won't be used, so caching is unnecessary.

These changes should resolve the error and allow the workflow to run smoothly.
Please let us know if you encounter any further issues.

@chiranjib-swain
Copy link

Hello @pascalgulikers 👋,

This is a gentle reminder to check if there are any updates on this issue. Please let me know if you need any further assistance.
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants