No puedo hacer que Pandas se instale con OpenShift

Estoy solicitando una aplicación Flask en OpenShift y una de las dependencias de Python es Pandas 0.16.1. Mirando la documentación de OpenShift , creé mi archivo setup.py la siguiente manera:

 from setuptools import setup setup(name='MyApp', version='0.1a', description='some description', author='me', author_email='me@gmail.com', url='http://myapp.com/', install_requires=['Flask>=0.10.1','numpy>=1.9.2','pandas>=0.16.1'], ) 

Al crear la aplicación utilizando los requisitos, el proceso falla. Se produce el siguiente error … ayuda!

 The initial build for the application failed: Shell command '/sbin/runuser -s /bin/sh 557ba9e9e0b8cd360b000131 -c "exec /usr/bin/runcon 'unconfined_u:system_r:openshift_t:s0:c1,c69' /bin/sh -c \"gear postreceive --init >> /tmp/initial-build.log 2>&1\""' returned an error. rc=137 .Last 10 kB of build output: Stopping Python 2.7 cartridge Repairing links for 1 deployments Building git ref 'master', commit 239ba5f Activating virtenv Running setup.py script.. running develop running egg_info creating GTFS_Viewer.egg-info writing requirements to GTFS_Viewer.egg-info/requires.txt writing GTFS_Viewer.egg-info/PKG-INFO writing top-level names to GTFS_Viewer.egg-info/top_level.txt writing dependency_links to GTFS_Viewer.egg-info/dependency_links.txt writing manifest file 'GTFS_Viewer.egg-info/SOURCES.txt' reading manifest file 'GTFS_Viewer.egg-info/SOURCES.txt' writing manifest file 'GTFS_Viewer.egg-info/SOURCES.txt' running build_ext Creating /var/lib/openshift/557ba9e9e0b8cd360b000131/app-root/runtime/dependencies/python/virtenv/lib/python2.7/site-packages/GTFS-Viewer.egg-link (link to .) Adding GTFS-Viewer 0.1a to easy-install.pth file Installed /var/lib/openshift/557ba9e9e0b8cd360b000131/app-root/runtime/repo Processing dependencies for GTFS-Viewer==0.1a Searching for pandas>=0.16.1 Reading http://mirror1.ops.rhcloud.com/mirror/python/web/simple/pandas/ Best match: pandas 0.16.1 Downloading mirror1.ops.rhcloud.com/mirror/python/web/packages/source/p/pandas/pandas-0.16.1.zip#md5=d465643d588c4f886b8e796ae56673ad Processing pandas-0.16.1.zip Writing /tmp/easy_install-97qgiA/pandas-0.16.1/setup.cfg Running pandas-0.16.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-97qgiA/pandas-0.16.1/egg-dist-tmp-VpNuur warning: no files found matching 'README.rst' no previously-included directories found matching 'doc/build' warning: no directories found matching 'examples' warning: no previously-included files matching '*.so' found anywhere in distribution warning: no previously-included files matching '*.pyd' found anywhere in distribution warning: no previously-included files matching '*.pyc' found anywhere in distribution warning: no previously-included files matching '*~' found anywhere in distribution warning: no previously-included files matching '#*' found anywhere in distribution warning: no previously-included files matching '.git*' found anywhere in distribution warning: no previously-included files matching '.DS_Store' found anywhere in distribution warning: no previously-included files matching '*.png' found anywhere in distribution In file included from /opt/rh/python27/root/usr/lib64/python2.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1728, from /opt/rh/python27/root/usr/lib64/python2.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:17, from /opt/rh/python27/root/usr/lib64/python2.7/site-packages/numpy/core/include/numpy/arrayobject.h:15, from pandas/index.c:250: /opt/rh/python27/root/usr/lib64/python2.7/site-packages/numpy/core/include/numpy/npy_deprecated_api.h:11:2: warning: #warning "Using deprecated NumPy API, disable it by #defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" pandas/index.c: In function '__pyx_f_6pandas_5index_11IndexEngine__maybe_get_bool_indexer': pandas/index.c:4088: warning: '__pyx_v_last_true' may be used uninitialized in this function pandas/index.c: In function '__pyx_f_6pandas_5index_13Float64Engine__maybe_get_bool_indexer': pandas/index.c:7981: warning: '__pyx_v_last_true' may be used uninitialized in this function pandas/index.c: In function '__pyx_f_6pandas_5index_11Int64Engine__maybe_get_bool_indexer': pandas/index.c:7356: warning: '__pyx_v_last_true' may be used uninitialized in this function pandas/index.c: In function '__pyx_f_6pandas_5index__bin_search': pandas/index.c:8769: warning: '__pyx_v_mid' may be used uninitialized in this function In file included from /opt/rh/python27/root/usr/lib64/python2.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1728, from /opt/rh/python27/root/usr/lib64/python2.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:17, from /opt/rh/python27/root/usr/lib64/python2.7/site-packages/numpy/core/include/numpy/arrayobject.h:15, from pandas/src/datetime/np_datetime.c:18: /opt/rh/python27/root/usr/lib64/python2.7/site-packages/numpy/core/include/numpy/npy_deprecated_api.h:11:2: warning: #warning "Using deprecated NumPy API, disable it by #defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" /opt/rh/python27/root/usr/include/python2.7/datetime.h:188: warning: 'PyDateTimeAPI' defined but not used In file included from /opt/rh/python27/root/usr/lib64/python2.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1728, from /opt/rh/python27/root/usr/lib64/python2.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:17, from /opt/rh/python27/root/usr/lib64/python2.7/site-packages/numpy/core/include/numpy/arrayobject.h:15, from pandas/src/datetime/np_datetime_strings.c:17: /opt/rh/python27/root/usr/lib64/python2.7/site-packages/numpy/core/include/numpy/npy_deprecated_api.h:11:2: warning: #warning "Using deprecated NumPy API, disable it by #defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" pandas/src/datetime/np_datetime_strings.c: In function 'make_iso_8601_datetime': pandas/src/datetime/np_datetime_strings.c:1147: warning: format '%04ld' expects type 'long int', but argument 4 has type 'long long int' pandas/src/datetime/np_datetime_strings.c:1147: warning: format '%04ld' expects type 'long int', but argument 4 has type 'long long int' pandas/src/datetime/np_datetime_strings.c: At top level: pandas/src/datetime/np_datetime_strings.c:127: warning: 'get_gmtime' defined but not used In file included from /opt/rh/python27/root/usr/lib64/python2.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1728, from /opt/rh/python27/root/usr/lib64/python2.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:17, from /opt/rh/python27/root/usr/lib64/python2.7/site-packages/numpy/core/include/numpy/arrayobject.h:15, from pandas/src/period.c:251: /opt/rh/python27/root/usr/lib64/python2.7/site-packages/numpy/core/include/numpy/npy_deprecated_api.h:11:2: warning: #warning "Using deprecated NumPy API, disable it by #defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" /opt/rh/python27/root/usr/lib64/python2.7/site-packages/numpy/core/include/numpy/__multiarray_api.h:1594: warning: '_import_array' defined but not used /opt/rh/python27/root/usr/lib64/python2.7/site-packages/numpy/core/include/numpy/__ufunc_api.h:236: warning: '_import_umath' defined but not used In file included from /opt/rh/python27/root/usr/lib64/python2.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1728, from /opt/rh/python27/root/usr/lib64/python2.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:17, from /opt/rh/python27/root/usr/lib64/python2.7/site-packages/numpy/core/include/numpy/arrayobject.h:15, from pandas/src/datetime/np_datetime.c:18: /opt/rh/python27/root/usr/lib64/python2.7/site-packages/numpy/core/include/numpy/npy_deprecated_api.h:11:2: warning: #warning "Using deprecated NumPy API, disable it by #defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" /opt/rh/python27/root/usr/include/python2.7/datetime.h:188: warning: 'PyDateTimeAPI' defined but not used In file included from /opt/rh/python27/root/usr/lib64/python2.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1728, from /opt/rh/python27/root/usr/lib64/python2.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:17, from /opt/rh/python27/root/usr/lib64/python2.7/site-packages/numpy/core/include/numpy/arrayobject.h:15, from pandas/src/datetime/np_datetime_strings.c:17: /opt/rh/python27/root/usr/lib64/python2.7/site-packages/numpy/core/include/numpy/npy_deprecated_api.h:11:2: warning: #warning "Using deprecated NumPy API, disable it by #defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" pandas/src/datetime/np_datetime_strings.c: In function 'make_iso_8601_datetime': pandas/src/datetime/np_datetime_strings.c:1147: warning: format '%04ld' expects type 'long int', but argument 4 has type 'long long int' pandas/src/datetime/np_datetime_strings.c:1147: warning: format '%04ld' expects type 'long int', but argument 4 has type 'long long int' pandas/src/datetime/np_datetime_strings.c: At top level: pandas/src/datetime/np_datetime_strings.c:127: warning: 'get_gmtime' defined but not used In file included from /opt/rh/python27/root/usr/lib64/python2.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1728, from pandas/src/period_helper.h:12, from pandas/src/period_helper.c:1: /opt/rh/python27/root/usr/lib64/python2.7/site-packages/numpy/core/include/numpy/npy_deprecated_api.h:11:2: warning: #warning "Using deprecated NumPy API, disable it by #defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" pandas/src/period_helper.c:33: warning: 'NULL_AF_INFO' defined but not used In file included from /opt/rh/python27/root/usr/lib64/python2.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1728, from /opt/rh/python27/root/usr/lib64/python2.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:17, from /opt/rh/python27/root/usr/lib64/python2.7/site-packages/numpy/core/include/numpy/arrayobject.h:15, from pandas/algos.c:250: /opt/rh/python27/root/usr/lib64/python2.7/site-packages/numpy/core/include/numpy/npy_deprecated_api.h:11:2: warning: #warning "Using deprecated NumPy API, disable it by #defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" 

