Permanently Enable a Software Collection

Apologies that this has been so long in coming, but I was certain that we had already written a post on this subject. What subject you ask? How does one set one or more software collections as automatically enabled for your login.

Some of you may consider this obvious, but there are a number of ways to accomplish this goal. First, you just “source” the enable script from your .bashrc. For example

 source /opt/rh/python33/enable

However, as this Red Hat kbase discusses, the best way to work around this problem is to create a new file, and put both the “source” line in but also to make sure to fix up the appropriate environment variables.

$ cat /etc/profile.d/enablepython33.sh
#!/bin/bash
source /opt/rh/python33/enable
export X_SCLS="`scl enable python33 'echo $X_SCLS'`"

Also according to the same article, and from what I hear, we have some committed code that will provide a nicer way to do this, although still unsupported, in a soon to be released version of scl-utils.


Join the Red Hat Developer Program (it’s free) and get access to related cheat sheets, books, and product downloads.

 

Take advantage of your Red Hat Developers membership and download RHEL today at no cost.

Share

  1. What about using tools like pip, easy_install to manage packages. They usually require permissions the user doesn’t have to edit /var/lib/pythonX/site-packages, resulting in the user running the command with sudo, however `sudo easy_install` will call the easy install for the original python2.6 install since root’s paths are different. Unless a user is aware of this change, they can inadvertently do things they didn’t intend.

  2. Not sure if this is the case for anyone else, but the underscores don’t appear for me between the “X_SCLS” variable, which was rather confusing.

    export X_SCLS=”`scl enable python33 ‘echo $X_SCLS’`”

  3. If in tsch/csh environment, what shoud I do?
    By command : “scl enable python27 tcsh “, I found it go well. (at scl version 2.2)
    (even though enable script is written by bash, no error occured. I don’t know how scl command work. )

Leave a Reply