albertlauncher / albert

A fast and flexible keyboard launcher
https://albertlauncher.github.io
Other
7.26k stars 305 forks source link

[python] not properly isolated from system #1423

Closed hfr-hfr closed 2 weeks ago

hfr-hfr commented 2 months ago

Package source

official package

App logs

QT_LOGGING_RULES='albert*=true' albert --platform xcb
14:05:05 [debg:albert]        Albert version: 0.26.1
14:05:05 [debg:albert]            Build date: Aug 20 2024 23:10:00
14:05:05 [debg:albert]            Qt version: 6.2.4
14:05:05 [debg:albert]             Build ABI: x86_64-little_endian-lp64
14:05:05 [debg:albert]    Build architecture: x86_64
14:05:05 [debg:albert]      CPU architecture: x86_64
14:05:05 [debg:albert]           Kernel type: linux
14:05:05 [debg:albert]        Kernel version: 6.8.0-40-generic
14:05:05 [debg:albert]                    OS: Ubuntu 22.04.4 LTS
14:05:05 [debg:albert]               OS type: ubuntu
14:05:05 [debg:albert]            OS version: 22.04
14:05:05 [debg:albert]         Platform name: xcb
14:05:05 [debg:albert]            Style name: fusion
14:05:05 [debg:albert]      Available styles: Windows, Fusion
14:05:05 [debg:albert]            Icon theme: Yaru-blue
14:05:05 [debg:albert]                  Font: Ubuntu,11,-1,5,400,0,0,0,0,0,0,0,0,0,0,1
14:05:05 [debg:albert]              Language: English
14:05:05 [debg:albert]                Locale: en_US
14:05:05 [debg:albert]       Binary location: /usr/bin/albert
14:05:05 [debg:albert]           Working dir: /home/USER/.local/share/albert/python
14:05:05 [debg:albert]             Arguments: albert
14:05:05 [debg:albert] ENVIRONMENT:
14:05:05 [debg:albert]             COLORTERM: truecolor
14:05:05 [debg:albert]     CONDA_DEFAULT_ENV: base
14:05:05 [debg:albert]             CONDA_EXE: /home/USER/anaconda3/bin/conda
14:05:05 [debg:albert]          CONDA_PREFIX: /home/USER/anaconda3
14:05:05 [debg:albert] CONDA_PROMPT_MODIFIER: (base) 
14:05:05 [debg:albert]      CONDA_PYTHON_EXE: /home/USER/anaconda3/bin/python
14:05:05 [debg:albert]           CONDA_SHLVL: 1
14:05:05 [debg:albert] DBUS_SESSION_BUS_ADDRESS: unix:path=/run/user/1000/bus
14:05:05 [debg:albert]         DEFAULTS_PATH: /usr/share/gconf/ubuntu-xorg.default.path
14:05:05 [debg:albert]       DESKTOP_SESSION: ubuntu-xorg
14:05:05 [debg:albert]               DISPLAY: :0
14:05:05 [debg:albert]            GDMSESSION: ubuntu-xorg
14:05:05 [debg:albert] GNOME_DESKTOP_SESSION_ID: this-is-deprecated
14:05:05 [debg:albert] GNOME_SHELL_SESSION_MODE: ubuntu
14:05:05 [debg:albert] GNOME_TERMINAL_SCREEN: GNOME_TERMINAL_SCREEN
14:05:05 [debg:albert] GNOME_TERMINAL_SERVICE: :1.125
14:05:05 [debg:albert]        GPG_AGENT_INFO: GPG_AGENT_INFO
14:05:05 [debg:albert]         GTK_IM_MODULE: ibus
14:05:05 [debg:albert]           GTK_MODULES: gail:atk-bridge
14:05:05 [debg:albert]                  HOME: /home/USER
14:05:05 [debg:albert]       IM_CONFIG_PHASE: 1
14:05:05 [debg:albert]                  LANG: en_US.UTF-8
14:05:05 [debg:albert]              LANGUAGE: en_US:en
14:05:05 [debg:albert]            LC_ADDRESS: en_US.UTF-8
14:05:05 [debg:albert]     LC_IDENTIFICATION: en_US.UTF-8
14:05:05 [debg:albert]        LC_MEASUREMENT: en_US.UTF-8
14:05:05 [debg:albert]           LC_MONETARY: en_US.UTF-8
14:05:05 [debg:albert]               LC_NAME: en_US.UTF-8
14:05:05 [debg:albert]            LC_NUMERIC: en_US.UTF-8
14:05:05 [debg:albert]              LC_PAPER: en_US.UTF-8
14:05:05 [debg:albert]          LC_TELEPHONE: en_US.UTF-8
14:05:05 [debg:albert]               LC_TIME: en_US.UTF-8
14:05:05 [debg:albert]             LESSCLOSE: /usr/bin/lesspipe %s %s
14:05:05 [debg:albert]              LESSOPEN: | /usr/bin/lesspipe %s
14:05:05 [debg:albert]               LOGNAME: USER
14:05:05 [debg:albert]             LS_COLORS: rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.webp=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:
14:05:05 [debg:albert]        MANDATORY_PATH: /usr/share/gconf/ubuntu-xorg.mandatory.path
14:05:05 [debg:albert]                OLDPWD: /home/USER/.local/share/albert/python/site-packages
14:05:05 [debg:albert]             PAPERSIZE: a4
14:05:05 [debg:albert]                  PATH: /home/USER/anaconda3/bin:/home/USER/anaconda3/condabin:/home/USER/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin
14:05:05 [debg:albert]                   PWD: /home/USER/.local/share/albert/python
14:05:05 [debg:albert]      QT_ACCESSIBILITY: 1
14:05:05 [debg:albert]          QT_IM_MODULE: ibus
14:05:05 [debg:albert]      QT_LOGGING_RULES: albert*=true
14:05:05 [debg:albert]       SESSION_MANAGER: SESSION_MANAGER
14:05:05 [debg:albert]                 SHELL: /bin/bash
14:05:05 [debg:albert]                 SHLVL: 1
14:05:05 [debg:albert]    SSH_AGENT_LAUNCHER: SSH_AGENT_LAUNCHER
14:05:05 [debg:albert]         SSH_AUTH_SOCK: SSH_AUTH_SOCK
14:05:05 [debg:albert]      SYSTEMD_EXEC_PID: SYSTEMD_EXEC_PID
14:05:05 [debg:albert]                  TERM: xterm-256color
14:05:05 [debg:albert]                  USER: USER
14:05:05 [debg:albert]              USERNAME: USER
14:05:05 [debg:albert]           VTE_VERSION: 6800
14:05:05 [debg:albert]            WINDOWPATH: 2
14:05:05 [debg:albert]            XAUTHORITY: /run/user/1000/gdm/Xauthority
14:05:05 [debg:albert]       XDG_CONFIG_DIRS: /etc/xdg/xdg-ubuntu-xorg:/etc/xdg
14:05:05 [debg:albert]   XDG_CURRENT_DESKTOP: ubuntu:GNOME
14:05:05 [debg:albert]         XDG_DATA_DIRS: /usr/share/ubuntu-xorg:/usr/share/gnome:/usr/local/share/:/usr/share/:/var/lib/snapd/desktop
14:05:05 [debg:albert]       XDG_MENU_PREFIX: gnome-
14:05:05 [debg:albert]       XDG_RUNTIME_DIR: /run/user/1000
14:05:05 [debg:albert]     XDG_SESSION_CLASS: user
14:05:05 [debg:albert]   XDG_SESSION_DESKTOP: ubuntu-xorg
14:05:05 [debg:albert]      XDG_SESSION_TYPE: x11
14:05:05 [debg:albert]            XMODIFIERS: @im=ibus
14:05:05 [debg:albert]                     _: /usr/bin/albert
14:05:05 [debg:albert]             _CE_CONDA: 
14:05:05 [debg:albert]                 _CE_M: 
14:05:05 [debg:albert] Checking for a running instance…
14:05:05 [debg:albert] Creating local server /home/USER/.cache/albert/ipc_socket
14:05:05 [info:albert] Searching native plugins in /usr/lib/x86_64-linux-gnu/albert
14:05:05 [debg:albert] Found valid native plugin /usr/lib/x86_64-linux-gnu/albert/websearch.so
14:05:05 [debg:albert] Found valid native plugin /usr/lib/x86_64-linux-gnu/albert/clipboard.so
14:05:05 [debg:albert] Found valid native plugin /usr/lib/x86_64-linux-gnu/albert/datetime.so
14:05:05 [debg:albert] Found valid native plugin /usr/lib/x86_64-linux-gnu/albert/qmlboxmodel.so
14:05:05 [debg:albert] Found valid native plugin /usr/lib/x86_64-linux-gnu/albert/calculator_qalculate.so
14:05:05 [debg:albert] Found valid native plugin /usr/lib/x86_64-linux-gnu/albert/files.so
14:05:05 [debg:albert] Found valid native plugin /usr/lib/x86_64-linux-gnu/albert/system.so
14:05:05 [debg:albert] Found valid native plugin /usr/lib/x86_64-linux-gnu/albert/timer.so
14:05:05 [debg:albert] Found valid native plugin /usr/lib/x86_64-linux-gnu/albert/hash.so
14:05:05 [debg:albert] Found valid native plugin /usr/lib/x86_64-linux-gnu/albert/ssh.so
14:05:05 [debg:albert] Found valid native plugin /usr/lib/x86_64-linux-gnu/albert/docs.so
14:05:05 [debg:albert] Found valid native plugin /usr/lib/x86_64-linux-gnu/albert/applications.so
14:05:05 [debg:albert] Found valid native plugin /usr/lib/x86_64-linux-gnu/albert/python.so
14:05:05 [debg:albert] Found valid native plugin /usr/lib/x86_64-linux-gnu/albert/timezones.so
14:05:05 [debg:albert] Found valid native plugin /usr/lib/x86_64-linux-gnu/albert/chromium.so
14:05:05 [debg:albert] Found valid native plugin /usr/lib/x86_64-linux-gnu/albert/snippets.so
14:05:05 [debg:albert] Found valid native plugin /usr/lib/x86_64-linux-gnu/albert/mpris.so
14:05:05 [debg:albert] Found valid native plugin /usr/lib/x86_64-linux-gnu/albert/urlhandler.so
14:05:05 [debg:albert] Found valid native plugin /usr/lib/x86_64-linux-gnu/albert/widgetsboxmodel.so
14:05:05 [debg:albert] Found valid native plugin /usr/lib/x86_64-linux-gnu/albert/path.so
14:05:05 [debg:albert] Connecting to database…
14:05:05 [debg:albert] Initializing database…
14:05:05 [debg:albert] Updating usage scores…
14:05:05 [debg:albert] Try loading the configured frontend 'widgetsboxmodel'.
14:05:05 [info:albert] Hotkey set to Ctrl+Space
14:05:05 [debg:albert] 5 ms spent loading plugin 'websearch'
14:05:05 [debg:albert] 0 ms spent instanciating plugin 'websearch'
14:05:05 [debg:albert] 0 ms spent loading plugin 'urlhandler'
14:05:05 [debg:albert] 0 ms spent instanciating plugin 'urlhandler'
14:05:05 [debg:albert] 0 ms spent loading plugin 'system'
14:05:05 [debg:albert] 0 ms spent instanciating plugin 'system'
14:05:05 [debg:albert] 6 ms spent loading plugin 'calculator_qalculate'
14:05:05 [debg:albert] 42 ms spent instanciating plugin 'calculator_qalculate'
14:05:05 [debg:albert] 0 ms spent loading plugin 'applications'
14:05:05 [debg:albert] 0 ms spent instanciating plugin 'applications'
14:05:05 [debg:albert] 1 ms spent loading plugin 'python'
14:05:05 [debg:albert.apps] Skipped desktop entry '/usr/share/applications/APP.desktop': Desktop entry excluded by 'NoDisplay'.
(...)
14:05:05 [debg:albert.python] Python version: 3.10.12 (main, Jul 29 2024, 16:56:48) [GCC 11.4.0]
14:05:05 [debg:albert.python] Python path: QList(, /usr/lib/python310.zip, /usr/lib/python3.10, /usr/lib/python3.10/lib-dynload, /usr/local/lib/python3.10/dist-packages, /usr/lib/python3/dist-packages)
14:05:05 [debg:albert.python] Searching Python plugins in /home/USER/.local/share/albert/python/plugins
14:05:05 [debg:albert.python] Invalid plugin (Path is not a python file): /home/USER/.local/share/albert/python/plugins/albert.pyi
14:05:05 [debg:albert.python] Searching Python plugins in /usr/share/albert/python/plugins
14:05:05 [debg:albert.apps] Skipped desktop entry '/usr/share/applications/APP.desktop': Desktop entry excluded by 'NoDisplay'.
(...)
14:05:05 [debg:albert.python] Invalid plugin (Path is not a python file): /usr/share/albert/python/plugins/CONTRIBUTING.md
(...)
14:05:05 [debg:albert.python] Invalid plugin (Path is not a python file): /usr/share/albert/python/plugins/README.md
(...)
14:05:05 [info:albert.python] [23 ms] Python plugin scan
14:05:05 [debg:albert] 40 ms spent instanciating plugin 'python'
14:05:05 [debg:albert.apps] Skipped desktop entry '/usr/share/applications/APP.desktop': Desktop entry excluded by 'NoDisplay'.
(...)
14:05:05 [info:albert.apps] Indexed 50 applications [51 ms]
14:05:05 [warn:albert.apps] No terminal configured. Using Terminal.
14:05:05 [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/site-packages/typeguard/_checkers.py(46): <module>
  <frozen importlib._bootstrap>(241): _call_with_frames_removed
  <frozen importlib._bootstrap_external>(883): exec_module
  <frozen importlib._bootstrap>(703): _load_unlocked
  <frozen importlib._bootstrap>(1006): _find_and_load_unlocked
  <frozen importlib._bootstrap>(1027): _find_and_load
  /home/USER/.local/share/albert/python/site-packages/typeguard/__init__.py(4): <module>
  <frozen importlib._bootstrap>(241): _call_with_frames_removed
  <frozen importlib._bootstrap_external>(883): exec_module
  <frozen importlib._bootstrap>(703): _load_unlocked
  <frozen importlib._bootstrap>(1006): _find_and_load_unlocked
  <frozen importlib._bootstrap>(1027): _find_and_load
  /home/USER/.local/share/albert/python/site-packages/inflect/__init__.py(81): <module>
  <frozen importlib._bootstrap>(241): _call_with_frames_removed
  <frozen importlib._bootstrap_external>(883): exec_module
  <frozen importlib._bootstrap>(703): _load_unlocked
  <frozen importlib._bootstrap>(1006): _find_and_load_unlocked
  <frozen importlib._bootstrap>(1027): _find_and_load
  /usr/share/albert/python/plugins/unit_converter/__init__.py(27): <module>
  <frozen importlib._bootstrap>(241): _call_with_frames_removed
  <frozen importlib._bootstrap_external>(883): exec_module

14:05:05 [debg:albert] 1 ms spent loading plugin 'python.kill'

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.

ManuelSchneid3r commented 2 months ago

VirtualBox_Ubuntu 22

Works out of the box in a vanilla vm.

Ghurir commented 1 month ago

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

hfr-hfr commented 1 month ago

Thank you very much @Ghurir , that fixed it for me.

ManuelSchneid3r commented 1 month ago

Usually you should get a popup telling you that dependencies are missing and asks you if they should be installed now.

hfr-hfr commented 1 month ago

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.

albert

ManuelSchneid3r commented 1 month ago

Just changed this recently. We'll have to postpone this until 0.27.

hfr-hfr commented 1 month ago

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?

ManuelSchneid3r commented 1 month ago

It closes only on success. At least since the commit above. But it has been like that before iirc

hfr-hfr commented 1 month ago

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.

ManuelSchneid3r commented 1 month ago

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.

hfr-hfr commented 1 month ago

Here you go: https://termbin.com/xkdc Thanks for your great work, didn't mean to disrespect your tremendous work on this project.

hfr-hfr commented 1 month ago

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'
ManuelSchneid3r commented 1 month ago

again tried a vanilla vm. works ootb.

Bildschirmfoto 2024-09-09 um 21 51 53

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.

hfr-hfr commented 1 month ago

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
ManuelSchneid3r commented 1 month ago

see https://github.com/albertlauncher/python/commit/cda9f21426daa10e8e75fcdc3c86f38f0d73007c

please pull and check again

ManuelSchneid3r commented 1 month ago

@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.

hfr-hfr commented 1 month ago

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

ManuelSchneid3r commented 1 month ago

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.

stevenxxiu commented 1 week ago

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.

ManuelSchneid3r commented 1 week ago

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. 😒

stevenxxiu commented 1 week ago

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.

martinengelke commented 1 week ago

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.

stevenxxiu commented 1 week ago

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.

AdamPS commented 1 day ago

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.

ManuelSchneid3r commented 1 day ago

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.