He tenido el mismo problema: la instalación de pandas a través de requirements.txt o el uso de pip no funcionó.

Openshift se detiene y detiene el proceso al intentar comstackr algos.c . Aquí está la solución de instalación manual que hizo el truco para mí (cartucho python3.3). Es el resultado de un proceso de prueba y error algo tedioso, y realmente no puedo explicar por qué funciona. Pero es posible que desee darle una oportunidad.

  1. Conéctese a openshift: rhc ssh .

  2. Descargue la última fuente de pandas en el directorio / tmp para instalar manualmente

     cd /tmp mkdir pandas cd pandas wget https://pypi.python.org/packages/source/p/pandas/pandas-0.16.2.zip#md5=860a6c7e5e1a24bb0aa549b115830252 unzip pandas-0.16.2.zip cd pandas-0.16.2 
  3. Edite el archivo setup.py utilizando su editor favorito (disponible), por ejemplo, emacs y busque “algos”. La segunda vez que aparece comente el paquete algos en la variable ext_data :

     ... index={'pyxfile': 'index', 'sources': ['pandas/src/datetime/np_datetime.c', 'pandas/src/datetime/np_datetime_strings.c']}, # algos={'pyxfile': 'algos', # 'depends': [srcpath('generated', suffix='.pyx'), # srcpath('join', suffix='.pyx')]}, parser={'pyxfile': 'parser', 'depends': ['pandas/src/parser/tokenizer.h', 'pandas/src/parser/io.h', 'pandas/src/numpy_helper.h'], ... 
  4. Ejecute la primera parte del procedimiento de instalación:

     ./setup.py install 
  5. Ahora, vamos a comstackr la pieza de algos faltante a mano. Para hacerlo, elimine los comentarios que hizo en el paso 2 y comente todas las demás entradas (excepto la entrada de algos ) en ext_data .

  6. Ejecute la configuración en modo “ejecución en seco” para ver los dos comandos gcc que necesita para comstackr los algos

     ./setup.py -n build 
  7. Copie el primer comando gcc para ejecutarlo desde shell. Cuando intenté esto, este comando hizo openshift apagar la conexión. Entonces, lo ajusté eliminando las opciones de publicación y -O2 la -O2 (es decir, la optimización). Esto funcionó para mí:

     gcc -pthread -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -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 -Ipandas/src/klib -Ipandas/src -I/opt/rh/python33/root/usr/lib64/python3.3/site-packages/numpy/core/include -I$OPENSHIFT_HOMEDIR/python/virtenv/venv/include -I/opt/rh/python33/root/usr/include/python3.3m -c pandas/algos.c -o build/temp.linux-x86_64-3.3/pandas/algos.o 
  8. El segundo comando se puede ejecutar sin cambios. Para mi fue:

     gcc -pthread -shared -L/opt/rh/python33/root/usr/lib64 -L/usr/lib6464 build/temp.linux-x86_64-3.3/pandas/algos.o -L/opt/rh/python33/root/usr/lib64 -lpython3.3m -o build/lib.linux-x86_64-3.3/pandas/algos.cpython-33m.so 
  9. Ahora, los archivos hechos a mano necesitan ser instalados:

     ./setup.py install 
  10. Verifique rápidamente si funcionó para usted. Primero cd a tu directorio de inicio, luego prueba python:

     cd python Python 3.3.2 (default, Mar 20 2014, 20:25:51) [GCC 4.4.6 20120305 (Red Hat 4.4.6-4)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import pandas 
  11. Eliminar el directorio /tmp/pandas .

     rm -rf /tmp/pandas 

¡Espero que esto funcione para usted también!

¿Puedes hacer eso manualmente? es decir:

 ssh 12hh3456789hh01011@nameofapp-username.rhcloud.com 

Y activar el entorno:

 source app-root/runtime/dependencies/python/virtenv/bin/activate 

Y luego instalar las dependencias. Primer numpy

 pip install -U numpy 

Y luego Pandas:

 pip install pandas 

Reinicie la aplicación Openshift desde la consola web y confirme los cambios y la implementación. funciono para mi