I am able to build torch from source without errors, however, when I import torch I get this exception:
Input In [2], in <cell line: 1>()
----> 1 import torch; torch.backends.mps.is_available()
File ~/anaconda3/envs/AI-Feynman/lib/python3.10/site-packages/torch/__init__.py:649, in <module>
643 __all__.extend(['e', 'pi', 'nan', 'inf'])
645 ################################################################################
646 # Define Storage and Tensor classes
647 ################################################################################
--> 649 from ._tensor import Tensor
650 from .storage import _StorageBase, TypedStorage, _LegacyStorage, UntypedStorage
652 # NOTE: New <type>Storage classes should never be added. When adding a new
653 # dtype, use torch.storage.TypedStorage directly.
File ~/anaconda3/envs/AI-Feynman/lib/python3.10/site-packages/torch/_tensor.py:21, in <module>
12 import torch.utils.hooks as hooks
13 from torch._namedtensor_internals import (
14 check_serializing_named_tensor,
15 is_ellipsis,
(...)
19 update_names,
20 )
---> 21 from torch.overrides import (
22 get_default_nowrap_functions,
23 handle_torch_function,
24 has_torch_function,
25 has_torch_function_unary,
26 has_torch_function_variadic,
27 )
28 from torch.utils.dlpack import DLDeviceType
31 def _handle_torch_function_and_wrap_type_error_to_not_implemented(f):
File ~/anaconda3/envs/AI-Feynman/lib/python3.10/site-packages/torch/overrides.py:33, in <module>
30 import contextlib
32 import torch
---> 33 from torch._C import (
34 _has_torch_function, _has_torch_function_unary,
35 _has_torch_function_variadic, _add_docstr,
36 _push_on_torch_function_stack, _pop_torch_function_stack, _get_function_stack_at, _len_torch_function_stack,
37 _set_torch_function_mode, _is_torch_function_mode_enabled)
39 __all__ = [
40 "get_ignored_functions",
41 "get_overridable_functions",
(...)
50 "get_buffer",
51 ]
53 @functools.lru_cache(None)
54 def get_ignored_functions() -> Set[Callable]:
ImportError: cannot import name '_set_torch_function_mode' from 'torch._C' (/Users/davidlaxer/anaconda3/envs/AI-Feynman/lib/python3.10/site-packages/torch/_C.cpython-310-darwin.so)
In file torch/_C/ init.pyi:
def _is_torch_function_mode_enabled()-> _bool: ...
def _set_torch_function_mode(cls: Any) -> None: ...
In /Users/davidlaxer/anaconda3/envs/AI-Feynman/lib/python3.10/site-packages/torch/_C.cpython-310-darwin.so :
% nm -n /Users/davidlaxer/anaconda3/envs/AI-Feynman/lib/python3.10/site-packages/torch/_C.cpython-310-darwin.so
U _initModule
U dyld_stub_binder
0000000000003f80 T _PyInit__C
Environment:
% python collect_env.py
Collecting environment information...
PyTorch version: 1.14.0a0+git9efca7c
Is debug build: False
CUDA used to build PyTorch: None
ROCM used to build PyTorch: N/A
OS: macOS 12.6.1 (x86_64)
GCC version: Could not collect
Clang version: 14.0.0 (clang-1400.0.29.102)
CMake version: version 3.22.1
Libc version: N/A
Python version: 3.10.4 (main, Mar 31 2022, 03:38:35) [Clang 12.0.0 ] (64-bit runtime)
Python platform: macOS-10.16-x86_64-i386-64bit
Is CUDA available: False
CUDA runtime version: No CUDA
CUDA_MODULE_LOADING set to: N/A
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True
Versions of relevant libraries:
[pip3] audiolm-pytorch==0.0.1
[pip3] mypy-extensions==0.4.3
[pip3] numpy==1.22.3
[pip3] pytorch-transformers==1.1.0
[pip3] torch==1.14.0a0+git8a8cd09
[pip3] torchaudio==0.13.0.dev20221015
[pip3] torchmetrics==0.10.1
[pip3] torchtraining-nightly==1604016577
[pip3] torchvision==0.14.0a0+a61e6ef
[pip3] vector-quantize-pytorch==0.9.2
[conda] captum 0.5.0 0 pytorch
[conda] ffmpeg 4.3 h0a44026_0 pytorch
[conda] mkl 2022.1.0 h860c996_928 conda-forge
[conda] nomkl 3.0 0 anaconda
[conda] numpy 1.22.3 py310h1ad2b02_0 anaconda
[conda] numpy-base 1.22.3 py310h6d917f3_0 anaconda
[conda] pytorch 1.12.1 cpu_py310h32957a8_0 conda-forge
[conda] pytorch-transformers 1.1.0 pypi_0 pypi
[conda] torch 1.13.0a0+gitaf8e34c pypi_0 pypi
[conda] torchaudio 0.13.0.dev20221015 pypi_0 pypi
[conda] torchmetrics 0.10.1 pyhd8ed1ab_0 conda-forge
[conda] torchtraining-nightly 1604016577 pypi_0 pypi
[conda] torchvision 0.14.0a0+a61e6ef pypi_0 pypi
[conda] vector-quantize-pytorch 0.9.2 pypi_0 pypi
Libraries:
find ~/anaconda3/envs/AI-Feynman -name '_C.cpython-*-darwin.so' -ls
672863816 104 -rwxr-xr-x 1 davidlaxer staff 51840 Oct 27 12:26 /Users/davidlaxer/anaconda3/envs/AI-Feynman/lib/python3.10/site-packages/torch/_C.cpython-310-darwin.so
672874576 704 -rwxr-xr-x 1 davidlaxer staff 357536 Oct 27 12:26 /Users/davidlaxer/anaconda3/envs/AI-Feynman/lib/python3.10/site-packages/functorch/_C.cpython-310-darwin.so
(AI-Feynman) davidlaxer@x86_64-apple-darwin13 pytorch % find . -name '_C.cpython-*-darwin.so' -ls
670063315 72 -rwxr-xr-x 1 davidlaxer staff 33280 Oct 16 10:18 ./torch/_C.cpython-310-darwin.so
672500765 72 -rwxr-xr-x 1 davidlaxer staff 33280 Oct 26 14:33 ./build/lib.macosx-10.9-x86_64-3.10/torch/_C.cpython-310-darwin.so
672862310 656 -rwxr-xr-x 1 davidlaxer staff 334912 Oct 27 12:22 ./build/lib.macosx-10.9-x86_64-3.10/functorch/_C.cpython-310-darwin.so
670063317 656 -rwxr-xr-x 1 davidlaxer staff 334832 Oct 16 10:20 ./functorch/_C.cpython-310-darwin.so
This is a new issue. I’ve been building pytorch from source without this exception.