conda / conda-lock

Lightweight lockfile for conda environments
https://conda.github.io/conda-lock/
Other
489 stars 103 forks source link

How to conda-lock install on a M1 mac when using an osx-64 lockfile #475

Open leeleavitt opened 1 year ago

leeleavitt commented 1 year ago

Checklist

What is the idea?

One aspect of normal conda i have used often was that i was able to work with conda dependencies on an M1/M2 mac without issues.

The way we navigated this was to simply run the command below

conda config --add subdirs osx-64

This allowed be to install and use dependencies for osx-64 on my mac.

Is there a way for conda-lock to respect or know if a user has run this command and to then install the dependencies for a osx-64 on the m1/m2 mac?

Why is this needed?

No response

What should happen?

No response

Additional Context

No response

maresb commented 1 year ago

Hey, I don't have a Mac, and I'm not familiar with this command. Just to make sure I understand...

Does this allow you to work with a mixed osx-arm64 and osx-64 environment so that you benefit from the native ARM, but you can still run emulated x86 when it's not available?

If I'm understanding this correctly, this seems like it would be very useful.

As a particular implementation detail,

Is there a way for conda-lock to respect or know if a user has run this command and to then...

I'd object to a "hidden" sort of configuration where someone who has run the command generates a different lockfile as someone who hasn't. This sort of configuration should somehow be made explicit. (I'm not sure yet how best to do this; I almost want to define a new hybrid platform, but I don't want to introduce something so nonstandard.)

jashapiro commented 6 months ago

Rather than a hybrid install, I occasionally use the following set of commands to wholly switch a conda environment to use the osx-64 environment.

CONDA_SUBDIR=osx-64 conda env create -n my_env
conda activate my_env
conda config --env --set subdir osx-64

I can create an osx-64-only lock file with conda-lock -p osx-64

but when I try to install it with conda-lock install -n test-noarm

conda_lock.errors.PlatformValidationError: The lockfile conda-lock.yml does not contain a solution for the current platform osx-arm64.

I tried conda-lock install -n test-noarm --no-validate-platform but got the same error.

I know that I can use conda-lock --kind explicit and then use the platform-specific lockfile with --no-validate-platform , but it would be nice to still use conda-lock.yml file to allow a single file across platforms.