weechat-matrix icon indicating copy to clipboard operation
weechat-matrix copied to clipboard

Loading script --> No module named nio (Raspbian Buster)

Open ghost opened this issue 6 years ago • 9 comments

I first had problems building olm3 but somehow I managed to do it.

After that, the command pip install -r requirements.txt gave no error, but I needed to use it as 'sudo', since otherwise it complained of lack of permissions.

When loading as /script load matrix.py I get the error: python: stdout/stderr (?): Traceback (most recent call last): python: stdout/stderr (?): Traceback (most recent call last): python: stdout/stderr (?): File "/home/pi/.weechat/python/matrix.py", line 52, in <module> python: stdout/stderr (?): from nio import RemoteProtocolError, RemoteTransportError, TransportType python: stdout/stderr (?): ImportError: No module named nio python: unable to parse file "/home/pi/.weechat/python/matrix.py"

If I open a python console (it says Python 2.7.16) and type import nio I get: Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: No module named nio

It may be a python issue on my part, but I cannot see how to solve this. Thanks!

ghost avatar Nov 21 '19 12:11 ghost

This might be due to python version mismatches. Please check the output of the /python version command inside of Weechat and the output of pip --version from your shell.

If you can't import nio from the python interpreter Weechat won't be able to find it either.

poljar avatar Nov 21 '19 17:11 poljar

Thank you for the answer. Here is the output:

/python version 2.7.15+

:~ $ sudo pip --version pip 18.1 from /usr/lib/python2.7/dist-packages/pip (python 2.7)

Why did I write sudo? Because without sudo I got this: (could it be the cause of my problem?)

pip version Traceback (most recent call last): File "/usr/bin/pip", line 9, in <module> from pip._internal import main File "/usr/lib/python2.7/dist-packages/pip/_internal/__init__.py", line 19, in <module> from pip._vendor.urllib3.exceptions import DependencyWarning File "/usr/lib/python2.7/dist-packages/pip/_vendor/__init__.py", line 77, in <module> vendored("pkg_resources") File "/usr/lib/python2.7/dist-packages/pip/_vendor/__init__.py", line 36, in vendored __import__(modulename, globals(), locals(), level=0) File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 3191, in <module> File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 3175, in _call_aside File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 3204, in _initialize_master_working_set File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 574, in _build_master File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 567, in __init__ File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 623, in add_entry File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 2033, in find_on_path File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 2095, in distributions_from_metadataOSError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/zipp-0.6.0.dist-info'

ghost avatar Nov 21 '19 17:11 ghost

Could be. But I would assume that you would get the same error when trying to import nio from the python interpreter in that case.

poljar avatar Nov 21 '19 18:11 poljar

Your assumption is correct. In the python interpreter I cannot import nio either. Yet the install of weechat-matrix did not complain.

ghost avatar Nov 21 '19 21:11 ghost

I too had to install nio by hand (debian stretch). After doing I still cannot use the script. I believe it's a bug in nio, so I opened an issue there.

autra avatar Mar 13 '20 08:03 autra

@autra I think you installed the wrong nio.

auscompgeek avatar Jun 10 '20 06:06 auscompgeek

I get this:

python: loading script "/home/usr/.weechat/python/matrix.py" │17:18:32 | python: stdout/stderr (?): Traceback (most recent call last): │17:18:32 | python: stdout/stderr (?): File "/home/usr/.weechat/python/matrix.py", line 53, in │17:18:32 | python: stdout/stderr (?): from nio import RemoteProtocolError, RemoteTransportError, TransportType │17:18:32 | python: stdout/stderr (?): ImportError: cannot import name 'RemoteProtocolError' from 'nio' │ | (/home/usr/.local/lib/python3.8/site-packages/nio/init.py) │17:18:32 =!= | python: unable to parse file "/home/usr/.weechat/python/matrix.py"

ghost1347 avatar Jan 30 '21 22:01 ghost1347

I get this:

python: loading script "/home/usr/.weechat/python/matrix.py" │17:18:32 | python: stdout/stderr (?): Traceback (most recent call last): │17:18:32 | python: stdout/stderr (?): File "/home/usr/.weechat/python/matrix.py", line 53, in │17:18:32 | python: stdout/stderr (?): from nio import RemoteProtocolError, RemoteTransportError, TransportType │17:18:32 | python: stdout/stderr (?): ImportError: cannot import name 'RemoteProtocolError' from 'nio' │ | (/home/usr/.local/lib/python3.8/site-packages/nio/init.py) │17:18:32 =!= | python: unable to parse file "/home/usr/.weechat/python/matrix.py"

I am stuck at this exact same issue, matrix-nio is the only one I have installed.

kaizushi avatar Dec 20 '21 13:12 kaizushi

If you got at this old issue (like me 😝) the correct version of nio client library is matrix-nio [poljar/matrix-nio]. Its repository poljar/matrix-nio

nitaicharan avatar Jul 27 '22 19:07 nitaicharan