簡體   English   中英

無法使用OpenShift安裝Pandas

[英]Can't get Pandas to install with OpenShift

ssh-ing在燒瓶應用OpenShift和Python的依賴關系的一個是熊貓0.16.1。 瀏覽OpenShift文檔 ,我創建了我的setup.py文件,如下所示:

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'],
    )

使用requires創建應用程序時,該過程失敗。 產生以下錯誤...幫助!

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"

我有同樣的問題:通過requirements.txt安裝pandas或使用pip不起作用。

在嘗試編譯algos.c時,Openshift停止並終止進程。 這是我手動安裝的解決方法(python3.3盒式磁帶)。 這是一個有點乏味的嘗試和錯誤過程的結果,我無法解釋它為什么有效。 但你可能想嘗試一下。

  1. 連接到openshift: rhc ssh <appname>

  2. 將最新的pandas源下載到/ tmp目錄以手動安裝

     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. 使用您喜歡的(可用)編輯器編輯setup.py文件,例如emacs並搜索“algos”。 第二次出現注釋掉變量ext_data的algos包:

     ... 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. 運行安裝過程的第一部分:

     ./setup.py install 
  5. 現在,讓我們手工編譯丟失的algos片段。 要做到這一點,刪除您在步驟2中提出的意見,並注釋掉所有其他條目 (除algos中的條目) ext_data

  6. 在“dry-run”模式下運行setup以查看編譯algos所需的兩個gcc命令

     ./setup.py -n build 
  7. 復制第一個gcc命令以從shell運行它。 當我嘗試這個時,這個命令使openshift關閉了連接。 所以,我通過刪除多個選項並刪除-O2標志(即優化)來調整它。 這對我有用:

     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. 第二個命令可以不加改變地運行。 對我來說是:

     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. 現在,需要安裝手工文件:

     ./setup.py install 
  10. 快速檢查它是否適合您。 首先cd到你的主目錄,然后嘗試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. 刪除/tmp/pandas目錄。

     rm -rf /tmp/pandas 

希望這也適合你!

你能手動完成嗎? 即:

ssh 12hh3456789hh01011@nameofapp-username.rhcloud.com

並激活環境:

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

然后安裝依賴項。 第一個Numpy

pip install -U numpy

然后是熊貓:

pip install pandas

從Web控制台重新啟動Openshift應用程序並提交更改並進行部署。 它對我有用!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM