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

Outlines doesn't install on Collab because Rust isn't available to compile outlines core #1198

Closed
davanstrien opened this issue Oct 8, 2024 · 15 comments · Fixed by #1204
Closed
Labels

Comments

@davanstrien
Copy link
Contributor

Describe the issue as clearly as possible:

Outlines doesn't install successfully via

!pip install outlines

on Google Colab.

Steps/code to reproduce the bug:

!pip install outlines

Expected result:

Successful installation of Outlines in Google Colab.

Error message:

********************************************************************************
          ############################
          # Package would be ignored #
          ############################
          Python recognizes 'outlines_core.integrations' as an importable package[^1],
          but it is absent from setuptools' `packages` configuration.

          This leads to an ambiguous overall configuration. If you want to distribute this
          package, please make sure that 'outlines_core.integrations' is explicitly added
          to the `packages` configuration field.

          Alternatively, you can also rely on setuptools' discovery methods
          (for example by using `find_namespace_packages(...)`/`find_namespace:`
          instead of `find_packages(...)`/`find:`).

          You can read more about "package discovery" on setuptools documentation page:

          - https://setuptools.pypa.io/en/latest/userguide/package_discovery.html

          If you don't want 'outlines_core.integrations' to be distributed and are
          already explicitly excluding 'outlines_core.integrations' via
          `find_namespace_packages(...)/find_namespace` or `find_packages(...)/find`,
          you can try to use `exclude_package_data`, or `include-package-data=False` in
          combination with a more fine grained `package-data` configuration.

          You can read more about "package data files" on setuptools documentation page:

          - https://setuptools.pypa.io/en/latest/userguide/datafiles.html


          [^1]: For Python, any directory (with suitable naming) can be imported,
                even if it does not contain any `.py` files.
                On the other hand, currently there is no concept of package data
                directory, all directories are treated like packages.
          ********************************************************************************

  !!
    check.warn(importable)
  /tmp/pip-build-env-aoesym4_/overlay/local/lib/python3.10/dist-packages/setuptools/command/build_py.py:218: _Warning: Package 'outlines_core.models' is absent from the `packages` configuration.
  !!

          ********************************************************************************
          ############################
          # Package would be ignored #
          ############################
          Python recognizes 'outlines_core.models' as an importable package[^1],
          but it is absent from setuptools' `packages` configuration.

          This leads to an ambiguous overall configuration. If you want to distribute this
          package, please make sure that 'outlines_core.models' is explicitly added
          to the `packages` configuration field.

          Alternatively, you can also rely on setuptools' discovery methods
          (for example by using `find_namespace_packages(...)`/`find_namespace:`
          instead of `find_packages(...)`/`find:`).

          You can read more about "package discovery" on setuptools documentation page:

          - https://setuptools.pypa.io/en/latest/userguide/package_discovery.html

          If you don't want 'outlines_core.models' to be distributed and are
          already explicitly excluding 'outlines_core.models' via
          `find_namespace_packages(...)/find_namespace` or `find_packages(...)/find`,
          you can try to use `exclude_package_data`, or `include-package-data=False` in
          combination with a more fine grained `package-data` configuration.

          You can read more about "package data files" on setuptools documentation page:

          - https://setuptools.pypa.io/en/latest/userguide/datafiles.html


          [^1]: For Python, any directory (with suitable naming) can be imported,
                even if it does not contain any `.py` files.
                On the other hand, currently there is no concept of package data
                directory, all directories are treated like packages.
          ********************************************************************************

  !!
    check.warn(importable)
  copying python/outlines_core/py.typed -> build/lib.linux-x86_64-cpython-310/outlines_core
  creating build/lib.linux-x86_64-cpython-310/outlines_core/fsm
  copying python/outlines_core/fsm/__init__.py -> build/lib.linux-x86_64-cpython-310/outlines_core/fsm
  copying python/outlines_core/fsm/fsm.py -> build/lib.linux-x86_64-cpython-310/outlines_core/fsm
  copying python/outlines_core/fsm/guide.py -> build/lib.linux-x86_64-cpython-310/outlines_core/fsm
  copying python/outlines_core/fsm/json_schema.py -> build/lib.linux-x86_64-cpython-310/outlines_core/fsm
  copying python/outlines_core/fsm/regex.py -> build/lib.linux-x86_64-cpython-310/outlines_core/fsm
  copying python/outlines_core/fsm/types.py -> build/lib.linux-x86_64-cpython-310/outlines_core/fsm
  creating build/lib.linux-x86_64-cpython-310/outlines_core/integrations
  copying python/outlines_core/integrations/utils.py -> build/lib.linux-x86_64-cpython-310/outlines_core/integrations
  creating build/lib.linux-x86_64-cpython-310/outlines_core/models
  copying python/outlines_core/models/__init__.py -> build/lib.linux-x86_64-cpython-310/outlines_core/models
  copying python/outlines_core/models/tokenizer.py -> build/lib.linux-x86_64-cpython-310/outlines_core/models
  copying python/outlines_core/models/transformers.py -> build/lib.linux-x86_64-cpython-310/outlines_core/models
  running build_ext
  running build_rust
  error: can't find Rust compiler

  If you are using an outdated pip version, it is possible a prebuilt wheel is available for this package but pip is not able to install from it. Installing from the wheel would avoid the need for a Rust compiler.

  To update pip, run:

      pip install --upgrade pip

  and then retry package installation.

  If you did intend to build this package from source, try installing a Rust compiler from your system package manager and ensure it is on the PATH during installation. Alternatively, rustup (available at https://rustup.rs) is the recommended way to download and update the Rust compiler toolchain.
  error: subprocess-exited-with-error
  
  × Building wheel for outlines-core (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> See above for output.
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  full command: /usr/bin/python3 /usr/local/lib/python3.10/dist-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py build_wheel /tmp/tmphx3fhi6x
  cwd: /tmp/pip-install-szpvw5jq/outlines-core_7cc4c742fcc74987987bc589fe954a42
  Building wheel for outlines-core (pyproject.toml) ... error
  ERROR: Failed building wheel for outlines-core
Failed to build outlines-core
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (outlines-core)

Outlines/Python version information:

Version information

``` (command output here) ```

Context for the issue:

The issue stems from a Rust compiler not being available on a standard Colab instance. It can be resolved by installing the Rust compiler, but this might not be an ideal user experience for people just starting with Outlines.

@davanstrien davanstrien added the bug label Oct 8, 2024
@davanstrien
Copy link
Contributor Author

In the meantime, for anyone trying to use Outlines in a Colab instance:

import os
!curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
!source $HOME/.cargo/env
os.environ['PATH'] += ':/root/.cargo/bin'
!echo $PATH
!pip install outlines 

Should install correctly.

@davanstrien davanstrien changed the title Outlines doesn't install on Collab because rust isn't availabel to compile outlines core Outlines doesn't install on Collab because Rust isn't available to compile outlines core Oct 8, 2024
@tcapelle
Copy link

tcapelle commented Oct 8, 2024

same on a fresh Linux VM

@rlouf
Copy link
Member

rlouf commented Oct 8, 2024

Thank you for opening an issue! We'll solve this on the outlines-core side and cut a new release.

@DefTruth
Copy link

DefTruth commented Oct 9, 2024

same error

@DefTruth
Copy link

DefTruth commented Oct 9, 2024

downgrade to outlines==0.0.46 is work for me.

@Tendo33
Copy link

Tendo33 commented Oct 9, 2024

same error

@rlouf
Copy link
Member

rlouf commented Oct 9, 2024

We're working on this as I am typing this. Expect an update soon!

future-xy added a commit to ServerlessLLM/ServerlessLLM that referenced this issue Oct 10, 2024
## Description
This PR addresses an urgent issue caused by the recent release of
`outlines` v0.1.0 (see [issue
#1198](dottxt-ai/outlines#1198)).
ServerlessLLM depends on `vllm==0.5.0.post1`, which requires
`outlines>=0.0.43`. However, the release of `outlines` v0.1.0 introduced
a bug that affects compatibility.
To resolve this, we are explicitly pinning `outlines==0.0.43` in this
fix.

## Type of Change
- [x] Bug fix

## Checklist
- [x] I have read and followed the [Contribution
Guidelines](https://github.com/ServerlessLLM/ServerlessLLM/blob/main/CONTRIBUTING.md).

Co-authored-by: future-xy <fuyao3860@gmail.com>
@xuexidi
Copy link

xuexidi commented Oct 12, 2024

downgrade to outlines==0.0.46 is work for me.

it worked for me, thanks!

@lapp0
Copy link
Contributor

lapp0 commented Oct 13, 2024

Can you please try pip install git+https://github.com/lapp0/outlines@add-fsm-union-pin-core and report back whether it works? This is the branch of a PR in progress which fixes the rust installation issue.

@davanstrien
Copy link
Contributor Author

Can you please try pip install git+https://github.com/lapp0/outlines@add-fsm-union-pin-core and report back whether it works? This is the branch of a PR in progress which fixes the rust installation issue.

@lapp0 seems to work now. I only tested install, import and demo code i.e.

!pip install git+https://github.com/lapp0/outlines@add-fsm-union-pin-core
!pip install transformers --upgrade

import outlines

model = outlines.models.transformers("microsoft/Phi-3-mini-4k-instruct")

prompt = """You are a sentiment-labelling assistant.
Is the following review positive or negative?

Review: This restaurant is just awesome!
"""

generator = outlines.generate.choice(model, ["Positive", "Negative"])
answer = generator(prompt)

but all seemed to work well.

@lapp0
Copy link
Contributor

lapp0 commented Oct 13, 2024

Thanks so much for helping me test it! I expect a new release soon with the mentioned branch included.

@BIGBALLON
Copy link

In the meantime, for anyone trying to use Outlines in a Colab instance:

import os
!curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
!source $HOME/.cargo/env
os.environ['PATH'] += ':/root/.cargo/bin'
!echo $PATH
!pip install outlines 

Should install correctly.

It works for me!! thx ! @davanstrien

@jtmenchaca
Copy link

Hi - I'm still running into this issue. I tried both of these with the same result:

pip install git+https://github.com/lapp0/outlines@add-fsm-union-pin-core and
pip install outlines

Any recommendations?

@justHungryMan
Copy link

In the meantime, for anyone trying to use Outlines in a Colab instance:

import os
!curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
!source $HOME/.cargo/env
os.environ['PATH'] += ':/root/.cargo/bin'
!echo $PATH
!pip install outlines 

Should install correctly.

It works!
This is my dockerfile

RUN apt-get update && \
    apt-get install -y curl && \
    rm -rf /var/lib/apt/lists/*

RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && \
    . "$HOME/.cargo/env" && \
    echo 'export PATH=$PATH:$HOME/.cargo/bin' >> ~/.bashrc && \
    /bin/bash -c "source ~/.bashrc"

ENV PATH="/root/.cargo/bin:${PATH}"

RUN pip install --upgrade pip


RUN pip install outlines==0.1.1

@rlouf
Copy link
Member

rlouf commented Oct 26, 2024

pip install outlines==0.1,1 should work. If not please paste the error and the system you are running (Windows, Mac, Linux) and the OS version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
10 participants