How to build from source code without trailing torch-1.8.0a0+gitf2a38a0 version

Dear Forum,
I am finished compile from source with the following command:

python install


python bdist_wheel

but the version is torch-1.8.0a0+gitf2a38a0 not torch-1.8.0 only.

This made the torchvision can’t be installed since pip only can detect the number only.

Here are the pics

Might @glaringlee can help? Thanks

You can hard-code the version in as a workaround. In my, it’s on line 295:

version = get_torch_version()

Change this to:

version = "1.8.0"

and re-run the installation command.

The desired torchvision wheel requires the PyTorch 1.8.0 release, while you are using a commit from the master branch before 1.8.0 was cut.
You could either also use an older torchvision commit and build it from source or alternatively you could git checkout v1.8.0 and build the PyTorch release version from source.

@jbschlosser @ptrblck great answers.
both working as desired, thanks all!

export the PYTORCH_BUILD_VERSION to the required version instead of hardcoding. In your case, export PYTORCH_BUILD_VERSION=1.8.0

Note that setting PYTORCH_BUILD_VERSION could be used to specify the reported version returned by torch.__version__, but you would of course still use the pre-release commit instead of the “stable” release branch.
I’m mentioning it, as this could create really confusing environment where debugging might be hard since your reported version does not match the actual code.

Yes, @ptrblck. What you said is entirely accurate. If one is using a stable release branch and need a clean version of the torch then one can export the PYTORCH_BUILD_VERSION based on the release tag.