ImportError: cannot import name _NONE

故障现象:
运行pip示例报错

[root@i test-mrq]# mrq-run tasks.Fetch url http://www.google.com
2017-03-18 23:11:18.162884 [DEBUG] mongodb_jobs: Connecting to MongoDB at [('127.0.0.1', 27017)]/mrq...
Traceback (most recent call last):
  File "/usr/bin/mrq-run", line 9, in 
    load_entry_point('mrq==0.1.18', 'console_scripts', 'mrq-run')()
  File "/usr/lib/python2.7/site-packages/mrq/bin/mrq_run.py", line 52, in main
    job = worker_class.job_class(None)
  File "/usr/lib/python2.7/site-packages/mrq/job.py", line 52, in __init__
    self.collection = context.connections.mongodb_jobs.mrq_jobs
  File "/usr/lib/python2.7/site-packages/mrq/utils.py", line 160, in __getattr__
    value = factory(attr)
  File "/usr/lib/python2.7/site-packages/mrq/context.py", line 159, in _connections_factory
    db = MongoClient(config_obj, **kwargs)[mongo_name]
  File "/usr/lib64/python2.7/site-packages/pymongo/mongo_client.py", line 461, in __init__
    self._topology.open()
  File "/usr/lib64/python2.7/site-packages/pymongo/topology.py", line 151, in open
    self._ensure_opened()
  File "/usr/lib64/python2.7/site-packages/pymongo/topology.py", line 378, in _ensure_opened
    self._update_servers()
  File "/usr/lib64/python2.7/site-packages/pymongo/topology.py", line 441, in _update_servers
    server.open()
  File "/usr/lib64/python2.7/site-packages/pymongo/server.py", line 46, in open
    self._monitor.open()
  File "/usr/lib64/python2.7/site-packages/pymongo/monitor.py", line 78, in open
    self._executor.open()
  File "/usr/lib64/python2.7/site-packages/pymongo/periodic_executor.py", line 83, in open
    thread.start()
  File "/usr/lib64/python2.7/threading.py", line 746, in start
    _start_new_thread(self.__bootstrap, ())
  File "/usr/lib64/python2.7/site-packages/gevent/thread.py", line 40, in start_new_thread
    greenlet = Greenlet.spawn(function, *args, **kwargs)
  File "/usr/lib64/python2.7/site-packages/gevent/greenlet.py", line 201, in spawn
    g = cls(*args, **kwargs)
  File "/usr/lib64/python2.7/site-packages/gevent/greenlet.py", line 75, in __init__
    hub = get_hub()
  File "/usr/lib64/python2.7/site-packages/gevent/hub.py", line 169, in get_hub
    hub = _threadlocal.hub = hubtype(*args, **kwargs)
  File "/usr/lib64/python2.7/site-packages/gevent/hub.py", line 268, in __init__
    loop_class = _import(self.loop_class)
  File "/usr/lib64/python2.7/site-packages/gevent/hub.py", line 198, in _import
    return _import(path[-1])
  File "/usr/lib64/python2.7/site-packages/gevent/hub.py", line 210, in _import
    x = __import__(module)
  File "/usr/lib/python2.7/site-packages/mrq/monkey.py", line 150, in mrq_safe_import
    result = orig_import(*args, **kwargs)
  File "core.pyx", line 10, in init gevent.core (gevent/gevent.core.c:41156)
  File "/usr/lib/python2.7/site-packages/mrq/monkey.py", line 150, in mrq_safe_import
    result = orig_import(*args, **kwargs)
  File "/usr/lib64/python2.7/site-packages/gevent/signal.py", line 19, in 
    from gevent._util import _NONE as _INITIAL
ImportError: cannot import name _NONE

解决方法:
cd /usr/local/src
wget https://codeload.github.com/pricingassistant/mrq/zip/master
mv master mrq-master.zip
unzip mrq-master.zip
pip install mrq -e /usr/local/src/mrq-master

原因:
gevent.coros过时了,被gevent.lock替代了

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注