necaris / conda.el

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

Error activating env #130

Closed marcosmoyano closed 1 year ago

marcosmoyano commented 1 year ago

After a Doom emacs update (which updated conda.el) I'm getting this error trying to activate an environment with conda-env-activate.

❯ conda --version
conda 4.13.0
Debugger entered--Lisp error: (error "Invalid version syntax: ‘Error’ (must start with a number)")
  error("Invalid version syntax: `%s' (must start with a number)" "Error")
  version-to-list("Error")
  version<("4.8.3" "Error")
  conda--supports-json-activator()
  conda--get-deactivation-parameters("/home/marcos/.conda/envs/myenv/")
  conda-env-deactivate()
  conda-env-activate-path("/home/marcos/.conda/envs/myenv/")
  conda-env-activate()
  funcall-interactively(conda-env-activate)
  command-execute(conda-env-activate record)
  counsel-M-x-action("conda-env-activate")
  #f(compiled-function (x) #<bytecode -0x18f9a15a30bf8500>)("conda-env-activate")
  ivy-call()
  #<subr ivy-read>("M-x " ("conda-env-activate" "conda-env-list" "vc-annotate" "cd" "5x5" "amx" "arp" "dbx" "dig" "erc" "ert" "eww" "ftp" "gdb" "irc" "jdb" "lsp" "man" "mpc" "pdb" "pwd" "rsh" "sdb" "xdb" "calc" "diff" "dirs" "ffap" "gnus" "grep" "help" "ielm" "info" "life" "lsp!" "mail" "mpuz" "ping" "pong" "talk" "term" "undo" "yank" "zone" "align" "chmod" "debug" "diary" "dired" "ediff" ...) :predicate counsel--M-x-externs-predicate :require-match t :history counsel-M-x-history :action counsel-M-x-action :keymap (keymap (67108908 . counsel--info-lookup-symbol) (67108910 . counsel-find-symbol)) :initial-input nil :caller counsel-M-x :sort t)
  apply(#<subr ivy-read> ("M-x " ("conda-env-activate" "conda-env-list" "vc-annotate" "cd" "5x5" "amx" "arp" "dbx" "dig" "erc" "ert" "eww" "ftp" "gdb" "irc" "jdb" "lsp" "man" "mpc" "pdb" "pwd" "rsh" "sdb" "xdb" "calc" "diff" "dirs" "ffap" "gnus" "grep" "help" "ielm" "info" "life" "lsp!" "mail" "mpuz" "ping" "pong" "talk" "term" "undo" "yank" "zone" "align" "chmod" "debug" "diary" "dired" "ediff" ...) :predicate counsel--M-x-externs-predicate :require-match t :history counsel-M-x-history :action counsel-M-x-action :keymap (keymap (67108908 . counsel--info-lookup-symbol) (67108910 . counsel-find-symbol)) :initial-input nil :caller counsel-M-x :sort t))
  ivy-read("M-x " ("conda-env-activate" "conda-env-list" "vc-annotate" "cd" "5x5" "amx" "arp" "dbx" "dig" "erc" "ert" "eww" "ftp" "gdb" "irc" "jdb" "lsp" "man" "mpc" "pdb" "pwd" "rsh" "sdb" "xdb" "calc" "diff" "dirs" "ffap" "gnus" "grep" "help" "ielm" "info" "life" "lsp!" "mail" "mpuz" "ping" "pong" "talk" "term" "undo" "yank" "zone" "align" "chmod" "debug" "diary" "dired" "ediff" ...) :predicate counsel--M-x-externs-predicate :require-match t :history counsel-M-x-history :action counsel-M-x-action :keymap (keymap (67108908 . counsel--info-lookup-symbol) (67108910 . counsel-find-symbol)) :initial-input nil :caller counsel-M-x)
  counsel-M-x()
  funcall-interactively(counsel-M-x)
  command-execute(counsel-M-x)

Any idea what might be causing this? Thx in advance.

marcosmoyano commented 1 year ago

X-Ref: https://github.com/doomemacs/doomemacs/issues/6658

necaris commented 1 year ago

Could you let me have the results of conda info and doom info please?

marcosmoyano commented 1 year ago

doom info

❯ ~/.emacs.d/bin/doom info
generated  Aug 10, 2022 14:58:53
system     Arch Linux Linux 5.15.55-1-lts x86_64
emacs      28.1.50 makepkg 372341574 ~/.emacs.d/ -> ~/.emacs.d/
doom       3.0.0-dev grafted, HEAD -> master, origin/master, origin/HEAD 12bf6ba 2022-08-10 17:29:01 +0200 ~/.doom.d/ -> ~/.doom.d/
shell      /usr/bin/zsh
features   ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS HARFBUZZ JPEG JSON LCMS2 LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND THREADS TIFF
           TOOLKIT_SCROLL_BARS X11 XDBE XIM XPM GTK3 ZLIB
traits     batch envvar-file custom-file
modules    :completion company (ivy +prescient +icons) :ui doom doom-dashboard doom-quit (emoji +unicode +github +ascii) hl-todo hydra modeline (popup +defaults) vc-gutter
           vi-tilde-fringe (window-select +numbers) :editor file-templates fold (format +onsave) snippets word-wrap :emacs (dired +icons) (ibuffer +icons) undo vc :term vterm
           :checkers syntax :tools (debugger +lsp) (eval +overlay) lookup lsp magit terraform :os tty :lang emacs-lisp json javascript markdown org (python +conda +ipython +lsp) sh
           web yaml :config (default +bindings +snippets)
packages   (undo-tree) (git-link) (python-black) (sql-indent)

conda info

❯ conda info

     active environment : base
    active env location : /opt/miniconda3
            shell level : 1
       user config file : /home/marcos/.condarc
 populated config files : /home/marcos/.condarc
          conda version : 4.13.0
    conda-build version : not installed
         python version : 3.9.12.final.0
       virtual packages : __linux=5.15.55=0
                          __glibc=2.35=0
                          __unix=0=0
                          __archspec=1=x86_64
       base environment : /opt/miniconda3  (read only)
      conda av data dir : /opt/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 : /opt/miniconda3/pkgs
                          /home/marcos/.conda/pkgs
       envs directories : /home/marcos/.conda/envs
                          /opt/miniconda3/envs
               platform : linux-64
             user-agent : conda/4.13.0 requests/2.28.1 CPython/3.9.12 Linux/5.15.55-1-lts arch/ glibc/2.35
                UID:GID : 1000:1000
             netrc file : None
           offline mode : False

    ~
marcosmoyano commented 1 year ago

@necaris were you able to reproduce? is there anything I can do/try ?

necaris commented 1 year ago

@marcosmoyano apologies for the delay, I was out of town. I'm unfortunately not able to reproduce -- from the traceback, it looks like conda -V is returning an error for you. Can you try both which -a conda (to make sure it's calling the right executable) and conda -V (to debug the output of the command)?

