読者です 読者をやめる 読者になる 読者になる

CentOS5にPython fabricをインストール

CentOS Python

CentOS5でPython Fabricを使おうとしたけど、
CentOS5はPythonのバージョンが2.4で、Fabricが入ら無いっぽかった。

$ python -V
Python 2.4.3

Python 2.6をインストール。

sudo yum install --enablerepo=epel python26
wget --no-check-certificate https://bootstrap.pypa.io/get-pip.py
sudo python26 get-pip.py
sudo pip install virtualenv
sudo yum --enablerepo=epel install python26-devel
sudo yum --enablerepo=epel install python26-crypto
# cd
# mkdir .virtualenvs
cd ~/.virtualenvs
virtualenv --python=/usr/bin/python26 migrate
cd migrate
source bin/activate
pip install fabric

とりあえず、インストールできた。

fab -V
Fabric 1.10.2
Paramiko 1.16.0

エラーその1

pip install fabric
DEPRECATION: Python 2.6 is no longer supported by the Python core team, please upgrade your Python. A future version of pip will drop support for Python 2.6
Collecting fabric
/usr/lib/python2.6/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:315: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#snimissingwarning.
  SNIMissingWarning

...


  creating build/temp.linux-x86_64-2.6/src
  gcc -pthread -fno-strict-aliasing -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -I/usr/kerberos/include -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -std=c99 -O3 -fomit-frame-pointer -Isrc/ -I/usr/include/python2.6 -c src/MD2.c -o build/temp.linux-x86_64-2.6/src/MD2.o
  src/MD2.c:31:20: error: Python.h: No such file or directory
  src/MD2.c:131: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
  In file included from src/MD2.c:147:
  src/hash_template.c:48: error: expected specifier-qualifier-list before 'PyObject_HEAD'
  src/hash_template.c:59: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'PyTypeObject'
  src/hash_template.c: In function 'newALGobject':
  src/hash_template.c:69: warning: implicit declaration of function 'PyObject_New'
  src/hash_template.c:69: error: expected expression before 'ALGobject'
  src/hash_template.c:69: warning: assignment makes pointer from integer without a cast
  src/hash_template.c: At top level:
  src/hash_template.c:76: error: expected ')' before '*' token
  src/hash_template.c:91: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
  src/hash_template.c:110: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
  src/hash_template.c:122: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
  src/hash_template.c:162: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
  src/hash_template.c:188: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
  src/hash_template.c:190: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'ALG_methods'
  src/hash_template.c:199: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
  src/hash_template.c:225: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'ALGtype'
  src/hash_template.c:271: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
  src/hash_template.c:304: error: array type has incomplete element type
  src/hash_template.c:305: error: 'PyCFunction' undeclared here (not in a function)
  src/hash_template.c:305: error: expected '}' before 'ALG_new'
  src/hash_template.c: In function 'init_MD2':
  src/hash_template.c:339: error: 'PyObject' undeclared (first use in this function)
  src/hash_template.c:339: error: (Each undeclared identifier is reported only once
  src/hash_template.c:339: error: for each function it appears in.)
  src/hash_template.c:339: error: 'm' undeclared (first use in this function)
  src/hash_template.c:351: error: 'ALGtype' undeclared (first use in this function)
  src/hash_template.c:351: error: 'PyType_Type' undeclared (first use in this function)
  src/hash_template.c:352: warning: implicit declaration of function 'Py_InitModule'
  src/hash_template.c:356: error: 'o' undeclared (first use in this function)
  src/hash_template.c:356: warning: implicit declaration of function 'PyInt_FromLong'
  src/hash_template.c:356: warning: implicit declaration of function 'PyDict_SetItemString'
  src/hash_template.c:356: warning: implicit declaration of function 'PyModule_GetDict'
  src/hash_template.c:356: warning: implicit declaration of function 'Py_DECREF'
  src/hash_template.c:360: warning: implicit declaration of function 'PyErr_Occurred'
  src/hash_template.c:361: warning: implicit declaration of function 'Py_FatalError'
  error: command 'gcc' failed with exit status 1

  ----------------------------------------
  Failed building wheel for pycrypto
  Running setup.py clean for pycrypto
Failed to build pycrypto
Installing collected packages: ecdsa, pycrypto, paramiko, fabric
Exception:
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/pip/basecommand.py", line 209, in main
    status = self.run(options, args)
  File "/usr/lib/python2.6/site-packages/pip/commands/install.py", line 317, in run
    prefix=options.prefix_path,
  File "/usr/lib/python2.6/site-packages/pip/req/req_set.py", line 731, in install
    **kwargs
  File "/usr/lib/python2.6/site-packages/pip/req/req_install.py", line 841, in install
    self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
  File "/usr/lib/python2.6/site-packages/pip/req/req_install.py", line 1040, in move_wheel_files
    isolated=self.isolated,
  File "/usr/lib/python2.6/site-packages/pip/wheel.py", line 343, in move_wheel_files
    clobber(source, lib_dir, True)
  File "/usr/lib/python2.6/site-packages/pip/wheel.py", line 314, in clobber
    ensure_dir(destdir)
  File "/usr/lib/python2.6/site-packages/pip/utils/__init__.py", line 82, in ensure_dir
    os.makedirs(path)
  File "/usr/lib64/python2.6/os.py", line 157, in makedirs
    mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/usr/lib/python2.6/site-packages/ecdsa'
/usr/lib/python2.6/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:120: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning

yumでpython26-cryptoを入れて解決

エラーその2

pip install fabric
DEPRECATION: Python 2.6 is no longer supported by the Python core team, please upgrade your Python. A future version of pip will drop support for Python 2.6
Collecting fabric
  Using cached Fabric-1.10.2-py2-none-any.whl
Collecting paramiko>=1.10 (from fabric)
  Using cached paramiko-1.16.0-py2.py3-none-any.whl
Requirement already satisfied (use --upgrade to upgrade): ecdsa>=0.11 in /usr/lib/python2.6/site-packages (from paramiko>=1.10->fabric)
Requirement already satisfied (use --upgrade to upgrade): pycrypto!=2.4,>=2.1 in /usr/lib64/python2.6/site-packages (from paramiko>=1.10->fabric)
Installing collected packages: paramiko, fabric
Exception:
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/pip/basecommand.py", line 209, in main
    status = self.run(options, args)
  File "/usr/lib/python2.6/site-packages/pip/commands/install.py", line 317, in run
    prefix=options.prefix_path,
  File "/usr/lib/python2.6/site-packages/pip/req/req_set.py", line 731, in install
    **kwargs
  File "/usr/lib/python2.6/site-packages/pip/req/req_install.py", line 841, in install
    self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
  File "/usr/lib/python2.6/site-packages/pip/req/req_install.py", line 1040, in move_wheel_files
    isolated=self.isolated,
  File "/usr/lib/python2.6/site-packages/pip/wheel.py", line 343, in move_wheel_files
    clobber(source, lib_dir, True)
  File "/usr/lib/python2.6/site-packages/pip/wheel.py", line 314, in clobber
    ensure_dir(destdir)
  File "/usr/lib/python2.6/site-packages/pip/utils/__init__.py", line 82, in ensure_dir
    os.makedirs(path)
  File "/usr/lib64/python2.6/os.py", line 157, in makedirs
    mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/usr/lib/python2.6/site-packages/paramiko'