Python 2.7 on Openshift V3: update setuptools before build?

痴心易碎 提交于 2019-12-12 23:18:42

问题


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:


Run:

oc set env bc/yourappname UPGRADE_PIP_TO_LATEST=true

See:

  • https://github.com/sclorg/s2i-python-container/tree/master/2.7

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.



来源:https://stackoverflow.com/questions/46927162/python-2-7-on-openshift-v3-update-setuptools-before-build

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!