Python 2.7 on Openshift V3: update setuptools before build?
Asked Answered
S

1

1

When installing cryptography package I get the following error:

Invalid environment marker: platform_python_implementation != 'PyPy'

It seems upgrading setuptools would solve this. Is there a way I could edit Build Config YAML file so that pip install --upgrade setuptools runs before any package is built?

Struble answered 25/10, 2017 at 8:7 Comment(0)
C
5

Run:

oc set env bc/yourappname UPGRADE_PIP_TO_LATEST=true

See:

When you do this it should update pip, setuptools and wheel packages.

Only problem is that right at this minute, the changes that were made such that setuptools and wheel were also updated aren't yet in RHEL based Python S2I images. So if you are using OpenShift Container Platform (as used by OpenShift Online), it will not work as required.

First option to workaround that is to use the CentOS based images instead for now:

oc new-app centos/python-27-centos7~https://url-to-your-repo

Second option is to add an executable shell script called .s2i/bin/assemble in your source code repo which contains:

#!/bin/bash

set -eo pipefail

pip install --upgrade pip setuptools wheel

/usr/libexec/s2i/assemble

This will be executed instead of the normal assemble script, allowing you to install the updates. You then run the original assemble script.

Cargian answered 25/10, 2017 at 8:38 Comment(1)
Went with second option. Worked like a charm. Thanks.Struble

© 2022 - 2024 — McMap. All rights reserved.