Bug 973803

Summary: can't install MySQL-python-1.2.4 to python-2.7 apps as a result of setuptools-0.7.2 conflict with distrubute package.
Product: OpenShift Online Reporter: Peter Ruan <pruan>
Component: ImageAssignee: Michal Fojtik <mfojtik>
Status: CLOSED NOTABUG QA Contact: libra bugs <libra-bugs>
Severity: low Docs Contact:
Priority: medium    
Version: 2.xCC: dmcphers
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-01-22 19:36:52 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 Peter Ruan 2013-06-12 19:11:46 UTC
Description of problem:

can't install MySQL-python-1.2.4 to python-2.7 apps as a result of setuptools-0.7.2 conflict with distrubute package.
Version-Release number of selected component (if applicable):


How reproducible:
always,

Steps to Reproduce:
1. create a php scable python-2.7 app
2. add mysql cartridge to the app
3. make sure install_requires has MySQL-python.
4. clone app, do a minor cosmetic change and do a 'git push'
 
Actual results:
remote: Downloading http://pypi.python.org/packages/source/d/distribute/distribute-0.6.28.tar.gz
remote: Extracting in /tmp/easy_install-NfK4y1/MySQL-python-1.2.4/temp/tmp0qMuyd
remote: Now working in /tmp/easy_install-NfK4y1/MySQL-python-1.2.4/temp/tmp0qMuyd/distribute-0.6.28
remote: Building a Distribute egg in /tmp/easy_install-NfK4y1/MySQL-python-1.2.4
remote: Traceback (most recent call last):
remote:   File "setup.py", line 41, in <module>
remote:     exec(open(init_path).read(), d)
remote:   File "<string>", line 8, in <module>
remote:   File "/tmp/easy_install-NfK4y1/MySQL-python-1.2.4/temp/tmp0qMuyd/distribute-0.6.28/setuptools/__init__.py", line 2, in <module>
remote:     from setuptools.extension import Extension, Library
remote:   File "/tmp/easy_install-NfK4y1/MySQL-python-1.2.4/temp/tmp0qMuyd/distribute-0.6.28/setuptools/extension.py", line 5, in <module>
remote:     from setuptools.dist import _get_unpatched
remote:   File "/tmp/easy_install-NfK4y1/MySQL-python-1.2.4/temp/tmp0qMuyd/distribute-0.6.28/setuptools/dist.py", line 6, in <module>
remote:     from setuptools.command.install import install
remote:   File "/tmp/easy_install-NfK4y1/MySQL-python-1.2.4/temp/tmp0qMuyd/distribute-0.6.28/setuptools/command/__init__.py", line 8, in <module>
remote:     from setuptools.command import install_scripts
remote:   File "/tmp/easy_install-NfK4y1/MySQL-python-1.2.4/temp/tmp0qMuyd/distribute-0.6.28/setuptools/command/install_scripts.py", line 3, in <module>
remote:     from pkg_resources import Distribution, PathMetadata, ensure_directory
remote:   File "/tmp/easy_install-NfK4y1/MySQL-python-1.2.4/temp/tmp0qMuyd/distribute-0.6.28/pkg_resources.py", line 2835, in <module>
remote:     add_activation_listener(lambda dist: dist.activate())
remote:   File "/tmp/easy_install-NfK4y1/MySQL-python-1.2.4/temp/tmp0qMuyd/distribute-0.6.28/pkg_resources.py", line 704, in subscribe
remote:     callback(dist)
remote:   File "/tmp/easy_install-NfK4y1/MySQL-python-1.2.4/temp/tmp0qMuyd/distribute-0.6.28/pkg_resources.py", line 2835, in <lambda>
remote:     add_activation_listener(lambda dist: dist.activate())
remote:   File "/tmp/easy_install-NfK4y1/MySQL-python-1.2.4/temp/tmp0qMuyd/distribute-0.6.28/pkg_resources.py", line 2259, in activate
remote:     self.insert_on(path)
remote:   File "/tmp/easy_install-NfK4y1/MySQL-python-1.2.4/temp/tmp0qMuyd/distribute-0.6.28/pkg_resources.py", line 2360, in insert_on
remote:     "with distribute. Found one at %s" % str(self.location))
remote: ValueError: A 0.7-series setuptools cannot be installed with distribute. Found one at /var/lib/openshift/51b8b205dbd93c93ff0001df/python/virtenv/lib/python2.7/site-packages/setuptools-0.7.2-py2.7.egg
remote: /tmp/easy_install-NfK4y1/MySQL-python-1.2.4/distribute-0.6.28-py2.7.egg
remote: error: None
remote:  - Done processing setup.py

Expected results:
MySQLdb installed successfully.

Additional info:

Comment 1 Peter Ruan 2013-06-12 22:33:30 UTC
The workaround is to specify a lower version of setuptools to be installed.  You can do this by editing setup.py and add the following line to the install_requires array

      install_requires=['gevent',
                        'MySQL-python',
                        'pymongo',
                        'psycopg2',
                        'setuptools == 0.6c9'
      ],

Comment 2 Mrunal Patel 2013-06-12 22:50:16 UTC
There are two more workarounds for the issue:

1. Install "MySQL-python=1.2.3"
2. ssh into the gear, activate virtualenv and do a easy_install -U distribute,
   add "MySQL-python" to setup.py and git push.

Comment 3 Michal Fojtik 2014-01-21 15:20:39 UTC
If you add install_requires=['MySQL-python'] now without specifying a version, it gets installed without any errors.

Also when I tried to hardcode 1.2.4 version into setup.py I get this result:

remote: Building a Distribute egg in /tmp/easy_install-N8UQiH/MySQL-python-1.2.4
remote: /tmp/easy_install-N8UQiH/MySQL-python-1.2.4/distribute-0.6.28-py2.7.egg
remote: In file included from /usr/include/mysql/my_config.h:14,
remote:                  from _mysql.c:44:
remote: /usr/include/mysql/my_config_x86_64.h:1082:1: warning: "HAVE_WCSCOLL" redefined
remote: In file included from /opt/rh/python27/root/usr/include/python2.7/pyconfig.h:6,
remote:                  from /opt/rh/python27/root/usr/include/python2.7/Python.h:8,
remote:                  from _mysql.c:29:
remote: /opt/rh/python27/root/usr/include/python2.7/pyconfig-64.h:908:1: warning: this is the location of the previous definition
remote: zip_safe flag not set; analyzing archive contents...
remote: Removing MySQL-python 1.2.3 from easy-install.pth file
remote: Adding MySQL-python 1.2.4 to easy-install.pth file

QA: Are you OK with closing this as NOTABUG?

Comment 4 Peter Ruan 2014-01-22 19:36:52 UTC
verified with the latest_devenv per suggestion from Michal.