1

I have an M1 mac and would like to run multiple conda environments with python copiled for different architectures.

I have been using Anaconda to manage environments via rosetta2 and it works perfectly.

However, I have recently tried installing ARM-compiled python using the guide in this answer to install miniconda and that gave a pretty significant speed improvement in my quick test.

Using rosetta2:

In [1]: import numpy as np

In [2]: %%timeit
   ...: a=np.linspace(1,100,10000)
   ...: a*=3.14
   ...: a+=a
   ...: a**2
   ...: 
   ...: 
32.7 µs ± 50.6 ns per loop (mean ± std. dev. of 7 runs, 10000 loops each)

Using native ARM python:

In [1]: import numpy as np

In [2]:  %%timeit
   ...: a=np.linspace(1,100,10000)
   ...: a*=3.14
   ...: a+=a
   ...: a**2
   ...: 
   ...: 
22.3 µs ± 145 ns per loop (mean ± std. dev. of 7 runs, 10,000 loops each)

My problem is that I have some code that will not run using the native ARM python as it uses packages that are not compatible (yet).

At the moment, I have both anaconda and miniconda installed in different locations and can switch between which version is called using conda by finding the path to their conda executable and running absolute/path/to/executable/conda init.

So what I would like to do is to create a conda environment that acts like the miniconda installation so that I can easily switch between environments if I require performance or compatibility. Is this possible?

Pepsi-Joe
  • 447
  • 1
  • 10
  • 1
    See duplicate. One can use the `subdir` configuration option to lock in a particular environment to a given platform. – merv Mar 22 '22 at 03:26
  • Thanks, that is the answer. I also just found this answer which has a bit more info for anyone else that has the same question: https://stackoverflow.com/a/65432861/17484663 – Pepsi-Joe Mar 22 '22 at 03:26
  • 1
    I'd note that using `conda config --set --env subdir=osx-64` is better practice than setting the environment variable (`CONDA_SUBDIR=osx-64`). The latter is the ultimate escalation in the order of overrides, so it's better to keep that in reserve. – merv Mar 22 '22 at 03:38

0 Answers0