Closed hfr-hfr closed 2 weeks ago
Works out of the box in a vanilla vm.
I had the same issue, make sure to have the pint and inflect packages installed.
pip install pint
pip install inflect
And then rename your site-packages folder to whatever like site-packages.backup
~/.local/share/albert/python/site-packages
And restart albert
Thank you very much @Ghurir , that fixed it for me.
Usually you should get a popup telling you that dependencies are missing and asks you if they should be installed now.
Usually you should get a popup telling you that dependencies are missing and asks you if they should be installed now.
That popup did show and it did install something. Including pint and inflect, according to the popup. Yet the plugin only worked after I manually installed these two packages globally.
Just changed this recently. We'll have to postpone this until 0.27.
While you're at it: You might also want to make the popup stay open after the process is finished. Now it disappears as quickly as it appears - it took me several tries to take the screenshot fast enough. Maybe add a manual close button so the user can actually read if the process was successful or not?
It closes only on success. At least since the commit above. But it has been like that before iirc
Updating albert to version 0.26.3 broke it again. Now manually installing pint
and inflect
doesn't fix it anymore. I'm stuck with the same old error when trying to load the plugin. Purging site-packages
or venv
force the dependencies to load again - but result in the same error. The fix, as pointed out by @Ghurir, only works until 0.26.2 for me. Something in this update made it worse.
Its not worse. it is a fundamental improvement. the python interpreter is now isolated from the system packages. as a side effect you cannot use the hacky workaround. sure there may be bugs. but the method @Ghurir pointed out has never been a solution. please enable the plugin, quit albert, start it from terminal, try to install the dependencies, quit again and post stdout here. (eg using QT_LOGGING_RULES='albert*=true' albert | nc termbin.com 9999
). i need to see whats going on there.
Here you go: https://termbin.com/xkdc Thanks for your great work, didn't mean to disrespect your tremendous work on this project.
and here's the part, where the dependencies are installed again:
19:54:03 [info:albert.python] [42 ms] Python plugin scan 19:54:03 [debg:albert] 7966 ms spent instanciating plugin 'python' 19:54:03 [info:albert.apps] Indexed 115 applications [113 ms] 19:54:03 [warn:albert.apps] No terminal configured. Using Terminal. 19:54:06 [debg:albert.python] Installing pint, inflect. [/home/user/.local/share/albert/python/venv/bin/pip3 install pint inflect] 19:54:07 [debg:albert.python] Collecting pint 19:54:07 [debg:albert.python] Using cached Pint-0.24.3-py3-none-any.whl.metadata (8.5 kB) 19:54:07 [debg:albert.python] Collecting inflect 19:54:07 [debg:albert.python] Using cached inflect-7.4.0-py3-none-any.whl.metadata (21 kB) 19:54:07 [debg:albert.python] Collecting appdirs>=1.4.4 (from pint) 19:54:07 [debg:albert.python] Using cached appdirs-1.4.4-py2.py3-none-any.whl.metadata (9.0 kB) 19:54:07 [debg:albert.python] Collecting typing-extensions (from pint) 19:54:07 [debg:albert.python] Using cached typing_extensions-4.12.2-py3-none-any.whl.metadata (3.0 kB) 19:54:07 [debg:albert.python] Collecting flexcache>=0.3 (from pint) 19:54:07 [debg:albert.python] Using cached flexcache-0.3-py3-none-any.whl.metadata (7.0 kB) 19:54:07 [debg:albert.python] Collecting flexparser>=0.3 (from pint) 19:54:07 [debg:albert.python] Using cached flexparser-0.3.1-py3-none-any.whl.metadata (18 kB) 19:54:07 [debg:albert.python] Collecting more-itertools>=8.5.0 (from inflect) 19:54:07 [debg:albert.python] Using cached more_itertools-10.5.0-py3-none-any.whl.metadata (36 kB) 19:54:07 [debg:albert.python] Collecting typeguard>=4.0.1 (from inflect) 19:54:07 [debg:albert.python] Using cached typeguard-4.3.0-py3-none-any.whl.metadata (3.7 kB) 19:54:07 [debg:albert.python] Using cached Pint-0.24.3-py3-none-any.whl (301 kB) 19:54:07 [debg:albert.python] Using cached inflect-7.4.0-py3-none-any.whl (34 kB) 19:54:07 [debg:albert.python] Using cached appdirs-1.4.4-py2.py3-none-any.whl (9.6 kB) 19:54:07 [debg:albert.python] Using cached flexcache-0.3-py3-none-any.whl (13 kB) 19:54:07 [debg:albert.python] Using cached flexparser-0.3.1-py3-none-any.whl (27 kB) 19:54:07 [debg:albert.python] Using cached more_itertools-10.5.0-py3-none-any.whl (60 kB) 19:54:07 [debg:albert.python] Using cached typeguard-4.3.0-py3-none-any.whl (35 kB) 19:54:07 [debg:albert.python] Using cached typing_extensions-4.12.2-py3-none-any.whl (37 kB) 19:54:07 [debg:albert.python] Installing collected packages: appdirs, typing-extensions, more-itertools, typeguard, flexparser, flexcache, pint, inflect 19:54:08 [debg:albert.python] Successfully installed appdirs-1.4.4 flexcache-0.3 flexparser-0.3.1 inflect-7.4.0 more-itertools-10.5.0 pint-0.24.3 typeguard-4.3.0 typing-extensions-4.12.2 19:54:08 [warn:albert] Failed loading plugin 'python.unit_converter': ImportError: cannot import name 'is_typeddict' from 'typing_extensions' (/usr/lib/python3/dist-packages/typing_extensions.py)
At: /home/user/.local/share/albert/python/venv/lib/python3.10/site-packages/typeguard/_checkers.py(46):
(241): _call_with_frames_removed (883): exec_module (703): _load_unlocked (1006): _find_and_load_unlocked (1027): _find_and_load /home/user/.local/share/albert/python/venv/lib/python3.10/site-packages/typeguard/__init__.py(4): (241): _call_with_frames_removed (883): exec_module (703): _load_unlocked (1006): _find_and_load_unlocked (1027): _find_and_load /home/user/.local/share/albert/python/venv/lib/python3.10/site-packages/inflect/__init__.py(81): (241): _call_with_frames_removed (883): exec_module (703): _load_unlocked (1006): _find_and_load_unlocked (1027): _find_and_load /usr/share/albert/python/plugins/unit_converter/__init__.py(27): (241): _call_with_frames_removed (883): exec_module 19:54:08 [debg:albert] 2 ms spent loading plugin 'python.kill'
again tried a vanilla vm. works ootb.
please quit albert, move .config/albert .cache/albert .local/share/albert somewhere and start albert again to see if it works when started from scratch.
Doesn't work. I already purged the whole app including cache and config when the bug appeared the first time --> no effect. Also this time, moving the folders above, having a fresh start and activating this specific plugin --> results in the same error.
Is this 'typing_extensions' (/usr/lib/python3/dist-packages/typing_extensions.py)
supposed to be a global call?
Here's the log:
11:43:15 [info:albert.python] [29 ms] Python plugin scan 11:43:15 [debg:albert] 6628 ms spent instanciating plugin 'python' 11:43:30 [debg:albert.python] Installing pint, inflect. [/home/user/.local/share/albert/python/venv/bin/pip3 install pint inflect] 11:43:31 [debg:albert.python] Collecting pint 11:43:31 [debg:albert.python] Using cached Pint-0.24.3-py3-none-any.whl.metadata (8.5 kB) 11:43:31 [debg:albert.python] Collecting inflect 11:43:31 [debg:albert.python] Using cached inflect-7.4.0-py3-none-any.whl.metadata (21 kB) 11:43:31 [debg:albert.python] Collecting appdirs>=1.4.4 (from pint) 11:43:31 [debg:albert.python] Using cached appdirs-1.4.4-py2.py3-none-any.whl.metadata (9.0 kB) 11:43:31 [debg:albert.python] Collecting typing-extensions (from pint) 11:43:31 [debg:albert.python] Using cached typing_extensions-4.12.2-py3-none-any.whl.metadata (3.0 kB) 11:43:31 [debg:albert.python] Collecting flexcache>=0.3 (from pint) 11:43:31 [debg:albert.python] Using cached flexcache-0.3-py3-none-any.whl.metadata (7.0 kB) 11:43:31 [debg:albert.python] Collecting flexparser>=0.3 (from pint) 11:43:31 [debg:albert.python] Using cached flexparser-0.3.1-py3-none-any.whl.metadata (18 kB) 11:43:31 [debg:albert.python] Collecting more-itertools>=8.5.0 (from inflect) 11:43:31 [debg:albert.python] Using cached more_itertools-10.5.0-py3-none-any.whl.metadata (36 kB) 11:43:31 [debg:albert.python] Collecting typeguard>=4.0.1 (from inflect) 11:43:31 [debg:albert.python] Using cached typeguard-4.3.0-py3-none-any.whl.metadata (3.7 kB) 11:43:31 [debg:albert.python] Using cached Pint-0.24.3-py3-none-any.whl (301 kB) 11:43:31 [debg:albert.python] Using cached inflect-7.4.0-py3-none-any.whl (34 kB) 11:43:31 [debg:albert.python] Using cached appdirs-1.4.4-py2.py3-none-any.whl (9.6 kB) 11:43:31 [debg:albert.python] Using cached flexcache-0.3-py3-none-any.whl (13 kB) 11:43:31 [debg:albert.python] Using cached flexparser-0.3.1-py3-none-any.whl (27 kB) 11:43:31 [debg:albert.python] Using cached more_itertools-10.5.0-py3-none-any.whl (60 kB) 11:43:31 [debg:albert.python] Using cached typeguard-4.3.0-py3-none-any.whl (35 kB) 11:43:31 [debg:albert.python] Using cached typing_extensions-4.12.2-py3-none-any.whl (37 kB) 11:43:31 [debg:albert.python] Installing collected packages: appdirs, typing-extensions, more-itertools, typeguard, flexparser, flexcache, pint, inflect 11:43:32 [debg:albert.python] Successfully installed appdirs-1.4.4 flexcache-0.3 flexparser-0.3.1 inflect-7.4.0 more-itertools-10.5.0 pint-0.24.3 typeguard-4.3.0 typing-extensions-4.12.2 11:43:32 [warn:albert] Failed loading plugin 'python.unit_converter': ImportError: cannot import name 'is_typeddict' from 'typing_extensions' (/usr/lib/python3/dist-packages/typing_extensions.py)
At: /home/user/.local/share/albert/python/venv/lib/python3.10/site-packages/typeguard/_checkers.py(46):
(241): _call_with_frames_removed (883): exec_module (703): _load_unlocked (1006): _find_and_load_unlocked (1027): _find_and_load /home/user/.local/share/albert/python/venv/lib/python3.10/site-packages/typeguard/__init__.py(4): (241): _call_with_frames_removed (883): exec_module (703): _load_unlocked (1006): _find_and_load_unlocked (1027): _find_and_load /home/user/.local/share/albert/python/venv/lib/python3.10/site-packages/inflect/__init__.py(81): (241): _call_with_frames_removed (883): exec_module (703): _load_unlocked (1006): _find_and_load_unlocked (1027): _find_and_load /usr/share/albert/python/plugins/unit_converter/__init__.py(27): (241): _call_with_frames_removed (883): exec_module
see https://github.com/albertlauncher/python/commit/cda9f21426daa10e8e75fcdc3c86f38f0d73007c
please pull and check again
@hfr-hfr please show a full log using 26.3 the one above is not up to date. and i wonder what is prints . because ImportError: cannot import name 'is_typeddict' from 'typing_extensions' (/usr/lib/python3/dist-packages/typing_extensions.py)
is a system package.
That's what I meant: Is it supposed to call the system package?
Here's the new log (using 26.3 & having pulled the above commit), same error: https://termbin.com/iuey
Is it supposed to call the system package?
No. I think I found at least one problem. site_import is enabled even if the Python interpreter is set up in isolated mode.
Can this be made optional at least?
I do want my system packages to be available to save space. In fact, I just want Albert Launcher to use system Python without a Virtualenv.
I use PDM locally to develop too, which also got broken by this commit.
Since this commit now I have to just symlink all my packages over.
I am thinking about changing dependency management anyway. Venvs in the embedded case are cumbersome because the used python interpreter is set at init time while at this time the venv should be initialized already but for this the interpreter must be used. Currently the system interpreter is used. On some systems these two are not the same. that's the root of lots of bugs we had in the past. On the other hand system packages are quite outdated on some systems or not even available. 😒
Some sort of option would be great. I understand some people might have outdated packages, but for me, my Arch Linux packages are always up-to-date.
My aim is to just reduce duplicate items clogging up the filesystem and disk space.
You could just allow the user to choose a PATH for his python environment and make sure he has at least version xx then? I have now an MacOS own python, a downloaded python since your PATH is hardcoded and a homebrew venv ^^ I can understand the trouble from that point.
For me I don't always want a Virtualenv (I use PDM for PEP 582, with my own plugins). I just want to use the system Python.
I'll just use a Virtualenv if I use some plugin that needs it.
This was rather confusing for me😃. With a minor new version of albert, suddenly I needed to add a line like below to my custom python plugin.
md_lib_dependencies = "ZZZ"
Without this line, when I clicked the button to install dependencies into the virtual environment, then I got a strange error message which I only managed to track down by reading the albert source code.
It would be great to help users out here. I raised #1471.
Thats expected behavior. You have to specify the third party dependencies for your plugin. From 0.26.6 the python plugins venv is entirely separate from the system to avoid having conflicts.
Package source
official package
App logs
Current Behavior
Plug-in unit_converter fails to load. --> ImportError on
typing_extensions.
Expected Behavior
Plug-in should load without failing.
Anything else?
Deleting
site-packages
and re-installing dependencies does not fix it. Neither does a clean re-install of albert launcher.