Robin's Blog

How to create an x64 (Intel) conda environment on your Apple Silicon Mac (ARM) conda install

Note: This blog post has been updated with a new command for creating an osx-64 environment, after I was contacted by someone from Anaconda telling me a newer, easier way to do this

I came across some conda packages that didn’t work properly on my M1 Mac (Apple Silicon – ARM processor) the other day. They installed fine, but gave segmentation faults when run. So, I wanted to run the x64 (Intel) versions of these packages instead.

I haven’t actually needed to do this since I got a M1 Mac (a testament to the quality and range of ARM conda packages available these days through conda-forge), so I wasn’t sure how to do it.

A bit of Googling and experimenting led to this nice simple set of instructions. The upshot of this is you don’t need to install another version of Anaconda/miniconda/etc – you can just create a x64 environment in your existing conda install.

So:

  1. Run
    conda create --platform osx-64 --name environment_name python 

    In the past you used to have to prepend a CONDA_SUBDIR=osx-64 chunk to set an environment variable, but since conda 23.10.0 (released on 30th October 2023) you can use the --platform parameter instead. This tells conda to use the osx-64 packages from the package server, rather than the default osx-arm64 (M1 Mac) subdirectory. This is what gets you the x64 packages. Documentation for this option is available here, along with a list of possible platform names you can use.

  2. When this command finishes, you will have a new x64 conda environment. You can then activate it with
    conda activate environment_name
  3. That’s it! You now have a x64 environment which you can install packages in using standard conda install commands.

Note:
The previous set of instructions here had two extra steps to deal with the CONDA_SUBDIR environment variable. I’ve included these below for anyone using an old version of conda, but these won’t be needed if you’re using the --platform parameter:

  1. Now we need to tell conda to always use this CONDA_SUBDIR setting when using this environment, otherwise any future installs in this environment will use the default CONDA_SUBDIR and things will get very confused. We can do this by setting a conda environment config setting to tell conda to set a specific environment variable when you activate the environment. Do this by running:
    conda env config vars set CONDA_SUBDIR=osx-64
  2. The output of that command will warn you to deactivate and reactivate the environment, so do this
    conda deactivate
    conda activate your_environment_name

If you found this post useful, please consider buying me a coffee.
This post originally appeared on Robin's Blog.


Categorised as: Computing, How To, Programming, Python


2 Comments

  1. Can you please upgrade your blog to use the new syntax for creating a 64bit environment with conda?

    Here’s an example:

    conda create –platform osx-64 –name env-name python

    Thanks!

  2. Robin Wilson says:

    Thanks Travis – I’ve updated the post. Could you check it is correct? (I’ll drop you an email too as I don’t think my blog comment replies always send notification emails properly).

Leave a Reply

Your email address will not be published. Required fields are marked *