0

I would like a version of conda init that doesn't modify any shell scripts, just prints the necessary lines to stdout. Is this possible? I tried the --json flag but it didn't do anything.

I'd also like to specify somewhere which shell I'm using.

Context: I'm trying to have two conda installations coexist peacefully https://taylorreiter.github.io/2022-04-05-Managing-multiple-architecture-specific-installations-of-conda-on-apple-M1/

user357269
  • 1,835
  • 14
  • 40
  • 1
    After trying it both ways (two arch-specific Mambaforge installs vs. one), I found using only one installation and creating environments with specified architectures to be more manageable. Ended up with native (**osx-arm64**) Mambaforge, and then use `subdir` configuration whenever I need a **osx-64** environment. – merv Jul 05 '22 at 16:41
  • @merv Thanks for the tip! could you share a link or write up the details in an answer here? It would be very much appreciated – user357269 Jul 05 '22 at 19:42
  • 1
    The essential part (creating **osx-64** environment from a **osx-arm64** base install) is written up [in this answer](https://stackoverflow.com/a/70219965/570918). – merv Jul 05 '22 at 22:52

1 Answers1

0

Ended up creating a script:

import sys
import tempfile
from conda.core.initialize import init_sh_user

print(f'Using environment at {sys.argv[1]}')
print()
with tempfile.NamedTemporaryFile() as temp:
    with open(temp.name, 'r') as file_handle:
        init_sh_user(temp.name, sys.argv[1], 'zsh')
        print(file_handle.read())
user357269
  • 1,835
  • 14
  • 40