Skip to content
New issue

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

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

Already on GitHub? # to your account

Fix triton env marker #1887

Merged
merged 1 commit into from
Dec 11, 2023
Merged

Fix triton env marker #1887

merged 1 commit into from
Dec 11, 2023

Conversation

169
Copy link
Contributor

@169 169 commented Dec 10, 2023

I use poetry to manage project dependencies. I want to install openai-whisper but failed:

➜ video-translation (tmp) ✔ poetry add openai-whisper
Using version ^20231117 for openai-whisper

Updating dependencies
Resolving dependencies... (8.3s)

Package operations: 1 install, 1 update, 0 removals

   - Installing triton (2.1.0): Failed

   RuntimeError

   Unable to find installation candidates for triton (2.1.0)

   at ~/workspace/poetry/src/poetry/installation/chooser.py:73 in choose_for
        69│
        70│ links.append(link)
        71│
        72│ if not links:
     → 73│ raise RuntimeError(f"Unable to find installation candidates for {package}")
        74│
        75│ # Get the best link
        76│ chosen = max(links, key=lambda link: self._sort_key(package, link))
        77│

Cannot install triton.

However, it should be noted that my computer model is Macbook pro M2. According to the instructions in setup.py, triton should not be installed:

➜ video-translation (tmp) ✔ uname -s
Darwin

After investigation, I found that poetry's dependencies incorrectly included triton. The dependency list was caused by the following code:

            requires = Path(dist.filename) / "requires.txt"
            if requires.exists():
                text = requires.read_text(encoding="utf-8")
                requirements = parse_requires(text)

The logic of this code is to download and decompress the openai-whisper-20231117.tar.gz file, and obtain the dependency list from the openai_whisper.egg-info/requires.txt file.

➜ video-translation (tmp) ✔ wget https://files.pythonhosted.org/packages/d2/6e/50ace2bf704e5ffc786d20d96403ab0d57c5d6ab8729de7fed8c436687df/openai-whisper-20231117.tar.gz
➜ video-translation (tmp) ✗ tar zxf openai-whisper-20231117.tar.gz
➜ video-translation (tmp) ✗ cd openai-whisper-20231117
➜ openai-whisper-20231117 (tmp) ✗ grep triton openai_whisper.egg-info/requires.txt
triton<3,>=2.0.0

According to the current usage, if you are using a Linux system when uploading a package to PYPI, the triton will be written to the openai_whisper.egg-info/requires.txt file, which will affect the normal operation of other systems (such as mac, win) use

So I fixed the writing of triton according to https://peps.python.org/pep-0508/#environment-markers. I have tested it in mac and linux environments respectively and made sure it is correct

@grayroom
Copy link

grayroom commented Dec 11, 2023

I tested it in windows (amd64) and macos (arch64) environments, and I'm experiencing the same issue.

When install it with pip, it works without any problems, but I hope it will be fixed in order to continue development with poetry

@jongwook jongwook merged commit 8bc8860 into openai:main Dec 11, 2023
8 checks passed
@jckw
Copy link

jckw commented Feb 25, 2024

This is still an issue on Macs I believe

@Chasesc
Copy link

Chasesc commented Mar 9, 2024

Seeing this issue, as a hacky workaround, I ran poetry add git+https://github.com/openai/whisper.git#e58f28804528831904c3b6f2c0e473f346223433 to install whisper before this commit.

@169
Copy link
Contributor Author

169 commented Mar 15, 2024

@jongwook Could you release a new version? This problem can only be fixed in the new version

Screenshot 2024-03-15 at 10 59 21 AM

@edsu
Copy link

edsu commented Mar 20, 2024

I ran into this as well. A new release would be gratefully received!

@julien-blanchon
Copy link

This is super anoying

@libo
Copy link

libo commented Jun 18, 2024

I asked ChatGPT. It suggested to do this in your pyproject.toml file

[tool.poetry.dependencies.openai-whisper]
git = "https://github.com/openai/whisper.git"
rev = "e58f28804528831904c3b6f2c0e473f346223433" # Point to SHA until a version after v20231117 is released

It works.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants