RhetTbull / macnotesapp

Work with Apple MacOS Notes.app from the command line. Also includes python interface for scripting Notes.app from your own python code.
MIT License
141 stars 6 forks source link

With pipx, seeing "ImportError: lxml.html.clean module is now a separate project lxml_html_clean" #47

Closed gdykema closed 7 months ago

gdykema commented 7 months ago

This looks similar to issue #45 but I installed pipx with brew and then installed macnotesapp with pipx. I'm running Sonoma 14.3.1.

% notes --help
Traceback (most recent call last):
  File "/Users/gregdykema/.local/bin/notes", line 5, in <module>
    from macnotesapp.__main__ import cli_main
  File "/Users/gregdykema/.local/pipx/venvs/macnotesapp/lib/python3.12/site-packages/macnotesapp/__main__.py", line 3, in <module>
    from .cli import cli_main
  File "/Users/gregdykema/.local/pipx/venvs/macnotesapp/lib/python3.12/site-packages/macnotesapp/cli/__init__.py", line 3, in <module>
    from .cli import cli_main
  File "/Users/gregdykema/.local/pipx/venvs/macnotesapp/lib/python3.12/site-packages/macnotesapp/cli/cli.py", line 33, in <module>
    from .readable import get_readable_html
  File "/Users/gregdykema/.local/pipx/venvs/macnotesapp/lib/python3.12/site-packages/macnotesapp/cli/readable.py", line 8, in <module>
    from readability import Document
  File "/Users/gregdykema/.local/pipx/venvs/macnotesapp/lib/python3.12/site-packages/readability/__init__.py", line 3, in <module>
    from .readability import Document
  File "/Users/gregdykema/.local/pipx/venvs/macnotesapp/lib/python3.12/site-packages/readability/readability.py", line 11, in <module>
    from .cleaners import clean_attributes
  File "/Users/gregdykema/.local/pipx/venvs/macnotesapp/lib/python3.12/site-packages/readability/cleaners.py", line 3, in <module>
    from lxml.html.clean import Cleaner
  File "/Users/gregdykema/.local/pipx/venvs/macnotesapp/lib/python3.12/site-packages/lxml/html/clean.py", line 18, in <module>
    raise ImportError(
ImportError: lxml.html.clean module is now a separate project lxml_html_clean.
Install lxml[html_clean] or lxml_html_clean directly.
RhetTbull commented 7 months ago

Dang, thought I'd fixed it. Will take a look.

RhetTbull commented 7 months ago

I've not been able to replicate this yet. Will keep trying to figure out why it's not working. I added the missing requirement to v0.6.0.

❯ pipx install macnotesapp
  installed package macnotesapp 0.6.0, installed using Python 3.11.5
  These apps are now globally available
    - notes
done! ✨ 🌟 ✨

~/.local/bin took 9s
❯ notes --version
notes, version 0.6.0

~/.local/bin took 3s
❯ notes --help
Usage: notes [OPTIONS] COMMAND [ARGS]...

  notes: work with Apple Notes on the command line.

Options:
  -v, --version  Show the version and exit.
  -h, --help     Show this message and exit.

Commands:
  accounts  Print information about Notes accounts.
  add       Add new note.
  cat       Print one or more notes to STDOUT
  config    Configure default settings for account, editor, etc.
  dump      Dump all notes or selection of notes for debugging
  help      Print help; for help on commands: help <command>.
  list      List notes, optionally filtering by account or text.
RhetTbull commented 7 months ago

On another machine (also running Ventura), pipx only installs v0.5.1 which doesn't work and it refuses to grab version 0.6.0. I'm stumped.

❯ pipx install macnotesapp
⚠️  Note: notes was already on your PATH at /Users/rhet/.pyenv/shims/notes
  installed package macnotesapp 0.5.1, installed using Python 3.12.2
  These apps are now globally available
    - notes
done! ✨ 🌟 ✨
❯ notes
Traceback (most recent call last):
  File "/Users/rhet/.local/bin/notes", line 5, in <module>
    from macnotesapp.__main__ import cli_main
  File "/Users/rhet/.local/pipx/venvs/macnotesapp/lib/python3.12/site-packages/macnotesapp/__main__.py", line 3, in <module>
    from .cli import cli_main
  File "/Users/rhet/.local/pipx/venvs/macnotesapp/lib/python3.12/site-packages/macnotesapp/cli/__init__.py", line 3, in <module>
    from .cli import cli_main
  File "/Users/rhet/.local/pipx/venvs/macnotesapp/lib/python3.12/site-packages/macnotesapp/cli/cli.py", line 33, in <module>
    from .readable import get_readable_html
  File "/Users/rhet/.local/pipx/venvs/macnotesapp/lib/python3.12/site-packages/macnotesapp/cli/readable.py", line 8, in <module>
    from readability import Document
  File "/Users/rhet/.local/pipx/venvs/macnotesapp/lib/python3.12/site-packages/readability/__init__.py", line 3, in <module>
    from .readability import Document
  File "/Users/rhet/.local/pipx/venvs/macnotesapp/lib/python3.12/site-packages/readability/readability.py", line 11, in <module>
    from .cleaners import clean_attributes
  File "/Users/rhet/.local/pipx/venvs/macnotesapp/lib/python3.12/site-packages/readability/cleaners.py", line 3, in <module>
    from lxml.html.clean import Cleaner
  File "/Users/rhet/.local/pipx/venvs/macnotesapp/lib/python3.12/site-packages/lxml/html/clean.py", line 18, in <module>
    raise ImportError(
ImportError: lxml.html.clean module is now a separate project lxml_html_clean.
Install lxml[html_clean] or lxml_html_clean directly.
RhetTbull commented 7 months ago

OK, I think I figured this out. It was an issue with Python 3.12 which was causing pipx to fall back to an older version. I think I've fixed it in v0.6.1. Try pipx uninstall macnotesapp then pipx install macnotesapp again.

gdykema commented 7 months ago

Working now, thanks!