Bug 1292701

Summary: Install mysqlclient in Django scalable application
Product: OpenShift Online Reporter: Jaspreet Kaur <jkaur>
Component: ContainersAssignee: Vu Dinh <vdinh>
Status: CLOSED WONTFIX QA Contact: DeShuai Ma <dma>
Severity: urgent Docs Contact:
Priority: high    
Version: 2.xCC: agrimm, aos-bugs, jkaur, jokerman, mmccomas, stijndewitt, vdinh
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: 2016-04-22 18:40:54 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 Jaspreet Kaur 2015-12-18 06:58:30 UTC
Description of problem:

When installing mysqlclient in scalable django application it fails while it works in scalable application


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


How reproducible:


Steps to Reproduce:
- Creating a python 3.3 application. Add mysql cartridge.

2) Edit setup.py below :

install_requires=['Django>=1.3','MySQL-python'],

git add setup.py
git commit -m "added"
git push

3) Ssh the application:

rhc ssh <APP-Name>

- Install mysqlclient

pip install mysqlclient
 
Actual results: It fails with below error :

Collecting mysqlclient
  Downloading mysqlclient-1.3.7.tar.gz (79kB)
    100% |████████████████████████████████| 81kB 4.8MB/s 
Installing collected packages: mysqlclient
  Running setup.py install for mysqlclient
    Complete output from command /var/lib/openshift/566aed8389f5cf0a10000013/python/virtenv/venv/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-mszn_6/mysqlclient/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-f7rdbj-record/install-record.txt --single-version-externally-managed --compile --install-headers /var/lib/openshift/566aed8389f5cf0a10000013/python/virtenv/venv/include/site/python3.3/mysqlclient:
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.3
    copying _mysql_exceptions.py -> build/lib.linux-x86_64-3.3
    creating build/lib.linux-x86_64-3.3/MySQLdb
    copying MySQLdb/__init__.py -> build/lib.linux-x86_64-3.3/MySQLdb
    copying MySQLdb/compat.py -> build/lib.linux-x86_64-3.3/MySQLdb
    copying MySQLdb/converters.py -> build/lib.linux-x86_64-3.3/MySQLdb
    copying MySQLdb/connections.py -> build/lib.linux-x86_64-3.3/MySQLdb
    copying MySQLdb/cursors.py -> build/lib.linux-x86_64-3.3/MySQLdb
    copying MySQLdb/release.py -> build/lib.linux-x86_64-3.3/MySQLdb
    copying MySQLdb/times.py -> build/lib.linux-x86_64-3.3/MySQLdb
    creating build/lib.linux-x86_64-3.3/MySQLdb/constants
    copying MySQLdb/constants/__init__.py -> build/lib.linux-x86_64-3.3/MySQLdb/constants
    copying MySQLdb/constants/CR.py -> build/lib.linux-x86_64-3.3/MySQLdb/constants
    copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-3.3/MySQLdb/constants
    copying MySQLdb/constants/ER.py -> build/lib.linux-x86_64-3.3/MySQLdb/constants
    copying MySQLdb/constants/FLAG.py -> build/lib.linux-x86_64-3.3/MySQLdb/constants
    copying MySQLdb/constants/REFRESH.py -> build/lib.linux-x86_64-3.3/MySQLdb/constants
    copying MySQLdb/constants/CLIENT.py -> build/lib.linux-x86_64-3.3/MySQLdb/constants
    running build_ext
    building '_mysql' extension
    creating build/temp.linux-x86_64-3.3
    gcc -pthread -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -I/opt/rh/python33/root/usr/include-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -Dversion_info=(1,3,7,'final',1) -D__version__=1.3.7 -I/opt/rh/mysql55/root/usr/include/mysql -I/var/lib/openshift/566aed8389f5cf0a10000013/python/virtenv/venv/include -I/opt/rh/python33/root/usr/include/python3.3m -c _mysql.c -o build/temp.linux-x86_64-3.3/_mysql.o -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-strict-aliasing -fwrapv -fPIC -fPIC -g -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing -DMY_PTHREAD_FASTMUTEX=1
    In file included from /opt/rh/python33/root/usr/include/python3.3m/pyconfig.h:6,
                     from /opt/rh/python33/root/usr/include/python3.3m/Python.h:8,
                     from _mysql.c:40:
    /opt/rh/python33/root/usr/include/python3.3m/pyconfig-64.h:548:1: warning: "HAVE_MBRTOWC" redefined
    In file included from /opt/rh/mysql55/root/usr/include/mysql/my_config.h:14,
                     from _mysql.c:29:
    /opt/rh/mysql55/root/usr/include/mysql/my_config_x86_64.h:421:1: warning: this is the location of the previous definition
    gcc -pthread -shared -L/opt/rh/python33/root/usr/lib64 -L/usr/lib6464 build/temp.linux-x86_64-3.3/_mysql.o -L/opt/rh/mysql55/root/usr/lib64/mysql -L/opt/rh/python33/root/usr/lib64 -lmysqlclient -lpthread -lz -lm -lrt -lssl -lcrypto -ldl -lpython3.3m -o build/lib.linux-x86_64-3.3/_mysql.cpython-33m.so
    /usr/bin/ld: cannot find -lmysqlclient
    collect2: ld returned 1 exit status
    error: command 'gcc' failed with exit status 1
    
    ----------------------------------------
