折腾Cassandra 时遇到的安装卡死

工作需要,在阿里云的服务器(CentOS 6)上装Cassandra.
装Cassandra本身倒是没什么大问题,问题出在后来用python。
首先是python 2.6好像不支持,于是升级到python2.7。
参考:

https://ruiaylin.github.io/2014/12/12/python%20update/

之后好不容易弄好了环境,装好了pip,结果pip install cqlsh上就卡死了。
查了一圈谷歌,

http://blog.csdn.net/counsellor/article/details/52026234
http://www.cnblogs.com/zjutzz/p/5716251.html

都有启发。
首先看卡死的地方:

$ pip install cqlsh
Collecting cqlsh
Downloading http://mirrors.aliyuncs.com/pypi/packages/12/a7/13aff4ad358ff4abef6823d872154d0955ff6796739fcaaa2c80a6940aa6/cqlsh-5.0.3.tar.gz (99kB)
100% |████████████████████████████████| 102kB 1.6MB/s
Requirement already satisfied: cql in /usr/local/lib/python2.7/site-packages (from cqlsh)
Requirement already satisfied: simplejson in /usr/local/lib/python2.7/site-packages (from cqlsh)
Requirement already satisfied: unittest2 in /usr/local/lib/python2.7/site-packages (from cqlsh)
Collecting cassandra-driver (from cqlsh)
Downloading http://mirrors.aliyuncs.com/pypi/packages/82/db/f5ee4f417b6ed7abf2967dbb249ec1ed9cafb1007cfbe9e6b8c0d6e5d6b4/cassandra-driver-3.7.1.tar.gz (211kB)
100% |████████████████████████████████| 215kB 752kB/s
Requirement already satisfied: thrift in /usr/local/lib/python2.7/site-packages (from cql->cqlsh)
Requirement already satisfied: argparse in /usr/local/lib/python2.7/site-packages (from unittest2->cqlsh)
Requirement already satisfied: six>=1.4 in /usr/local/lib/python2.7/site-packages (from unittest2->cqlsh)
Requirement already satisfied: traceback2 in /usr/local/lib/python2.7/site-packages (from unittest2->cqlsh)
Requirement already satisfied: futures in /usr/local/lib/python2.7/site-packages (from cassandra-driver->cqlsh)
Requirement already satisfied: linecache2 in /usr/local/lib/python2.7/site-packages (from traceback2->unittest2->cqlsh)
Installing collected packages: cassandra-driver, cqlsh
Running setup.py install for cassandra-driver ... -^canceled
Operation cancelled by user

知道是cassandra-driver卡死,从阿里云直接下过来解压看,发现果然是这货去官方源了。
ez_setup.py Line 32
DEFAULT_URL = https://pypi.python.org/packages/source/s/setuptools/"

编辑此处, 改成阿里云的源:
DEFAULT_URL = "https://mirrors.aliyuncs.com/pypi/packages/source/s/setuptools/"
保存。

之后本地运行python setup.py install 发现还是不行:

$ python setup.py install
Unable to find pgen, not compiling formal grammar.
warning: no files found matching '*.pyx' under directory 'Cython/Debugger/Tests'
warning: no files found matching '*.pxd' under directory 'Cython/Debugger/Tests'
warning: no files found matching '*.h' under directory 'Cython/Debugger/Tests'
warning: no files found matching '*.pxd' under directory 'Cython/Utility'

看样子是Cython没装,于是先装Cython。

$ pip install Cython
Collecting Cython
  Downloading http://mirrors.aliyuncs.com/pypi/packages/f2/e3/ca916bbdf7c55225a8037f5f18c43fd8ce5c750d1385e1a6c3ceaf9347bd/Cython-0.25.2-cp
-cp27m-manylinux1_x86_64.whl (6.4MB)
    100% |████████████████████████████████| 6.4MB 369kB/s
Installing collected packages: Cython
Successfully installed Cython-0.25.2

再python setup.py install, 这回又有提示:

$ python setup.py install
Traceback (most recent call last):
  File "setup.py", line 430, in 
    run_setup(None)
  File "setup.py", line 428, in run_setup
    **kw)
  File "/usr/local/lib/python2.7/distutils/core.py", line 111, in setup
    _setup_distribution = dist = klass(attrs)
  File "build/bdist.linux-x86_64/egg/setuptools/dist.py", line 239, in __init__
  File "build/bdist.linux-x86_64/egg/setuptools/dist.py", line 263, in fetch_build_eggs
  File "build/bdist.linux-x86_64/egg/pkg_resources.py", line 580, in resolve
pkg_resources.VersionConflict: (Cython 0.25.2 (/usr/local/lib/python2.7/site-packages), Requirement.parse('Cython>=0.20,<0.25'))

晕死,这个版本还有范围。
找了好久,发现在这个地方:setup.py Line 391:

if pre_build_check():
    kw['setup_requires'] = ['Cython>=0.20,<0.25']
else:
    sys.stderr.write("Bypassing Cython setup requirement\n")

直接改成0.26 试试。
之后安装就成功了。

你可能感兴趣的:(折腾Cassandra 时遇到的安装卡死)