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

Missing dependency transformers upon fresh install #1263

Closed
ulfaslak opened this issue Nov 12, 2024 · 0 comments · Fixed by #1296
Closed

Missing dependency transformers upon fresh install #1263

ulfaslak opened this issue Nov 12, 2024 · 0 comments · Fixed by #1296
Labels

Comments

@ulfaslak
Copy link
Contributor

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

@ulfaslak ulfaslak added the bug label Nov 12, 2024
rlouf added a commit that referenced this issue Nov 28, 2024
Users are currently running into install issues. After a clean install
of `outlines` they get an error message that asks for `transformers` to
be installed. This should not be the case, as the library is not
required for every integration. In this PR we remove `transformers` and
`datasets` top-level imports, and add per-integration optional
dependencies.

## TODO
- [x] Test `import outlines` from clean install
- [x] Test installing outlines with vLLM optional dependencies
- [x] Test installing outlines with MLX optional dependencies
- [x] Test installing outlines with transformers optional dependencies
- [x] Test installing outlines with llama-cpp optional dependencies
- [x] Test installing outlines with exllamav2 optional dependencies
- [x] Test installing outlines with openai optional dependencies
- [x] Update the documentation

Supersedes #1295.  Fixes #1263.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
1 participant