Pip: command not found

Bitrise Build Issue Report template

Description of the issue

We use a custom step in our builds that posts results of the build process on the pull request that is was created by. This step is available here: https://github.com/GetintheLoop/bitrise-steps-bitbucket-approver

It stopped working recently saying that “pip: command not found”, even though I have “pip” described as a dependancy and, according to the build log, its installed successfully during step initialization.

Build log

Cloning into ‘/var/folders/90/5stft2v13fb_m_gv3c8x9nwc0000gn/T/bitrise635725819/step_src’…
±-----------------------------------------------------------------------------+
| (3) Bitbucket Approver |
±-----------------------------------------------------------------------------+
| id: https://github.com/GetintheLoop/bitrise-steps-bitbucket-approver.git |
| version: master |
| collection: git |
| toolkit: bash |
| time: 2017-11-07T11:45:17-08:00 |
±-----------------------------------------------------------------------------+
| |
e[36mINFOe[0m[11:45:19] * e[32;1m[OK]e[0m Step dependency (pip) installed, available.
/var/folders/90/5stft2v13fb_m_gv3c8x9nwc0000gn/T/bitrise635725819/step_src/step.sh: line 4: pip: command not found
Traceback (most recent call last):
File “/var/folders/90/5stft2v13fb_m_gv3c8x9nwc0000gn/T/bitrise635725819/step_src/approvePR.py”, line 1, in
import requests
ImportError: No module named requests
| |
±–±--------------------------------------------------------------±---------+
| e[31;1mxe[0m | e[31;1mBitbucket Approver (exit code: 1)e[0m | 4.64 sec |
±–±--------------------------------------------------------------±---------+
| Issue tracker: https://github.com/.../issues |
| Source: https://github.com/… |
±–±--------------------------------------------------------------±---------+

Hi @buildbot-gitl,

Can you please provide the link of a related build? We’ll need more logs :slight_smile:

Sorry, here are links to a couple of recent builds:
https://www.bitrise.io/build/078797b84af7b169
https://www.bitrise.io/build/72640802450779a6
https://www.bitrise.io/build/2c554a9351606053
https://www.bitrise.io/build/e9719ac04071866e

Here is the first build when that error first appeared:
https://www.bitrise.io/build/212e101773702bdd

Here is last successful build on the same day when error started appearing:
https://www.bitrise.io/build/1b195e5d7b32895a

Thank you for you help
Myro

1 Like

Hi @buildbot-gitl,

Thanks for reporting the issue. The python formula installed by brew provides pip and pip2 binaries, but only creates a symlink for pip2 in /usr/local/bin, not for pip, so it’s not in your path and there will be no pip command available.

You can use the pip2 command in your scripts, or you can use a script step before your custom step with one of the following content:

  • create a symlink to Homebrew’s Python 2.7.x’s pip:
    ln -s ../Cellar/python/2.7.14/bin/pip /usr/local/bin/pip (the actual python2 version can be different)
  • a more robust solution would be:
    ln -s pip2 /usr/local/bin/pip
  • you can use an alias:
    alias pip='pip2'
3 Likes

Thank you very much for your help guys! This has solved my issue.

1 Like