jorgenschaefer / pyvenv

Python virtual environment interface for Emacs
364 stars 57 forks source link

Windows Conda and Library/bin Path #83

Open dsyzling opened 5 years ago

dsyzling commented 5 years ago

I've been using elpy/pyenv with conda under Windows. One issue I found is with packages/libraries that require runtime Windows dlls. Conda seems to install these within the virtual environment under env/Library/bin, however this path is not added to the emacs process path when activating the virtualenv. I can work around this with changes to pyvenv-activate, something like:

(new-directories (append
                  ;; Unix
                  (when (file-exists-p (format "%s/bin" directory))
                    (list (format "%s/bin" directory)))
                  ;; Windows
                  (when (file-exists-p (format "%s/Scripts" directory))
                    (list (format "%s/Scripts" directory)
                          ;; Package dlls to be loaded at runtime under windows.
                          (when (file-exists-p(format "%s/Library/bin" directory))
                            (format "%s/Library/bin" directory))
                          ;; Apparently, some virtualenv
                          ;; versions on windows put the
                          ;; python.exe in the virtualenv root
                          ;; for some reason?
                          directory))))

Does anyone know if this is valid for the Windows platform or am I missing something?

I have this working with PyCharm (although PyCharm must be started from the Anaconda prompt due to not having the virtualenv/Library/bin directory added to the path) and VS Code (which does appear to support the conda environment).