Bug 1510685

Summary: Python modules not found when multiple versions of Python installed
Product: [Community] GlusterFS Reporter: Axel Ulrich <ulrich.axel>
Component: geo-replicationAssignee: Kotresh HR <khiremat>
Status: CLOSED CURRENTRELEASE QA Contact: Rahul Hinduja <rhinduja>
Severity: low Docs Contact:
Priority: unspecified    
Version: mainlineCC: avishwan, bugs, csaba, rhs-bugs, storage-qa-internal
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-04-17 11:33:55 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Axel Ulrich 2017-11-08 01:07:27 UTC
Description of problem:
On a system with Python2.7 and Python2.6, with Python2.7 being the default, site-packages from GlusterFS and Python dependency prettytable are installed into Python2.6 when install via rpm packages.  When running gluster commands that depend on those they are not found.

Version-Release number of selected component (if applicable):
GlusterFS 3.12

Example:
$ sudo gluster-mountbroker setup /var/mountbroker-root geogroup
this command comes back with an error:
Traceback (most recent call last):
  File "/usr/sbin/gluster-mountbroker", line 5, in <module>
    from gluster.cliutils import (execute, Cmd, node_output_ok,
ImportError: No module named gluster.cliutils

Fix without changing Python default to 2.6:
$ sudo cp -r /usr/lib/python2.6/site-packages/* /usr/lib/python2.7/site-packages/
$ sudo yum install python27-prettytable


Because the gluster documentation states support for Python2.6 'or higher', wouldn't a better approach of the install be to install packages/dependencies into all Python2.6 or higher versions on the system at the time of install? I wonder actually what happens on a system with only Python2.7 at the time of install.

Comment 2 Aravinda VK 2018-02-06 08:12:16 UTC
Moving this issue to upstream

Comment 3 Yaniv Kaul 2019-04-17 09:56:09 UTC
Where is it upstream?

Comment 4 Aravinda VK 2019-04-17 10:14:24 UTC
(In reply to Yaniv Kaul from comment #3)
> Where is it upstream?


Product and version of bug is changed to upstream

> Product: Red Hat Gluster Storage → GlusterFS
> Version: unspecified → mainline

site-lib directory to install python library is fetched using below command in glusterfs spec file(https://github.com/gluster/glusterfs/blob/master/glusterfs.spec.in#L165).

```
%{!?python2_sitelib: %global python2_sitelib %(python2 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
```

If rpms are built with Python 2.6(May be default in build machine) then after gluster rpms install it will install to the same directory even though User installed the newer version of Python.

Comment 5 Yaniv Kaul 2019-04-17 10:26:37 UTC
Luckily I believe we've all moved to Python 2.7? Is that something we still need to handle (ignoring Python 2 / Python 3 for  this discussion)

Comment 6 Aravinda VK 2019-04-17 10:34:13 UTC
(In reply to Yaniv Kaul from comment #5)
> Luckily I believe we've all moved to Python 2.7? Is that something we still
> need to handle (ignoring Python 2 / Python 3 for  this discussion)

Yes, Python 2.7 is available in CentOS 7.