necaris / conda.el

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

activating environment does not set additional environment variables #53

Closed jefftrull closed 4 years ago

jefftrull commented 4 years ago

Conda provides the ability to set the environment variable of your choice upon entry to a conda environment using the conda env config vars set command. I have set LD_LIBRARY_PATH in my development environment, in order to pick up some shared libraries:

$ echo $LD_LIBRARY_PATH

$ conda activate gtdev
(gtdev) $ echo $LD_LIBRARY_PATH
/home/jet/boost_1_71_0/stage/lib
(gtdev) $

Unfortunately when I execute a file (using C-c C-c in elpy) I find that the resulting Python execution shell does not have it set:

ImportError: libboost_iostreams.so.1.71.0: cannot open shared object file: No such file or directory

>>> import os
>>> print(os.environ['LD_LIBRARY_PATH'])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/jet/miniconda3/envs/gtdev/lib/python3.7/os.py", line 681, in __getitem__
    raise KeyError(key) from None
KeyError: 'LD_LIBRARY_PATH'
>>> 

Does conda.el support this functionality? Have I misconfigured it? Thanks.

necaris commented 4 years ago

@jefftrull this looks like it's related to #25 -- is that accurate? Or are you using a method other than an activate.d script?

conda.el does not currently support this functionality -- it's on the list of features I'd like to be able to implement, though.

jefftrull commented 4 years ago

Ah, you are right, this is duplicate of #25 . I didn't know what activate.d was, but this is probably the same issue.

I have a workaround involving postactivate/predeactivate hooks for now.