dottxt-ai / outlines

Structured Text Generation
https://dottxt-ai.github.io/outlines/
Apache License 2.0
9.68k stars 495 forks source link

Missing dependency `transformers` upon fresh install #1263

Open ulfaslak opened 1 week ago

ulfaslak commented 1 week ago

Describe the issue as clearly as possible:

If you create a new virtualenv, pip install outlines, and try to import it in python, it throws:

ModuleNotFoundError: No module named 'transformers'

Obviously this is fixed by pip installing transformers, but maybe that should just be a build dependency?

System: I'm on a MacBook Pro (M3 Max), Sonoma 14.5 (23F79).

Steps/code to reproduce the bug:

$ python3 -m venv env
$ source env/bin/activate
$ (env) pip install outlines
$ (env) python
Python 3.12.6 (main, Sep  6 2024, 19:03:47) [Clang 15.0.0 (clang-1500.3.9.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import outlines

Expected result:

... it should just import.

Error message:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/ulfaslak/Desktop/env/lib/python3.12/site-packages/outlines/__init__.py", line 2, in <module>
    import outlines.generate
  File "/Users/ulfaslak/Desktop/env/lib/python3.12/site-packages/outlines/generate/__init__.py", line 2, in <module>
    from .cfg import cfg
  File "/Users/ulfaslak/Desktop/env/lib/python3.12/site-packages/outlines/generate/cfg.py", line 7, in <module>
    from outlines.models import LlamaCpp, OpenAI, TransformersVision
  File "/Users/ulfaslak/Desktop/env/lib/python3.12/site-packages/outlines/models/__init__.py", line 17, in <module>
    from .vllm import VLLM, vllm
  File "/Users/ulfaslak/Desktop/env/lib/python3.12/site-packages/outlines/models/vllm.py", line 4, in <module>
    from transformers import SPIECE_UNDERLINE, PreTrainedTokenizerBase
ModuleNotFoundError: No module named 'transformers'

Outlines/Python version information:

Version information

``` (command output here) ```

Context for the issue:

No response