necaris / conda.el

Emacs helper library (and minor mode) to work with conda environments
MIT License
153 stars 51 forks source link

conda-env-activate doesn't work but conda-env-list does #128

Closed kryptec closed 2 years ago

kryptec commented 2 years ago

I'm not sure if this is a package problem or a system config problem, so sorry if this is in the wrong place, but I was hoping you may have some experience with this even if it isn't!

conda-env-list works fine, but conda-env-activate generates the error

conda--get-path-prefix: Error: executing command "/home/username/miniconda3/bin/conda ..activate "bash" "/home/username/miniconda3/envs/scratch/"" produced error code 2

My main shell is zsh, but I can conda activate fine from both it and bash on my system. Though conda activate from eshell in emacs also doesn't work.

It seems like the error could be calling conda from the path. While I can call simply conda activate from my shell, doing it from the path as /home/username/miniconda3/bin/conda activate fails with the error

CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
...

I have similar behvaiour to the conda.el package though, in that /home/username/miniconda3/bin/conda info -e works fine.

I'm running emacs 27, with doom emacs. Here is the output from doom info

generated  Jul 31, 2022 00:02:35
system     Linux Mint 20.3 Linux 5.4.0-122-generic x86_64
emacs      27.1 ~/.emacs.d/ -> ~/.emacs.d/
doom       3.0.0-dev HEAD -> master, origin/master, origin/HEAD 615848e3a 2022-07-31 00:58:36 +0200 ~/.doom.d/ -> ~/.doom.d/
shell      /usr/bin/zsh
features   XPM JPEG TIFF GIF PNG RSVG CAIRO SOUND GPM DBUS GSETTINGS GLIB NOTIFY INOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE HARFBUZZ
       M17N_FLT LIBOTF ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS XWIDGETS LIBSYSTEMD JSON PDUMPER LCMS2 GMP
traits     batch server-running envvar-file custom-file
modules    :completion company vertico :ui doom doom-dashboard (emoji +unicode) hl-todo modeline ophints (popup +defaults) treemacs
       vc-gutter vi-tilde-fringe workspaces :editor (evil +everywhere) file-templates fold (format +onsave) parinfer snippets :emacs
       dired electric undo vc :term eshell :checkers syntax :tools lookup lsp magit :lang emacs-lisp json markdown (org +pretty +jupyter
       +roam2) (python +lsp +conda +pyright) :config (default +bindings +smartparens)
packages   (evil-tutor) (catppuccin-theme) (org-modern)
necaris commented 2 years ago

Could you please provide the output of conda info?

kryptec commented 2 years ago

Here your go!

     active environment : base
    active env location : /home/username/miniconda3
            shell level : 1
       user config file : /home/username/.condarc
 populated config files : /home/username/.condarc
          conda version : 4.13.0
    conda-build version : not installed
         python version : 3.9.5.final.0
       virtual packages : __cuda=11.4=0
                          __linux=5.4.0=0
                          __glibc=2.31=0
                          __unix=0=0
                          __archspec=1=x86_64
       base environment : /home/username/miniconda3  (writable)
      conda av data dir : /home/username/miniconda3/etc/conda
  conda av metadata url : None
           channel URLs : https://repo.anaconda.com/pkgs/main/linux-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/linux-64
                          https://repo.anaconda.com/pkgs/r/noarch
          package cache : /home/username/miniconda3/pkgs
                          /home/username/.conda/pkgs
       envs directories : /home/username/miniconda3/envs
                          /home/username/.conda/envs
               platform : linux-64
             user-agent : conda/4.13.0 requests/2.27.1 CPython/3.9.5 Linux/5.4.0-122-generic linuxmint/20.3 glibc/2.31
                UID:GID : 1000:1000
             netrc file : None
           offline mode : False
kosack commented 2 years ago

I have the same issue. Downgrading conda to 4.12.0 seems to fix it, so it must have something to do with whatever changed in 4.13.0

Works fine:

conda install -n base conda=4.12.0

Gives error message when calling conda-env-activate:

conda install -n base conda=4.13.0
necaris commented 2 years ago

Hmm, that implies that it's calling the deprecated activator method. Do you happen to know for sure which version (git hash) of conda.el you're using?

ghost commented 2 years ago

I had the same issue with doom and I can confirm it is now fixed after fixing doom emacs issue 6626 The doom's maintainer pinned the conda.el version to current latest commit a65ed0084876366fd1b238bb2b8b36ee75ac98d8

kryptec commented 2 years ago

Looks like it was an issue with doom pinning the conda.el version, and the newest conda.el version works fine. This has also been incorporated into doom, and running doom upgrade has now fixed the problem for me so I'm closing this. Thanks for everyone's help!