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

Set specific pytorch version for major platforms (linux, win32, darwin) #132

Merged
merged 3 commits into from
Jul 12, 2024

Conversation

kai-car
Copy link
Collaborator

@kai-car kai-car commented Jul 9, 2024

Current dependency setup failed on macOS with following error message:

 - Installing torch (2.3.1): Failed

  RuntimeError

  Unable to find installation candidates for torch (2.3.1)

  at ~/Library/Application Support/pypoetry/venv/lib/python3.10/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. 

This is due to the fact that torch version 2.3.1 apparently does not exist for macOS currently. Therefore, we adjusted the version of torch in pyproject.yml to the range >=2.1.0, <2.3.0 for macOS.

EDIT: This seems to happen only on Intel chips (x86_64), so we adjust the setting accordingly. However, it looks like some Apple chips are also recognized as x86_64 which results in capping the max version also for these. We should keep this in mind.

@kai-car kai-car requested a review from ArneBinder July 9, 2024 10:23
Copy link

codecov bot commented Jul 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.40%. Comparing base (7eb987b) to head (bc35e02).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #132   +/-   ##
=======================================
  Coverage   91.40%   91.40%           
=======================================
  Files          10       10           
  Lines         814      814           
=======================================
  Hits          744      744           
  Misses         70       70           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Owner

@ArneBinder ArneBinder left a comment

Choose a reason for hiding this comment

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

I just looked at pytorch.org again and it seems there is at least version 2.3.0 for OSX, see https://pytorch.org/get-started/previous-versions/#osx-1. Can you investigate, if the reasoning from the PR description is really correct? The goal is to really drill down on the issue and at the end having a fix with the smallest possible surface. These kinds of specific version settings need to be (more or less manually) maintained and the fix needs to be ported to all the other PIE repos, too, so it may have a certain impact.

@kai-car
Copy link
Collaborator Author

kai-car commented Jul 9, 2024

Took me some time, but it seems the issue on my side occurred because PyTorch no longer supports macOS x86_64 (Intel Chips) from Release 2.3.0 on, as Apple stopped building Macs with Intel Chips. See https://dev-discuss.pytorch.org/t/pytorch-macos-x86-builds-deprecation-starting-january-2024/1690

@ArneBinder
Copy link
Owner

ArneBinder commented Jul 10, 2024

Thanks a lot of your investigation! Can we define the version explicitly for MacOS on x86_64, i.e. via sth like platform_machine == 'x86_64' in markers? see https://python-poetry.org/docs/dependency-specification/#using-environment-markers

@ArneBinder ArneBinder merged commit 38b9580 into main Jul 12, 2024
4 checks passed
@ArneBinder ArneBinder deleted the torch-macos-dependency branch July 12, 2024 10:05
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.

2 participants