0

This question answers where spacemacs looks for conda environments and how to change them with major-mode pyvenv-workon.

There's one environment that I use for 90% of what I do. Can I set a default environment for the python layer or is it more reasonable to have a init for the python layer that calls pyvenv-workon? I'm new to emacs and spacemacs, so how would I do either of these?

There doesn't appear to be a specific variable in the python layer and the dotspacemacs/user-config () would run on any layer, so I might not want that. Despite that, what I did was write (pyvenv-workon "path/to/default/conda") in the user-config () and it seems to work for python code and likely others, but I'm not sure if it will break anything that relies on the system python.

1 Answer 1

0

I think I figured it out while trying to learn git. Since Spacemacs has project management tools, if it identifies the file to be in a project, it will includes a .dir-local.el file to set local parameters. Because of the ,Vw command (which calls major-mode pyvenv-workon) my .dir-locals.el file looks like,

;;; Directory Local Variables ;;; For more information see (info "(emacs) Directory Variables")

((python-mode (python-shell-virtualenv-root . /home/john/miniconda3/envs/physics)))

So if you're in a project, setting pyvenv values once is enough if you've got the file in a project. I'm not sure if Spacemacs recognizes project types other than git, but I think I got it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.