Catch InvalidVersion in setup.py to fall back to source build#960
Closed
Chessing234 wants to merge 1 commit into
Closed
Catch InvalidVersion in setup.py to fall back to source build#960Chessing234 wants to merge 1 commit into
Chessing234 wants to merge 1 commit into
Conversation
get_wheel_url() calls packaging.version.parse() on torch.__version__ and torch.version.cuda, which raises InvalidVersion for non-PEP 440 vendor build strings (e.g. 'gpgpu.<build-id>'). Wrap the call with try/except InvalidVersion so the install falls back to a source build instead of aborting. Fixes state-spaces#947
Contributor
Author
|
Closing as duplicate of #961. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug
get_wheel_url()insetup.pycallspackaging.version.parse()ontorch.__version__andtorch.version.cuda. In vendor PyTorch containers these can be non-PEP 440 strings (e.g.gpgpu.<build-id>), causingparse()to raiseInvalidVersion.Because
CachedWheelsCommand.run()has no handler for this exception, the install aborts instead of falling back to a source build.Root cause
get_wheel_url()(line 281/290) passes raw version strings topackaging.version.parse()without guarding againstInvalidVersion. The existingtry/exceptinrun()only catchesurllib.error.HTTPErrorfrom the download step — it never reaches that point.Fix
Wrap the
get_wheel_url()call withtry/except InvalidVersionso the build falls back tosuper().run()(source compilation) when the version string cannot be parsed. This matches the existing fallback behavior for missing prebuilt wheels.Fixes #947