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.

All packages with CLI failing with '/home/runner/.local/bin' which is not on PATH

See original GitHub issue

Describe the bug

Packages entrypoints/CLI are not available in PATH e.g. flake8, poetry, pytest.

When investigating Github Action logs I can see two noticeable warnings that explains the issue:

  • Defaulting to user installation because normal site-packages is not writeable
  • WARNING: The script flake8 is installed in '/home/runner/.local/bin' which is not on PATH.

As I have another repo using this same action, and it is working just fine, I wonder if something happened recently to cause this - Virtualenv manipulation, PATH manipulation, etc.

Which version of the action are you using?

Tried both - same issue

  • v1
  • v2
  • Some other tag (such as v2.0.1 or master)

Environment

  • self-hosted
  • Linux (ubuntu latest)
  • Windows
  • Mac

If applicable, please specify if you’re using a container

Python Versions Please list all of the effected versions of Python (3.8.2, etc.)

3.6, 3.7, 3.8

To Reproduce

Create a new Github action using the following steps:

    steps:
      - uses: actions/checkout@v1
      - name: Set up Python ${{ matrix.python-version }}
        uses: actions/setup-python@v1
        with:
          python-version: ${{ matrix.python-version }}
      - name: Install dependencies
        run: |
          pip install --upgrade pip poetry
          poetry install

It will fail when it attempts to run poetry command. Same happens with any other package.

Run/Repo Url If applicable, and if your repo/run is public, please include a URL so it is easier for us to investigate.

https://github.com/aws-samples/cookiecutter-aws-sam-pipeline/pull/10/checks?check_run_id=730151630

Screenshots If applicable, add screenshots to help explain your problem.

image

Additional context

PATH content - Captured via tmate session

echo $PATH
/opt/hostedtoolcache/Python/3.6.10/x64/bin:/opt/hostedtoolcache/Python/3.6.10/x64:/usr/share/rust/.cargo/bin:/home/runner/.config/composer/vendor/bin:/home/runner/.dotnet/tools:/snap/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:/home/runner/.dotnet/tools

Debug logs

Defaulting to user installation because normal site-packages is not writeable
Requirement already up-to-date: pip in /opt/hostedtoolcache/Python/3.6.10/x64/lib/python3.6/site-packages (20.1.1)
runner@fv-az78:~/work/cookiecutter-aws-sam-pipeline/cookiecutter-aws-sam-pipeline$ pip install flake8
Defaulting to user installation because normal site-packages is not writeable
Collecting flake8
  Downloading flake8-3.8.2-py2.py3-none-any.whl (72 kB)
     |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 72 kB 1.7 MB/s
Collecting mccabe<0.7.0,>=0.6.0
  Downloading mccabe-0.6.1-py2.py3-none-any.whl (8.6 kB)
Requirement already satisfied: importlib-metadata; python_version < "3.8" in /home/runner/.local/lib/python3.6/site-packages (from flake8) (1.1.3)
Collecting pycodestyle<2.7.0,>=2.6.0a1
  Downloading pycodestyle-2.6.0-py2.py3-none-any.whl (41 kB)
     |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 41 kB 796 kB/s
Collecting pyflakes<2.3.0,>=2.2.0
  Downloading pyflakes-2.2.0-py2.py3-none-any.whl (66 kB)
     |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 66 kB 9.7 MB/s
Requirement already satisfied: zipp>=0.5 in /home/runner/.local/lib/python3.6/site-packages (from importlib-metadata; python_version < "3.8"->flake8) (3.1.0)
Installing collected packages: mccabe, pycodestyle, pyflakes, flake8
  WARNING: The script pycodestyle is installed in '/home/runner/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The script pyflakes is installed in '/home/runner/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The script flake8 is installed in '/home/runner/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.

Add any other context about the problem here.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:6
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
abitrollycommented, Jan 15, 2021

Same here. /home/runner/.local/bin is not added to $PATH. This dir is not present on Fedora 33 either, but this doesn’t really make sense for a build system.

  Creating /home/runner/.local/bin
  changing mode of /home/runner/.local/bin/coverage to 755
  changing mode of /home/runner/.local/bin/coverage-3.8 to 755
  changing mode of /home/runner/.local/bin/coverage3 to 755
1reaction
indirectlylitcommented, Nov 4, 2020

I’m reproducing a very similar issue. I have the same Python action running in two repos, and it succeeds in one while failing in another.

In this case I’m trying to run flake8, but get the same β€œcommand not found” issue with black and pytest:

name: Python tests
on: [push, pull_request]
jobs:
  test:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        python-version: [3.6]
    steps:
    - uses: actions/checkout@v2
    - run: |
        # Hack to get setup-python to work on act
        # https://github.com/nektos/act/issues/251#issuecomment-706412948
        if [ ! -f "/etc/lsb-release" ] ; then
          echo "DISTRIB_RELEASE=18.04" > /etc/lsb-release
        fi
    - name: Set up Python ${{ matrix.python-version }}
      uses: actions/setup-python@v2
      with:
        python-version: ${{ matrix.python-version }}
    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        pip install flake8
    - name: Lint with flake8
      run: |
        flake8 .

In the repo where this doesn’t work, it gives the warning:

WARNING: The script flake8 is installed in '/opt/hostedtoolcache/Python/3.6.12/x64/lib/my_project' which is not on PATH.

In the repo where it does work, there is no warning.

Interestingly, I can reproduce this both in the github runner, and also locally using the act local Docker runner on mac. This implies that there’s something about the structure of the two repos which is causing different behaviors. Will try to narrow it down to a reproducible scenario.

Read more comments on GitHub >

github_iconTop Results From Across the Web

WARNING: The script pip3.8 is installed in '/usr/local/bin ...
If you install pip3 via sudo apt install python3-pip that directory JUST got created, and you haven't logged out yet - and so...
Read more >
Add executable to Ubuntu-latest PATH using GitHub workflow
The main concerns we have about this approach are: /usr/local/bin gets cluttered by all the dependencies of myapp which MUST be included in...
Read more >
AWX task failure for python netaddr - Google Groups
" WARNING: The script netaddr is installed in '/home/runner/.local/bin' which is not on PATH.", " Consider adding this directory to PATH or, ifΒ ......
Read more >
1 How to write and test a Python program - liveBook Β· Manning
Write a Python program to say β€œHello, World!” Handle command-line arguments using argparse; Run tests for the code with Pytest. Learn about $PATH;...
Read more >
[CircleCI] breaks deploy flow after trellis-cli update to 1.4.0 ...
Unfortunately, I don't have any data in-between (1.0.0-1.4.0). Few things that I think have an impact on it: something with path to trellisΒ ......
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