2

edit: So I noticed that there's no (base) in my terminal. Couldn't even run "conda activate base" either. I found that running "source ~/anaconda3/envs/myenv/bin/activate" does the trick to run "conda activate", but when I open a new terminal, I need to run that source code again. any idea on how I can permanently change it?

It had an issue with finding conda, so I added the path /opt/anaconda3/bin to .zshrc. Adding that path was the only way to find conda and finding anaconda. I'm not sure what else I could do? When I open Terminal, it does say zsh at the top. So I'm not even sure why it's asking to Conda init zsh?

HarryMacMini@HarryMacMini ~ % conda init zsh

Password:

ERROR REPORT

    Traceback (most recent call last):
      File "/Users/HarryMacMini/opt/anaconda3/lib/python3.9/site-packages/conda/exceptions.py", line 1114, in __call__
        return func(*args, **kwargs)
      File "/Users/HarryMacMini/opt/anaconda3/lib/python3.9/site-packages/conda/cli/main.py", line 86, in main_subshell
        exit_code = do_call(args, p)
      File "/Users/HarryMacMini/opt/anaconda3/lib/python3.9/site-packages/conda/cli/conda_argparse.py", line 90, in do_call
        return getattr(module, func_name)(args, parser)
      File "/Users/HarryMacMini/opt/anaconda3/lib/python3.9/site-packages/conda/cli/main_init.py", line 50, in execute
        return initialize(context.conda_prefix, selected_shells, for_user, args.system,
      File "/Users/HarryMacMini/opt/anaconda3/lib/python3.9/site-packages/conda/core/initialize.py", line 118, in initialize
        run_plan_elevated(plan2)
      File "/Users/HarryMacMini/opt/anaconda3/lib/python3.9/site-packages/conda/core/initialize.py", line 687, in run_plan_elevated
        result = subprocess_call(
      File "/Users/HarryMacMini/opt/anaconda3/lib/python3.9/site-packages/conda/gateways/subprocess.py", line 100, in subprocess_call
        stdout, stderr = process.communicate(input=stdin)
      File "/Users/HarryMacMini/opt/anaconda3/lib/python3.9/subprocess.py", line 1134, in communicate
        stdout, stderr = self._communicate(input, endtime, timeout)
      File "/Users/HarryMacMini/opt/anaconda3/lib/python3.9/subprocess.py", line 1959, in _communicate
        input_view = memoryview(self._input)
    TypeError: memoryview: a bytes-like object is required, not 'str'

`$ /Users/HarryMacMini/opt/anaconda3/bin/conda init zsh`

environment variables:
                 CIO_TEST=<not set>
               CONDA_ROOT=/Users/HarryMacMini/opt/anaconda3
           CURL_CA_BUNDLE=<not set>
                     PATH=/Users/HarryMacMini/opt/anaconda3/bin:/usr/local/bin:/usr/bin:/bin:/us
                          r/sbin:/sbin
       REQUESTS_CA_BUNDLE=<not set>
            SSL_CERT_FILE=<not set>

     active environment : None
       user config file : /Users/HarryMacMini/.condarc
 populated config files : /Users/HarryMacMini/.condarc
          conda version : 4.13.0
    conda-build version : 3.21.8
         python version : 3.9.12.final.0
       virtual packages : __osx=10.15.7=0
                          __unix=0=0
                          __archspec=1=x86_64
       base environment : /Users/HarryMacMini/opt/anaconda3  (writable)
      conda av data dir : /Users/HarryMacMini/opt/anaconda3/etc/conda
  conda av metadata url : None
           channel URLs : https://repo.anaconda.com/pkgs/main/osx-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/osx-64
                          https://repo.anaconda.com/pkgs/r/noarch
          package cache : /Users/HarryMacMini/opt/anaconda3/pkgs
                          /Users/HarryMacMini/.conda/pkgs
       envs directories : /Users/HarryMacMini/opt/anaconda3/envs
                          /Users/HarryMacMini/.conda/envs
               platform : osx-64
             user-agent : conda/4.13.0 requests/2.27.1 CPython/3.9.12 Darwin/19.6.0 OSX/10.15.7
                UID:GID : 501:20
             netrc file : None
           offline mode : False
curieux88
  • 21
  • 3
  • nvm fixed it. added that line to .zshrc – curieux88 May 29 '22 at 06:21
  • One should not be manually manipulating PATH with Conda - it can lead to unexpected behavior later. You will be doing your future self a favor by figuring out how to get the default setup running. I lean toward closing as [duplicate](https://stackoverflow.com/a/55526573/570918), but it's possible the Conda v4.13.0 has a bug with init. Also, I find it very strange to see `Password:` in the output. Did you install as root/admin? – merv May 29 '22 at 19:20
  • What would you recommend doing, instead? I read stack to add path. It took a while to figure out exactly where. To answer that password question, yeah, I installed as admin. – curieux88 May 30 '22 at 20:07
  • Start over. Don't install as admin. Either accept the option during installation to run `conda init`, or use full path to `conda` (e.g., `/Users/you/anaconda3/condabin/conda init zsh`). – merv May 30 '22 at 20:14

3 Answers3

1

I'm on Fedora 37 with zsh installed from home-manager (located in /home/user/.nix-profile/bin/zsh)

When running conda init zsh it fails with the same error

I solved the problem my replacing


    if self._input:
        input_view = memoryview(self._input)

with


    if self._input:
        if isinstance(self._input, str):
            input_view = memoryview(self._input.encode('utf-8'))
        else:
            input_view = memoryview(self._input)

inside /usr/lib64/python3.11/subprocess.pyat line 2037

This is only a temporary (and admitingly ugly) fix.

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Dec 04 '22 at 12:43
0

I solved this problem by running "conda init zsh" manually with sudo.

sudo /Users/($your_username)/anaconda3/bin/conda init zsh
0

it is can be solved by using sudo conda init zsh

Tsieyy
  • 29
  • 1