Command "/var/lib/openshift/566aed8389f5cf0a10000013/python/virtenv/venv/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-mszn_6/mysqlclient/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-f7rdbj-record/install-record.txt --single-version-externally-managed --compile --install-headers /var/lib/openshift/566aed8389f5cf0a10000013/python/virtenv/venv/include/site/python3.3/mysqlclient" failed with error code 1 in /tmp/pip-build-mszn_6/mysqlclient


Expected results:

It should work in scalable applications also

Additional info:

Comment 2 Jaspreet Kaur 2015-12-18 12:18:43 UTC
Hello,

There is a correct in my statement :

When installing mysqlclient in scalable django application it fails while it works in non-scalable application

Regards,
Jaspreet

Comment 3 Jaspreet Kaur 2015-12-22 07:08:39 UTC
Hello,

Can we have an update on this please so as to inform the customer if it going to be considered or not ?

Regards,
Jaspreet

Comment 4 Vu Dinh 2015-12-23 21:24:20 UTC
Hi,

We are still actively working to resolve this issue. We are narrowing down the cause for this and hopefully will come up with a fix soon. However, it's holiday season so the progress has been slow unfortunately as most of engineers are on PTO. We will give you more updates as soon as we get back from the break.

Thanks,
Vu

Comment 5 Vu Dinh 2016-01-05 16:36:36 UTC
Hi,

Just want to post a quick update that we are still working on this issue. In the meantime, there is a possible workaround that customer can give a try if necessary.

1. First, create the scalable app with python-3.3 without mysql-5.5 cartridge:
rhc app create <app-name> python-3.3 -s

2. Then, add django and mysqlclient to setup.py and the git push the change. Both django and mysqlclient should be installed properly.

3. Finally, add mysql-5.5 cartridge to the app:
rhc cartridge add mysql-5.5 --app <app-name>

Now, the app should have 2 gears, one for python and one for mysql as it should be.

Let me know if this workaround is suitable for customer case.

Thanks,
Vu

Comment 7 Stijn de Witt 2016-08-01 15:35:05 UTC
I had the same issue as the OP. Created a scalable app with Python 3.3 and MySQL 5.5 but mysqlclient would not install. 

I tried the workaround suggested by Vu Dinh and that works. Thanks Vu!

Comment 8 Vu Dinh 2016-08-01 15:45:07 UTC
Hi Stijn,

Thanks for letting me know and you are welcome!

Vu

Comment 9 Red Hat Bugzilla 2023-09-14 03:14:59 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 1000 days