Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LLM 0.13 broken on Windows #407

Closed
simonw opened this issue Jan 26, 2024 · 8 comments
Closed

LLM 0.13 broken on Windows #407

simonw opened this issue Jan 26, 2024 · 8 comments
Labels
bug Something isn't working

Comments

@simonw
Copy link
Owner

simonw commented Jan 26, 2024

Reported here: https://discord.com/channels/823971286308356157/1128504153841336370/1200590104276783217

> llm
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\tools\aug\scripts\llm.exe__main__.py", line 4, in <module>
  File "C:\tools\aug\Lib\site-packages\llm\cli.py", line 31, in <module>
    import readline
ModuleNotFoundError: No module named 'readline'
@simonw simonw added the bug Something isn't working label Jan 26, 2024
@simonw
Copy link
Owner Author

simonw commented Jan 26, 2024

pip install pyreadline3 seems to fix it.

@simonw
Copy link
Owner Author

simonw commented Jan 27, 2024

I really need to figure out a good Windows dev environment for myself.

For the moment can I at least get CI running on Windows?

@simonw
Copy link
Owner Author

simonw commented Jan 27, 2024

Windows CI failed with that same error: https://github.com/simonw/llm/actions/runs/7674731683/job/20919846177

CleanShot 2024-01-26 at 16 02 47@2x

@simonw
Copy link
Owner Author

simonw commented Jan 27, 2024

Doing the rest of the work in PR:

simonw added a commit that referenced this issue Jan 27, 2024
* Run CI on Windows and macOS as well as Ubuntu, refs #407
* Use pyreadline3 on win32
* Back to fail-fast since we have a bigger matrix now
* Mark some tests as xfail on windows
@simonw
Copy link
Owner Author

simonw commented Jan 27, 2024

@simonw simonw closed this as completed Jan 27, 2024
@rsbohn
Copy link

rsbohn commented Jan 27, 2024

Thanks for the fast turn-around. Working great now!

@dance2die
Copy link

dance2die commented Apr 30, 2024

I was using conda venv, and the fix was to install pydantic using conda.exe

conda install pydantic -c conda-forge

From https://docs.pydantic.dev/latest/install/

because my llm instance was haivng an issue was pydantic instead of readline.
Posted here as this issue kept on popping up on google search for me
& and to help others.

(base) C:\Users\dance2die>llm
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\dance2die\anaconda3\Scripts\llm.exe\__main__.py", line 4, in <module>
  File "C:\Users\dance2die\anaconda3\Lib\site-packages\llm\__init__.py", line 18, in <module>
    from .plugins import pm
  File "C:\Users\dance2die\anaconda3\Lib\site-packages\llm\plugins.py", line 17, in <module>
    pm.load_setuptools_entrypoints("llm")
  File "C:\Users\dance2die\anaconda3\Lib\site-packages\pluggy\_manager.py", line 287, in load_setuptools_entrypoints
    plugin = ep.load()
             ^^^^^^^^^
  File "C:\Users\dance2die\anaconda3\Lib\importlib\metadata\__init__.py", line 202, in load
    module = import_module(match.group('module'))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\dance2die\anaconda3\Lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\dance2die\anaconda3\Lib\site-packages\llm_claude\__init__.py", line 6, in <module>
    from pydantic import Field, field_validator
ImportError: cannot import name 'field_validator' from 'pydantic' (C:\Users\dance2die\anaconda3\Lib\site-packages\pydantic\__init__.cp311-win_amd64.pyd)

@pjr
Copy link

pjr commented May 31, 2024

Ended up with a similar stacktrace to the last comment on my M1 iMac. It's unrelated to the original reported issue. Google brought me here.

Traceback (most recent call last):
  File "/opt/homebrew/bin/llm", line 5, in <module>
    from llm.cli import cli
  File "/opt/homebrew/lib/python3.11/site-packages/llm/__init__.py", line 18, in <module>
    from .plugins import pm
  File "/opt/homebrew/lib/python3.11/site-packages/llm/plugins.py", line 17, in <module>
    pm.load_setuptools_entrypoints("llm")
  File "/opt/homebrew/lib/python3.11/site-packages/pluggy/_manager.py", line 398, in load_setuptools_entrypoints
    plugin = ep.load()
             ^^^^^^^^^
  File "/opt/homebrew/Cellar/[email protected]/3.11.9/Frameworks/Python.framework/Versions/3.11/lib/python3.11/importlib/metadata/__init__.py", line 202, in load
    module = import_module(match.group('module'))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/[email protected]/3.11.9/Frameworks/Python.framework/Versions/3.11/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/llm_claude_3.py", line 3, in <module>
    from pydantic import Field, field_validator, model_validator
ImportError: cannot import name 'field_validator' from 'pydantic' (/opt/homebrew/lib/python3.11/site-packages/pydantic/__init__.cpython-311-darwin.so)

From here and a quick bit of Googling around, it looks like these fields are missing on (at least some versions of) pydantic 1.x

Lo and behold what was I running:

$ /opt/homebrew/bin/pip3.11 list | grep -i pydantic                                                
pydantic                                1.10.5

An upgrade of brew's pydantic module got me up and running.

$ /opt/homebrew/bin/pip3.11 install --upgrade pydantic  
...
Successfully installed annotated-types-0.7.0 pydantic-2.7.2 pydantic-core-2.18.3
$ /opt/homebrew/bin/pip3.11 list | grep -i pydantic    
pydantic                                2.7.2
pydantic_core                           2.18.3
[stable][/opt/homebrew/bin]$ llm keys set openai 
Enter key:

@simonw hope it's ok to use comments in this fashion here and you don't feel like it's polluting your issues!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants