sclorg / s2i-python-container

Python container images based on Red Hat Software Collections and intended for OpenShift and general usage, that provide a platform for building and running Python applications. Users can choose between Red Hat Enterprise Linux, Fedora, and CentOS based images.
http://softwarecollections.org
Apache License 2.0
260 stars 325 forks source link

python 3.6 container image adding "/opt/rh/rh-nodejs10/root/usr/lib/python2.7/site-packages" to PYTHONPATH by default #343

Closed SaratM34 closed 5 years ago

SaratM34 commented 5 years ago

1) I am using the image rhscl/python-36-rhel7 and I found an issue where /opt/rh/rh-nodejs10/root/usr/lib/python2.7/site-packages is getting added to the PYTHONPATH environment variable. 2) I tried to unset it through assemble and run file but whenever I open a shell session it is getting added back. I looked into the scl_enable file and removed $NODEJS_SCL from this command source scl_source enable httpd24 $NODEJS_SCL rh-python36 rebuilt the image and the python2.7/sitepackages path is not getting added. 3) I will be using this image through openshift via python:3.6 imagestream tag. Since I will only have control to override assemble and run file while building applications through openshift using this builder image. How can I prevent the addition of python2.7 path to PYTHONPATH variable ?

frenzymadness commented 5 years ago

Thanks for the report. I'll take a closer look as soon as possible.

frenzymadness commented 5 years ago

The path is added to PYTHONPATH in enable script for rh-nodejs10 software collection:

…
export PYTHONPATH=/opt/rh/rh-nodejs10/root/usr/lib/python2.7/site-packages${PYTHONPATH:+:${PYTHONPATH}}
…

When I install all the packages from this collection, the directory /opt/rh/rh-nodejs10/root/usr/lib/python2.7/ is empty so from my point of view, add the path into PYTHONPATH does not make sense but it also should not cause any problems to you because Python just skips this record while searching for packages.

Does this cause any problems for you?

frenzymadness commented 5 years ago

I cannot find any bug related to this in Red Hat Bugzilla. I can report a bug to rh-nodejs10 maintainers but it would be handy to have some reproducer from you first.

pkubatrh commented 5 years ago

As a workaround for this you can redefine the NODEJS_SCL variable so that the scl never gets enabled (if you do not care about npm that is):

$ docker run --rm -ti rhscl/python-36-rhel7 bash -c 'echo ${PYTHONPATH:-empty}'
/opt/rh/rh-nodejs10/root/usr/lib/python2.7/site-packages
$ docker run --rm -ti -e NODEJS_SCL="" rhscl/python-36-rhel7 bash -c 'echo ${PYTHONPATH:-empty}'
empty
frenzymadness commented 5 years ago

Bugzilla for rh-nodejs software collection: https://bugzilla.redhat.com/show_bug.cgi?id=1755821

frenzymadness commented 5 years ago

Since it's not a bug in the container itself, I'm closing this issue. Please, follow the bugzilla.