Virtualenv error on osx build

Hi,

I’m using the new OSX stack and my project fails with some crude error about virtualenv (used in the python world). Here is the error:

[quote]
((if (directory? “/Users/distiller/virtualenvs/venv-system”) (echo “Using cached venv”) (do (“virtualenv” “/Users/distiller/virtualenvs/venv-system” || exit 1) (source “/Users/distiller/virtualenvs/venv-system/bin/activate” || exit 2) (pip install nose || exit 3))) “rm -rf venv; ln -s /Users/distiller/virtualenvs/venv-system venv” (echo “source /Users/distiller/virtualenvs/venv-system/bin/activate” >> “~/.circlerc”)) returned exit code 1

bash: line 2: virtualenv: command not found Action failed: virtualenv[/quote]

This occurs in the “machine” section right after “Select Xcode Version” and “Restore cache”. I have no idea what to do about this, as “Rebuild without cache” also has no effect on this.

After a whole bunch of debugging commits I found a solution:

machine:
    pre:
        - pip install --user --ignore-installed --upgrade --verbose virtualenv
        - ln -s ~/Library/Python/2.7/bin/virtualenv /usr/local/bin/virtualenv

But I think this should be fixed in the image …

1 Like

Just out of curiosity what are you using python for in your build?

Python is not used in the project directly but as glue-code to manage the rather complex build command

1 Like

I see, that makes a lot of sense.

@alexey do you think this is something we could address in the build image?

Thanks for the details, @michaelcontento. We’ll see if we can pre-install virtualenv in OS X build containers to make sure this doesn’t happen.

1 Like

FYI, for me just

machine:
  pre:
    - sudo -H pip install --upgrade virtualenv

did the trick.

1 Like

Thanks @sschuberth and @michaelcontento - this has highlighted that we were missing some tests for our macOS image. We will get virtualenv installed properly, and add proper regression tests for our image builder so that we don’t make this mistake again.

1 Like

The workarounds stopped working due to https://github.com/pypa/packaging-problems/issues/130

My solution is to upgrade pip beforehand:

machine:
  pre:
    # virtualenv is automatically used by CircleCI,
    # but it's not available in the macOS image.
    - curl https://bootstrap.pypa.io/get-pip.py | sudo python -
    - sudo -H pip install --upgrade virtualenv

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.