nameko 无法适配新版的python3.14,eventlet 停止维护导致的 1 RLock(s) were not greened 报错
用于测试的代码
from nameko.rpc import rpc
class HelloService:
name = "hello_service"
@rpc
def hello(self, name):
return "Hello, {}!".format(name)
直接把 nameko2.14.1 用到 python3.14 上会报错 ModuleNotFoundError: No module named 'pkg_resources'
修复之后还是会有警告
╰─➤ nameko run --config config.yaml run_services
1 RLock(s) were not greened, to fix this error make sure you run eventlet.monkey_patch() before importing any other modules.
starting services: greeting_service
Connected to amqp://ponponon:**@192.168.31.245:5672//
这个 1 RLock(s) were not greened 不是因为 nameko 的问题,而是来自 eventlet 本身的问题:https://github.com/eventlet/eventlet
我通过降低 cpython 版本做测试,发现 cpython3.13 也有这个问题;直到降级到 cpython3.12 则没有这个问题了
而大于 3.12 的版本就会遇到下面的问题
╰─➤ ipython 1 ↵
Python 3.14.2 (main, Dec 5 2025, 16:49:16) [Clang 17.0.0 (clang-1700.4.4.1)]
Type 'copyright', 'credits' or 'license' for more information
IPython 9.9.0 -- An enhanced Interactive Python. Type '?' for help.
Tip: Use `object?` to see the help on `object`, `object??` to view its source
Cmd click to launch VS Code Native REPL
In [1]: exec('import eventlet; eventlet.monkey_patch()')
<string>:1: DeprecationWarning:
Eventlet is deprecated. It is currently being maintained in bugfix mode, and
we strongly recommend against using it for new projects.
If you are already using Eventlet, we recommend migrating to a different
framework. For more detail see
https://eventlet.readthedocs.io/en/latest/asyncio/migration.html
1 RLock(s) were not greened, to fix this error make sure you run eventlet.monkey_patch() before importing any other modules.
IT极限技术分享汇