marcosmoyano commented 1 year ago
❯ which -a conda
conda () {
        \local cmd="${1-__missing__}"
        case "$cmd" in
                (activate | deactivate) __conda_activate "$@" ;;
                (install | update | upgrade | remove | uninstall) __conda_exe "$@" || \return
                        __conda_reactivate ;;
                (*) __conda_exe "$@" ;;
        esac
}
/opt/miniconda3/bin/conda
/opt/miniconda3/condabin/conda
    ~
❯ diff /opt/miniconda3/bin/conda /opt/miniconda3/condabin/conda
    ~
❯ conda -V
conda 4.13.0
    ~

Is this helpful ?

marcosmoyano commented 1 year ago

@necaris bump ?

necaris commented 1 year ago

@marcosmoyano any chance you could try out this branch and let me know of any errors? https://github.com/necaris/conda.el/pull/133

marcosmoyano commented 1 year ago

Sure thing. I'll give a shot later today and report back

marcosmoyano commented 1 year ago

BTW, conda 4.12.0 and 4.14.0 don't have this issue. I'd be ok closing this at this point. But also, happy to keep digging with 4.13 to get to the bottom of this.

necaris commented 1 year ago

If you don't mind trying once to see what kind of errors come up with 4.13 I'd appreciate it -- just to have for future reference if other folks run across this issue.

Marcos Moyano @.***> writes:

BTW, conda 4.12.0 and 4.14.0 don't have this issue. I'd be ok closing this at this point. But also, happy to keep digging with 4.13 to get to the bottom of this.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.

-- Rami Chowdhury A mind all logic is like a knife all blade - it makes the hand bleed that uses it. -- Rabindranath Tagore

marcosmoyano commented 1 year ago

mmm now I'm not able to reproduce with conda 4.13.0. Don't know what I changed that fixed it. The only difference I see is in the output of conda info. shell level is now 0 and it was 1 previously. That's the only difference.

necaris commented 1 year ago

That could be something! Shell level 1 indicates that a conda environment is already activated; is it possible you had already activated an environment before you started Emacs previously?

marcosmoyano commented 1 year ago

maybe? either way I can't reproduce it anymore 🤷🏼‍♂️

necaris commented 1 year ago

Okie dokie, closing :smile:

kantholtz commented 8 months ago

Sorry to resurrect this from the dead, but I am plagued by the same error on the latest miniconda release:

Debugger entered--Lisp error: (error "Invalid version syntax: ‘conda’ (must start with a number)")
  error("Invalid version syntax: `%s' (must start with a number)" "conda")
  version-to-list("conda")
  version<("4.8.3" "conda")
  conda--supports-json-activator()
  conda--get-deactivation-parameters("/home/felix/Complex/opt/conda/")
  conda-env-deactivate()
  conda-env-activate-path("/home/felix/Complex/opt/conda/envs/lyg/")
  conda-env-activate()
  funcall-interactively(conda-env-activate)
  command-execute(conda-env-activate record)
  #<subr execute-extended-command>(nil "conda-env-activate" "con")
  ad-Advice-execute-extended-command(#<subr execute-extended-command> nil "conda-env-activate" "con")
  apply(ad-Advice-execute-extended-command #<subr execute-extended-command> (nil "conda-env-activate" "con"))
  execute-extended-command(nil "conda-env-activate" "con")
  funcall-interactively(execute-extended-command nil "conda-env-activate" "con")
  god-mode-self-insert()
  funcall-interactively(god-mode-self-insert)
  command-execute(god-mode-self-insert)
$ conda --version
conda 23.10.0

Please let me know if/how I can provide any more info.

Edit:

I found the culprit myself. Maybe this helps anyone else with the same problem. This had nothing to do with conda, the conda version etc. but with shell configuration. I had (for unrelated debugging purposes) some echo in my shell init. This lead to unexpected output in (conda--get-installed-version):

(shell-command-to-string (format "\"%s\" -V" (conda--get-executable-path)))

"Found conda 23.10.0 in /home/felix/Complex/opt/conda
conda 23.10.0
"