question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Python Action not supported

See original GitHub issue

I see in the README example how to install Python “manually”, but there’s a GH action setup-python already built for installing Python that seems recommended.

I was trying this out with the cml docker container, and there seems to be an odd interaction between the docker container and setup-python.

For example, if I’m not using our docker container and run this workflow:

name: your-workflow-name

on: [push]

jobs:
  run:
    runs-on: [ubuntu-latest]
    container: docker://dvcorg/dvc-cml:latest

    steps:
      - uses: actions/checkout@v2
      
      - name: Set up Python
        uses: actions/setup-python@v1
        with:
          python-version: '3.x'
          
      - name: Display Python version
        run: python -c "import sys; print(sys.version)"
      
      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip 
          pip install sklearn

Everything runs beautifully. As soon as I add container: docker://dvcorg/dvc-cml:latest to the .yaml file, though, I hit the following error:

image

Any ideas?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:13 (13 by maintainers)

github_iconTop GitHub Comments

5reactions
jbencookcommented, Jul 28, 2020

I got this working with the dvcorg/cml:latest image. By default, the container service mounts /opt/hostedtoolcache to /__t in the container, but that breaks the Python installs which are compiled to live in /opt/hostedtoolcache specifically.

But the container syntax lets you add mounted volumes. Here’s a workflow file that worked for me:

name: test-setup-python

on: [push]

jobs:
  run:
    runs-on: [ubuntu-latest]
    container:
      image: docker://dvcorg/cml:latest
      volumes:
        - /opt/hostedtoolcache:/opt/hostedtoolcache

    steps:
      - uses: actions/checkout@v2
      
      - name: Set up Python
        uses: actions/setup-python@v1
        with:
          python-version: '3.x'
          
      - name: Display Python version
        run: python -c "import sys; print(sys.version)"
      
      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip 
          pip install sklearn

It also works with setup-python@v2 and it works on a self-hosted runner. I’m pretty sure the base image will need to be Ubuntu 18.04, but it looks like all your images are so that wouldn’t be a problem.

IMO this is better than shipping with your own Python because matrix testing works and it would make CML workflows more similar to other GitHub Actions setups. I’m happy to help with PRs to update examples if you think this is useful.

NOTE: to get it to work in a self-hosted runner, I added AGENT_TOOLSDIRECTORY=/opt/hostedtoolcache/ to my .env file.

2reactions
jbencookcommented, Jul 29, 2020

Every combination I can think of works as expected (except setup-python@v1 inside the docker runner, which was already true). Also, I can’t think of any reason why this would be a problem:

  • Anything expected to be in /__t in the container will still be there
  • Everything in that directory comes from /opt/hostedtoolcacne on the host anyway
  • You’re not even adding any significant storage to the container

I say 🚢 !

Read more comments on GitHub >

github_iconTop Results From Across the Web

Github action using wrong version of Python - Stack Overflow
The root cause is the section - uses: actions/setup-python@v3 with: python-version: "3.10" cache: "poetry". with the line caching poetry .
Read more >
warnings — Warning control — Python 3.11.1 documentation
This argument exists primarily for testing the warnings module itself. If the action argument is not None , the remaining arguments are passed...
Read more >
Add card actions in a bot - Teams - Microsoft Learn
Teams does not support the potentialActions property. Card actions are different than suggested actions in Bot Framework or Azure Bot ...
Read more >
Preparing apps for actions - IBM Cloud Docs
If your runtime is not supported, you can package your app in a Docker image. ... compatible with the Python runtime used for...
Read more >
How to Fix the HTTP 405 Method Not Allowed Error - Kinsta®
The 405 Method Not Allowed error occurs when the web server is configured in a way that does not allow you to perform...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found