The Python world has long since embraced Python3. However, the stability guarantees of RHEL have limited it to Python2.7 as the base OS. Now that I am running RHEL on my laptop, I have to find a way to work with Python 3.5 in order to contribute to OpenStack. To further constrain myself, I do not want to “pollute” the installed python modules by using PIP to mix and match between upstream and downstream. The solution is the Software Collections version of Python 3.5. Here’s how I got it to work.
Start by enabling the Software Collections Yum repos and refreshing:
sudo subscription-manager repos --enable rhel-workstation-rhscl-7-rpms sudo subscription-manager refresh
Now what I need is Python 3.5. Since I did this via trial and error, I don’t have the exact yum command I used, but I ended up with the following rpms installed, and they were sufficient.
rh-python35-python-setuptools-18.0.1-2.el7.noarch rh-python35-python-libs-3.5.1-11.el7.x86_64 rh-python35-python-pip-7.1.0-2.el7.noarch rh-python35-scldevel-2.0-2.el7.x86_64 rh-python35-runtime-2.0-2.el7.x86_64 rh-python35-python-six-1.10.0-1.el7.noarch rh-python35-python-devel-3.5.1-11.el7.x86_64 rh-python35-python-3.5.1-11.el7.x86_64
To enable the software collections:
scl enable rh-python35 bash
However, thus far there is no Tox installed. I can get using pip, and I’m ok with that so long as I do a user install. Make sure You have run the above scl enable command to do this for the right version of python.
pip install --user --upgrade tox
This puts all the code in ~/.local/ as well as appending ~/.local/bin dir to the PATH env var. You need to restart your terminal session to pick that up on first use.
Now I can run code in the Keystone repo. For example, to build the sample policy.json files:
tox -e genpolicy
Source From: fedoraplanet.org.
Original article title: Adam Young: Running OpenStack components on RHEL with Software Collections.
This full article can be read at: Adam Young: Running OpenStack components on RHEL with Software Collections.