博客 / 詳情

返回

nameko 無法適配新版的python3.14,eventlet 停止維護導致的失效

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.
user avatar
0 位用戶收藏了這個故事!

發佈 評論

Some HTML is okay.