necaris / conda.el

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

Can't activate conda environment #83

Closed cimentadaj closed 3 years ago

cimentadaj commented 3 years ago

I'm trying to activate a working conda environment from conda.el to no avail. I'm using the conda spacemacs layer. I have an environment called test_ds which is located in ~/opt/anaconda3/envs/. Here's my conda.el config:

conda-anaconda-home "~/opt/anaconda3/"
conda-env-autoactivate-mode t

If I activate the environment manually, it works:

conda activate test_ds

but if I set it through conda-env-activate it errors with:

"Error: executing command \"\"~/opt/anaconda3/bin/conda\" ..activate \"bash\" \"/Users/cimentadaj/opt/anaconda3/envs/test_ds/\"\" produced error code 127"

Here's the traceback:

(error "Error: executing command \"\"~/opt/anaconda3/bin/conda\" ..activate \"bash\" \"/Users/cimentadaj/opt/anaconda3/envs/test_ds/\"\" produced error code 127")
* signal(error ("Error: executing command \"\"~/opt/anaconda3/bin/conda\" ..activate \"bash\" \"/Users/cimentadaj/opt/anaconda3/envs/test_ds/\"\" produced error code 127"))
  error("Error: executing command \"\"~/opt/anaconda3/bin/conda\" ..activate \"bash\" \"/Users/cimentadaj/opt/anaconda3/envs/test_ds/\"\" produced error code 127")
  conda--get-path-prefix("/Users/cimentadaj/opt/anaconda3/envs/test_ds/")
  conda-env-activate-path("/Users/cimentadaj/opt/anaconda3/envs/test_ds/")
  conda-env-activate("test_ds")
  (progn (conda-env-activate "test_ds"))
  eval((progn (conda-env-activate "test_ds")) t)
  elisp--eval-last-sexp(nil)
  #f(compiled-function (eval-last-sexp-arg-internal) "Evaluate sexp before point; print value in the echo area.\nInteractively, with a non `-' prefix argument, print output into\ncurrent buffer.\n\nNormally, this function truncates long output according to the\nvalue of the variables `eval-expression-print-length' and\n`eval-expression-print-level'.  With a prefix argument of zero,\nhowever, there is no such truncation.\nInteger values are printed in several formats (decimal, octal,\nand hexadecimal).  When the prefix argument is -1 or the value\ndoesn't exceed `eval-expression-print-maximum-character', an\ninteger value is also printed as a character of that codepoint.\n\nIf `eval-expression-debug-on-error' is non-nil, which is the default,\nthis command arranges for all errors to enter the debugger." (interactive "P") #<bytecode 0x410e610f>)(nil)
  #f(compiled-function (&rest _it) #<bytecode 0x1fee60ea1c99>)()
  eval-sexp-fu-flash-doit-simple(#f(compiled-function (&rest _it) #<bytecode 0x1fee60ea1c99>) #f(compiled-function (&rest args2) #<bytecode 0x1fee6390ea4d>) #f(compiled-function (&rest args2) #<bytecode 0x1fee6390ea6d>))
  eval-sexp-fu-flash-doit(#f(compiled-function (&rest _it) #<bytecode 0x1fee60ea1c99>) #f(compiled-function (&rest args2) #<bytecode 0x1fee6390ea4d>) #f(compiled-function (&rest args2) #<bytecode 0x1fee6390ea6d>))
  esf-flash-doit(#f(compiled-function (&rest _it) #<bytecode 0x1fee60ea1c99>) #f(compiled-function (&rest args2) #<bytecode 0x1fee6390ea4d>) #f(compiled-function (&rest args2) #<bytecode 0x1fee6390ea6d>) #f(compiled-function (&rest args2) #<bytecode 0x1fee6390ea8d>))
  ad-Advice-eval-last-sexp(#f(compiled-function (eval-last-sexp-arg-internal) "Evaluate sexp before point; print value in the echo area.\nInteractively, with a non `-' prefix argument, print output into\ncurrent buffer.\n\nNormally, this function truncates long output according to the\nvalue of the variables `eval-expression-print-length' and\n`eval-expression-print-level'.  With a prefix argument of zero,\nhowever, there is no such truncation.\nInteger values are printed in several formats (decimal, octal,\nand hexadecimal).  When the prefix argument is -1 or the value\ndoesn't exceed `eval-expression-print-maximum-character', an\ninteger value is also printed as a character of that codepoint.\n\nIf `eval-expression-debug-on-error' is non-nil, which is the default,\nthis command arranges for all errors to enter the debugger." (interactive "P") #<bytecode 0x410e610f>) nil)
  apply(ad-Advice-eval-last-sexp #f(compiled-function (eval-last-sexp-arg-internal) "Evaluate sexp before point; print value in the echo area.\nInteractively, with a non `-' prefix argument, print output into\ncurrent buffer.\n\nNormally, this function truncates long output according to the\nvalue of the variables `eval-expression-print-length' and\n`eval-expression-print-level'.  With a prefix argument of zero,\nhowever, there is no such truncation.\nInteger values are printed in several formats (decimal, octal,\nand hexadecimal).  When the prefix argument is -1 or the value\ndoesn't exceed `eval-expression-print-maximum-character', an\ninteger value is also printed as a character of that codepoint.\n\nIf `eval-expression-debug-on-error' is non-nil, which is the default,\nthis command arranges for all errors to enter the debugger." (interactive "P") #<bytecode 0x410e610f>) nil)
  eval-last-sexp(nil)
  lisp-state-eval-sexp-end-of-line()
  funcall-interactively(lisp-state-eval-sexp-end-of-line)
  call-interactively(lisp-state-eval-sexp-end-of-line nil nil)
  command-execute(lisp-state-eval-sexp-end-of-line)

Is this a bug or am I doing something wrong? Let me know and I'll move this for SO in case it's a question.

necaris commented 3 years ago

Apologies for the delay responding -- this could well be a bug, due to a change in conda's behavior perhaps. Which version of conda are you using? Also, what happens if you run ~/opt/anaconda3/bin/conda\" ..activate "bash" in a terminal?

On Thu, Mar 25, 2021 at 02:01, Jorge Cimentada @.***> wrote:

I'm trying to activate a working conda environment from conda.el to no avail. I'm using the conda spacemacs layer. I have an environment called test_ds which is located in ~/opt/anaconda3/envs/. Here's my conda.el config:

conda-anaconda-home "~/opt/anaconda3/" conda-env-autoactivate-mode t If I activate the environment manually, it works:

conda activate test_ds

but if I set it through conda-env-activate it errors with:

"Error: executing command \"\"~/opt/anaconda3/bin/conda\" ..activate \"bash\" \"/Users/cimentadaj/opt/anaconda3/envs/test_ds/\"\" produced error code 127"

Here's the traceback:

(error "Error: executing command \"\"~/opt/anaconda3/bin/conda\" ..activate \"bash\" \"/Users/cimentadaj/opt/anaconda3/envs/test_ds/\"\" produced error code 127")

  • signal(error ("Error: executing command \"\"~/opt/anaconda3/bin/conda\" ..activate \"bash\" \"/Users/cimentadaj/opt/anaconda3/envs/test_ds/\"\" produced error code 127")) error("Error: executing command \"\"~/opt/anaconda3/bin/conda\" ..activate \"bash\" \"/Users/cimentadaj/opt/anaconda3/envs/test_ds/\"\" produced error code 127")

conda--get-path-prefix("/Users/cimentadaj/opt/anaconda3/envs/test_ds/")

conda-env-activate-path("/Users/cimentadaj/opt/anaconda3/envs/test_ds/") conda-env-activate("test_ds") (progn (conda-env-activate "test_ds")) eval((progn (conda-env-activate "test_ds")) t) elisp--eval-last-sexp(nil)

f(compiled-function (eval-last-sexp-arg-internal) "Evaluate sexp

before point; print value in the echo area.\nInteractively, with a non -' prefix argument, print output into\ncurrent buffer.\n\nNormally, this function truncates long output according to the\nvalue of the variableseval-expression-print-length' and\neval-expression-print-level'. With a prefix argument of zero,\nhowever, there is no such truncation.\nInteger values are printed in several formats (decimal, octal,\nand hexadecimal). When the prefix argument is -1 or the value\ndoesn't exceed eval-expression-print-maximum-character', an\ninteger value is also printed as a character of that codepoint.\n\nIf `eval-expression-debug-on-error' is non-nil, which is the default,\nthis command arranges for all errors to enter the debugger." (interactive "P") #<bytecode 0x410e610f>)(nil)

f(compiled-function (&rest _it) #<bytecode 0x1fee60ea1c99>)()

eval-sexp-fu-flash-doit-simple(#f(compiled-function (&rest _it)

<bytecode 0x1fee60ea1c99>) #f(compiled-function (&rest args2)

<bytecode 0x1fee6390ea4d>) #f(compiled-function (&rest args2)

<bytecode 0x1fee6390ea6d>))

eval-sexp-fu-flash-doit(#f(compiled-function (&rest _it) #<bytecode 0x1fee60ea1c99>) #f(compiled-function (&rest args2) #<bytecode 0x1fee6390ea4d>) #f(compiled-function (&rest args2) #<bytecode 0x1fee6390ea6d>)) esf-flash-doit(#f(compiled-function (&rest _it) #<bytecode 0x1fee60ea1c99>) #f(compiled-function (&rest args2) #<bytecode 0x1fee6390ea4d>) #f(compiled-function (&rest args2) #<bytecode 0x1fee6390ea6d>) #f(compiled-function (&rest args2) #<bytecode 0x1fee6390ea8d>)) ad-Advice-eval-last-sexp(#f(compiled-function (eval-last-sexp-arg-internal) "Evaluate sexp before point; print value in the echo area.\nInteractively, with a non -' prefix argument, print output into\ncurrent buffer.\n\nNormally, this function truncates long output according to the\nvalue of the variableseval-expression-print-length' and\neval-expression-print-level'. With a prefix argument of zero,\nhowever, there is no such truncation.\nInteger values are printed in several formats (decimal, octal,\nand hexadecimal). When the prefix argument is -1 or the value\ndoesn't exceed eval-expression-print-maximum-character', an\ninteger value is also printed as a character of that codepoint.\n\nIf eval-expression-debug-on-error' is non-nil, which is the default,\nthis command arranges for all errors to enter the debugger." (interactive "P") #<bytecode 0x410e610f>) nil) apply(ad-Advice-eval-last-sexp #f(compiled-function (eval-last-sexp-arg-internal) "Evaluate sexp before point; print value in the echo area.\nInteractively, with a non-' prefix argument, print output into\ncurrent buffer.\n\nNormally, this function truncates long output according to the\nvalue of the variables eval-expression-print-length' and\neval-expression-print-level'. With a prefix argument of zero,\nhowever, there is no such truncation.\nInteger values are printed in several formats (decimal, octal,\nand hexadecimal). When the prefix argument is -1 or the value\ndoesn't exceed eval-expression-print-maximum-character', an\ninteger value is also printed as a character of that codepoint.\n\nIf eval-expression-debug-on-error' is non-nil, which is the default,\nthis command arranges for all errors to enter the debugger." (interactive "P") #<bytecode 0x410e610f>) nil) eval-last-sexp(nil) lisp-state-eval-sexp-end-of-line() funcall-interactively(lisp-state-eval-sexp-end-of-line) call-interactively(lisp-state-eval-sexp-end-of-line nil nil) command-execute(lisp-state-eval-sexp-end-of-line) Is this a bug or am I doing something wrong? Let me know and I'll move this for SO in case it's a question.

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

cimentadaj commented 3 years ago

I'm using conda 4.10.1 and if I run ~/opt/anaconda3/bin/conda/ ..activate "bash" I get an error saying that ..activate requires two arguments. If I add the missing env directory and run ~/opt/anaconda3/bin/conda ..activate "bash" "/Users/cimentadaj/opt/anaconda3/envs/wfh/" (where wfh is a valid env and I can activate with conda activate wfh) I get this:

WARNING: The conda.cli.activate module is deprecated and will be removed in a future release.
WARNING: The module conda.cli.activate is deprecated. It will be removed in a future feature release (i.e. minor version release).
/Users/cimentadaj/opt/anaconda3/envs/wfh/bin

Yet the environment is not activated. I can activate the env successfully with conda activate wfh.

rusty-electron commented 3 years ago

HI, I am facing the same issue. Is there any fix available?

trivialfis commented 3 years ago

@rusty-electron Could you please help test https://github.com/necaris/conda.el/pull/91 ?

rusty-electron commented 3 years ago

Hi, I tried out your PR but it still doesn't seem to be working. image

trivialfis commented 3 years ago

That doesn't seem right, the conda command should not be quoted after the PR.

rusty-electron commented 3 years ago

Here is how I tested it (I am new to emacs and elisp so I might have tested it the wrong way)

  1. I visited your fork of conda.el
  2. saved your conda.el file in my home directory
  3. opened emacs and used <M-x> load-file to load your conda.el file
  4. added the following code in my config.el (I am using doom emacs)
    (custom-set-variables
    '(conda-anaconda-home "~/miniconda3/"))