Python 2.7 on Openshift V3: update setuptools befo

2019-07-25 00:13发布

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?

1条回答
对你真心纯属浪费
2楼-- · 2019-07-25 00:57

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.

查看更多
登录 后发表回答