necaris / conda.el

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

macos M-x shell produces source activate my-env BUT source not found #54

Closed mbarton98 closed 2 years ago

mbarton98 commented 4 years ago

Things appear to work fine when I launch python code from Emacs, but when I go to the shell it would not activate the environment until I ran "conda activate my-env"

Each time in my bash history I would see "source activate my-env" and wonder where it came from.

I looked in conda.el and found this: (defun conda-env-shell-init (process) "Activate the current env in a newly opened shell PROCESS." (let* ((activate-command (if (eq system-type 'windows-nt) '("activate") '("source" "activate"))) (full-command (append activate-command(,conda-env-current-name "\n"))) (command-string (combine-and-quote-strings full-command))) (comint-send-string process command-string))) ` When I change '("source" "activate"))) to '("conda" "activate")))

it works for me.

According to this SO post conda 4.4 and newer should use "conda activate" rather than what the previous versions used as "source activate". https://stackoverflow.com/questions/47246350/conda-activate-not-working

necaris commented 4 years ago

@mbarton98 thank you for reporting this, and apologies for taking so long to get to it. I'll have to look into how to maintain compatibility with an older version of Conda while using conda activate...

necaris commented 4 years ago

See #58 for a partial fix, would appreciate any thoughts on it!

necaris commented 2 years ago

Closing this as fixed with #58 since there haven't been comments since -- please reopen if needed!