Search code examples
pythonpython-3.xshadowsocksmutablemapping

shadowsocks AttributeError: module 'collections' has no attribute 'MutableMapping'


I was trying to set up an VPN on Vultr via Shadowsocks, and trying to run Shadowsocks service manually. I tried below in my bash:

sudo ssserver -c /etc/shadowsocks.json

It has error: AttributeError: module 'collections' has no attribute 'MutableMapping'

I am using Python 3.10.12 version

below is the ERROR:

    root@vpn-test:~# sudo ssserver -c /etc/shadowsocks.json 
Traceback (most recent call last):
  File "/usr/local/bin/ssserver", line 5, in <module>
    from shadowsocks.server import main
  File "/usr/local/lib/python3.10/dist-packages/shadowsocks/server.py", line 27, in <module>
    from shadowsocks import shell, daemon, eventloop, tcprelay, udprelay, \
  File "/usr/local/lib/python3.10/dist-packages/shadowsocks/udprelay.py", line 71, in <module>
    from shadowsocks import encrypt, eventloop, lru_cache, common, shell
  File "/usr/local/lib/python3.10/dist-packages/shadowsocks/lru_cache.py", line 34, in <module>
    class LRUCache(collections.MutableMapping):
AttributeError: module 'collections' has no attribute 'MutableMapping'
root@vpn-test:~# 

Solution

  • Version 2.8.2 is very old, it was good till python 3.9.

    Please use the latest shadowsocks v5.3.3

    Here is the link: https://gist.github.com/zhiguangwang/7018fbc0a38a5b663868

    Hopefully your error will go away.