Runtime error when using mps device

Hi I’ve tried running some code on the “maps” device, however I get the following error, when trying to load a neural net on the mps device (
device = device = torch.device(“mps”)
my_net = nn.Sequential(
nn.Conv2d(1, 8, 4, stride=2),
nn.Conv2d(8, 32, 3, stride=2),
# (old-school) global average pooling
nn.Conv2d(32, 64, 6),
nn.Linear(64, 10)
RuntimeError: PyTorch is not linked with support for mps devices
Any Ideas how to solve this?


Which mac hardware are you using?
Also which version of python (in particular, is it x86 or arm version)?

1 Like

It’s a M1 Macbook air with python 3.9.12, I am not exactly sure on the version, but most likely arm architecture

You can check the platform for your python build with import platform; print(platform.platform()).
If that says x86, then you have the wrong version of python installed.
Can you double check that?

1 Like

I have the wrong python version, thanks for your help

1 Like

Is this the direction we have to go install arm64 Python versions in the conda environment?

I personally completely deinstalled anaconda and reinstalled it using the new m1 version

1 Like

Maybe still of use to others:

The installation command generated on Start Locally | PyTorch didn’t install the latest version for me. What did it was:

pip3 install --pre torch==1.12.0.dev20220518 --extra-index-url 


You should remove the pin to the torch version: pip3 install --pre torch--extra-index-url
Also, if you install domain libraries (vision/text/etc) they might downgrade your PyTorch right now (we are looking into a fix for that).

Hi albanD,

I am running x86 in Spyder and do not know how to change the version.

I have redownloaded anaconda from this link: Anaconda | New Release: Anaconda Distribution Now Supporting M1

But it actually downloads: Anaconda3-2022.05-MacOSX-x86_64

As you can, this gets x86 again and my problem persists.

How can I change the python version so I can get mps to work?

Not sure Spyder has an arm64 release, but if you want an arm64 python env to test PyTorch mps I’d recommend conda-forge:

mamba is :fire: :rocket:

1 Like

Thanks for your response! I’m fairly new here.

So I understand that I seemingly cannot use Spyder if I wish to use the mps device. I also don’t seem to be able to access it thought Jupyter NB. I’m not too sure about Miniforge.

Which sort of platform should I be running when trying to use mps?


Should work fine in jupyter on M1, as long as it’s arm64 native and not emulated x86.

1 Like

Sadly I get the same issue in Jupyter NB within the torch-nightly environment:

Any advice on this would be greatly appreciated!

Looks like you have 2 issues there, based on platform.platform():

  1. you’re not on macOS 12.3 which is required for mps
  2. if you’re on M1, you’re using an emulated x86 env and not arm64
    See the instructions from the PyTorch MPS announcement:
    Introducing Accelerated PyTorch Training on Mac | PyTorch
1 Like

Hi Peter,

  1. This is a problem because I am presently running macOS 12.4 on an M1 but it still picks up 10.16 somehow

  2. In an attempt to get access to an arm64 env I reinstalled anaconda as Sara seemed to have success with this… but the problem persists

Well, then the only thing I can conclude is that your issue must be related to your anaconda env.
You are getting a x86 conda env that is also, oddly, reporting the wrong platform: 10.16 isn’t a real macOS release, it was a code for Big Sur which became 11.0.
For comparison my rosetta emulated conda-forge env:

>>> platform.platform()

So, I suggest using conda-forge miniforge or mambaforge, as I posted above. It’s also recommended by Apple for tensorflow-metal. Just make sure you use one of the -arm64 options, not x86.
This yields, on my 12.3.1 M1:

>>> platform.platform()
1 Like