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

Fix for installation of torch and torchvision on macOS #1125

Merged
merged 5 commits into from
Jun 17, 2024
Merged

Conversation

austingmhuang
Copy link
Contributor

Title:
Fix for installation of torch and torchvision on macOS

Summary:
After installing poetry (version 1.8.3) on macOS and running make environment, you get the following error. Fixing this error will lead to a similar one for torchvision.

  - Installing torch (1.13.1+cpu): Failed

  RuntimeError

  Unable to find installation candidates for torch (1.13.1+cpu)

  at ~/.local/pipx/venvs/poetry/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│ 

This is because the installer is using the +cpu version (despite the fact that the non +cpu version is in pyproject.toml). Specifying the source seems to fix the issue and the installer proceeds without error.

Relevant references:

Possible Drawbacks:

Related GitHub Issues:

Copy link
Collaborator

@rashidnhm rashidnhm left a comment

Choose a reason for hiding this comment

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

Thanks for taking a look into this. After some investigation this does seem to be the solution as outlined by a poetry contributor here.

To me this seems to be a limitation (dare I even say bug) of poetry since pypi is supposed to be the default search location anyways for packages. But alas, glad it got sorted

pyproject.toml Outdated Show resolved Hide resolved
pyproject.toml Outdated Show resolved Hide resolved
Copy link
Contributor

@ikurecic ikurecic left a comment

Choose a reason for hiding this comment

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

Okay, this makes sense to me, let's merge it in.
Thanks a lot, @austingmhuang !

@ikurecic ikurecic merged commit 364a5a7 into master Jun 17, 2024
6 checks passed
@ikurecic ikurecic deleted the macos_fix branch June 17, 2024 09:16
@ikurecic ikurecic mentioned this pull request Jun 17, 2024
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.

3 participants