poljar / weechat-matrix

Weechat Matrix protocol script written in python
Other
958 stars 120 forks source link

Module not found: 'logbook' #225

Open namebee opened 4 years ago

namebee commented 4 years ago

ModuleNotFoundError: No module named 'logbook'

This is my first time using Weechat, I'm on Python 3.8.3 and I have all requirements installed. No clue why this isn't working.

I'll gladly give more info, I'm not sure what info you guys need though.

Edit: I've checked now that this happens for all modules, Not just logbook.

poljar commented 4 years ago

Are you sure that all requirements are installed? It's complaining that it can't find logbook which is listed as a requirement.

namebee commented 4 years ago

Yes, Everything is installed. If I comment out import logbook it complains about OpenSSL not being there.

Screenshot 2020-07-13 at 11 30 18 AM

trygveaa commented 4 years ago

Maybe you have installed the dependencies for a different Python installation from the one used in WeeChat? Try to run these commands in Weechat to check:

/python eval import sys; print(sys.path)
/plugin listfull python
mesozoic-technology commented 2 years ago

How to fix this?

/python eval import sys; print(sys.path) gives:

 ['/Users/myaccount/.local/share/weechat/python', '/usr/local/Cellar/weechat/3.3_1/share/weechat/python', '',
         │             | '/usr/local/opt/python@3.10/Frameworks/Python.framework/Versions/3.10/lib/python310.zip',
         │             | '/usr/local/opt/python@3.10/Frameworks/Python.framework/Versions/3.10/lib/python3.10',
         │             | '/usr/local/opt/python@3.10/Frameworks/Python.framework/Versions/3.10/lib/python3.10/lib-dynload',
         │             | '/usr/local/opt/python@3.10/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages']

and /plugin listfull python gives:

         │00:00:43     | 
         │00:00:43     |   python [v3.3]: Support of python scripts (/usr/local/Cellar/weechat/3.3_1/lib/weechat/plugins/python.so)
         │00:00:43     |   written by "Sébastien Helleu <flashcode@flashtux.org>", license: GPL3
         │00:00:43     |     commands hooked:
         │00:00:43     |       /python (list/load/unload scripts)
         │00:00:43     |     signals hooked:
         │00:00:43     |       signal: debug_dump
         │00:00:43     |       signal: debug_libs
         │00:00:43     |       signal: python_script_install
         │00:00:43     |       signal: python_script_remove
         │00:00:43     |       signal: python_script_autoload
         │00:00:43     |     completions hooked:
         │00:00:43     |         python_script
trygveaa commented 2 years ago

@realisation: Have you run pip install -r requirements.txt? If so, what does pip list -v output?

bimawa commented 2 years ago

Same issue all dependencies installed

bimawa commented 2 years ago

CleanShot 2021-12-23 at 02 17 00 CleanShot 2021-12-23 at 02 19 41

mesozoic-technology commented 2 years ago

@realisation: Have you run pip install -r requirements.txt? If so, what does pip list -v output?

I made a gist to show the output since its fairly verbose -

https://gist.github.com/realisation/ee4558615347e0d867c9e7d3f37358cb

trygveaa commented 2 years ago

@realisation: So WeeChat is using the Python install in /usr/local/opt/python@3.10/Frameworks/Python.framework/Versions/3.10, but pip is using the one in /usr/local/anaconda3/lib/python3.8. You have to either install the packages in /usr/local/opt/python@3.10/Frameworks/Python.framework/Versions/3.10 (you could try using /usr/local/opt/python@3.10/Frameworks/Python.framework/Versions/3.10/bin/pip), use a virtualenv, or run WeeChat against the Python in /usr/local/anaconda3/lib/python3.8.

@bimawa: You likely have a similar issue. Make sure you have installed the dependencies in the Python installation that WeeChat is using. You can check which Python installation WeeChat uses with /python eval import sys; print(sys.path).

bimawa commented 2 years ago

@trygveaa Yes its helped! /python eval import sys; print(sys.path): return /usr/local/opt/python@3.10/Frameworks/Python.framework/Versions/3.10/lib/python3.10 I did /usr/local/opt/python@3.10/Frameworks/Python.framework/Versions/3.10/bin/pip3.10 install -r requirements.txt after /script load matrix.py I got new issue :(

CleanShot 2021-12-25 at 20 18 14

But that looks like the other question?

trygveaa commented 2 years ago

@bimawa: That last error is reported in #293. Seems like a bug in Python 3.10.

bimawa commented 2 years ago

Oh. ok thanks a lot!

ikwyl6 commented 2 years ago

I also get this error. I installed the requirements.txt under a virtualenv within ~/.weechat/python/venv/ Python version within weechat: /python version gives python: 3.10.4 command line python version: $ python --version Python 3.10.4

I did an /upgrade within weechat incase something had to be loaded from a previous update and still get the same error: I link my main.py from my weechat-matrix git cloned dir to my ~/.weechat/python/matrix.py file.

here is the error within weechat:


python: stdout/stderr (?): Traceback (most recent call last):
python: stdout/stderr (?):   File "/mnt/wd1000/BTSync/RPi conf files/weechat/python/matrix.py", line 41, in <module>
python: stdout/stderr (?):     import logbook
python: stdout/stderr (?): ModuleNotFoundError: No module named 'logbook'
python: unable to parse file "/mnt/wd1000/BTSync/RPi conf files/weechat/python/matrix.py"```

thanks for any help to try and to get weechat-matrix loaded!
ikwyl6 commented 2 years ago

To add info from previous questions, see my pip list -v attached file.. weechat_matrix.pip.show.txt

Would love to get weechat-matrix working! Thanks for any help ahead of time...

clort81 commented 1 year ago

To add info from previous questions, see my pip list -v attached file.. weechat_matrix.pip.show.txt

Would love to get weechat-matrix working! Thanks for any help ahead of time...

does your distro have a python logbook? on my system i solved with apt install -y python3-logbook distros manage to fix some of python's dumpster fire

ikwyl6 commented 1 year ago

It does now.. I haven't looked at this since submitting my comment back in June 2022.. But now it doesn't list Logbook under pip (maybe it was removed with some kind of update.. or I removed it not sure) but now the pkg is available under pacman and I installed the packages through it and any other requirements/dependencies and it now works! Thanks for the shove/bump as it made me re-look at it and now loads in weechat after these few steps..