jorgenschaefer / pyvenv

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

environments aren't displayed with HELM #20

Closed shackra closed 9 years ago

shackra commented 10 years ago

If I run workon on the shell, I get the list of virtual environments managed by virtualenvwrapper, however, if I execute the extended command pyvenv-workon HELM displays nothing, even if I write the name of the virtualenv:

noenv

shackra commented 10 years ago

evaluating (M-:) (getenv "WORKON_HOME") returns nil, however, opening any shell bash and doing echo $WORKON_HOME prints /home/jorge/ENTORNOSVIRTUALES which is correct.

jorgenschaefer commented 10 years ago

Thank you for the report! I do not know or use helm. Does the original report mean M-x pyvenv-workon won't tab-complete virtualenvs, or is that a separate issue?

If (getenv "WORKON_HOME") returns nil, then that would explain why you don't get a completion. This is a problem with your system setup, though, as Emacs just does not see the same environment as your shells do – not much pyvenv can do there. Are you using Mac OS X? (I ask because that tends to have problems with setting environment variables correctly.)

shackra commented 10 years ago

In case of HELM, it will display a list of anything, with pyvenv it should display a list of virtualenvs, in my case, one virtualenv called PySide-env, which is not happening.

I'm not in Mac OS X (and God forbid), but the settings for virtualenvwrapper are in my .bashrc file:

# Virtualenvwrapper
export WORKON_HOME=$HOME/ENTORNOSVIRTUALES
export PROJECT_HOME=$HOME/coders
source /usr/bin/virtualenvwrapper.sh
jorgenschaefer commented 10 years ago

In case of HELM, it will display a list of anything, with pyvenv it should display a list of virtualenvs, in my case, one virtualenv called PySide-env, which is not happening.

Does M-x pyvenv-workon without helm allow tab completion of virtualenvs?

I'm not in Mac OS X (and God forbid), but the settings for virtualenvwrapper are in my .bashrc file:

How are you starting emacs?

shackra commented 10 years ago

Does M-x pyvenv-workon without helm allow tab completion of virtualenvs?

Nop. It says [No Match] when I press TAB.

How are you starting emacs?

with emacs --daemon, SpectrWM does this for me upon log in. The issue is the same even if I don't start Emacs as a daemon.

jorgenschaefer commented 10 years ago

The issue is the same even if I don't start Emacs as a daemon.

… but instead start it how?

The problem seems to be that WORKON_HOME is not set when Emacs starts. That is, when you start Emacs from a shell (which defines WORKON_HOME), I suspect it works?

If so, you need to fix whatever way you start Emacs. Apparently, that does not set the environment variables. Moving them from .bashrc to .bash_profile might be enough, but probably not. I do not know SpectrWM or whatever other way you use.

A very simple fix of course is to use (setenv "WORKON_HOME" (expand-file-name "~/ENTORNOSVIRTUALES")) in your .emacs.

shackra commented 9 years ago

My problem was that SLiM (a login manager) wasn't passing my environment variables, I switched to LightDM and know everything works fine!