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

#43: Fix pytorch install #48

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

JushBJJ
Copy link

@JushBJJ JushBJJ commented Oct 8, 2024

Allows install of either pytorch w/ cuda or plain pytorch and also fixes this error:

$ poetry lock && poetry install
Installing dependencies from lock file

Repository "pytorch" does not exist.

Copy link
Contributor

@Arrabonae Arrabonae left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is better approach than #44 given the explicit choice between the two systems (mac or other)

@artus-LYTiQ
Copy link

With the suggested code

torch = [ {version = "^2.4.1+cu124", source = "pytorch", markers = "platform_machine != 'Darwin'"}, {version = "^2.4.1", source = "pytorch"} ] ... [[tool.poetry.source]] name = "pytorch" url = "https://download.pytorch.org/whl/cu124" priority = "explicit"

I am getting

- Updating torch (2.4.1 -> 2.4.1+cu124): Failed RuntimeError Unable to find installation candidates for torch (2.4.1+cu124) at /opt/homebrew/Cellar/poetry/1.8.3_2/libexec/lib/python3.12/site-packages/poetry/installation/chooser.py:74 in choose_for 70│ 71│ links.append(link) 72│ 73│ if not links: → 74│ raise RuntimeError(f"Unable to find installation candidates for {package}") 75│ 76│ # Get the best link 77│ chosen = max(links, key=lambda link: self._sort_key(package, link)) 78│ Cannot install torch.

I tried quite a bit but in the end I cannot install PyTorch on Mac from https://download.pytorch.org/whl/cu124 which I think is in line with the PyTorch.org installation guide.

If you dislike the verbose sys_platform or machine_... syntax, then this here did work on my Mac, too. Did not test again on Ubuntu, though.

torch = [ {version = "^2.4.1", platform = "darwin", source = "pypi"}, {version = "^2.4.1+cu124", source = "pytorch", platform = "linux"} ]

@JushBJJ
Copy link
Author

JushBJJ commented Oct 11, 2024

Thanks for telling me this, i was hoping that in MacOS that poetry would switch to the non-cuda version of torch. I'll test it out now

@JushBJJ
Copy link
Author

JushBJJ commented Oct 11, 2024

We can probably do that change, but will ignore CPU users in other platforms. Might be reasonable for now until we can figure out how to make install CPU torch by default then just do a flag (e.g --extras) with cuda

@JushBJJ
Copy link
Author

JushBJJ commented Oct 14, 2024

shrek is gonna switch from poetry to uv soon
https://x.com/_xjdr/status/1845525974143943093?t=Wy_wGfRFgy-Px3tEVaim_g&s=19

@clxyder
Copy link

clxyder commented Oct 15, 2024

I can't believe that just worked
ChefsKissFrenchChefGIF

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

Successfully merging this pull request may close these issues.

4 participants