Skip to content

Commit 4e41431

Browse files
allow PyTorch 1.9 as minimum requirement, fix PyTorch install on mac
1 parent cfeaa3f commit 4e41431

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

torchstudio/pythoncheck.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
else:
3737
from importlib.metadata import version
3838
pytorch_version=tuple(int(i) for i in version('torch').split('.')[:2])
39-
min_pytorch_version=(1,9) if args.remote else (1,10) #1.9 required for torch.package support, 1.10 required for stable torch.fx and profile-directed typing in torchscript
39+
min_pytorch_version=(1,9) #1.9 required for torch.package support, 1.10 preferred for stable torch.fx and profile-directed typing in torchscript
4040
if pytorch_version<min_pytorch_version:
4141
print("Error: PyTorch "+str(min_pytorch_version[0])+"."+str(min_pytorch_version[1])+" minimum is required.", file=sys.stderr)
4242
print("This environment has PyTorch "+str(pytorch_version[0])+"."+str(pytorch_version[1])+".", file=sys.stderr)

torchstudio/pythoninstall.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
else:
2626
conda_install="pytorch torchvision torchaudio cpuonly datasets scipy pandas matplotlib-base python-graphviz paramiko pysoundfile"
2727
elif sys.platform.startswith('darwin'):
28-
conda_install="nomkl pytorch torchvision torchaudio datasets scipy pandas matplotlib-base python-graphviz paramiko"
28+
# force a pytorch/mkl version, because pytorch 1.10.2+ depends on mkl 2022 which is incompatible with Rosetta 2 in M1 macs
29+
conda_install="pytorch==1.10.1 torchvision==0.11.2 torchaudio==0.10.1 mkl==2021.4.0 datasets scipy pandas matplotlib-base python-graphviz paramiko"
2930
elif sys.platform.startswith('linux'):
3031
if args.gpu:
3132
conda_install="pytorch torchvision torchaudio cudatoolkit=11.3 datasets scipy pandas matplotlib-base python-graphviz paramiko"
@@ -40,7 +41,7 @@
4041
print(conda_install)
4142
print("")
4243

43-
# channels: pytorch for pytorch torchvision torchaudio, nvidia for cudatoolkit=11.1 on Linux, huggingface for datasets(+huggingface_hub), conda-forge for everything else except anaconda for python-graphviz
44+
# channels: pytorch for pytorch torchvision torchaudio, nvidia for cudatoolkit=11.1 on Linux, huggingface for datasets(+huggingface_hub), conda-forge for everything else except anaconda for python-graphviz and ngam for osx-arm64 torchaudio
4445
conda_install+=" -c pytorch -c nvidia -c huggingface -c conda-forge -c anaconda"
4546

4647
# https://stackoverflow.com/questions/41767340/using-conda-install-within-a-python-script

0 commit comments

Comments
 (0)