I created a virtual environment that I can activate used a command line from Terminal (Ubuntu):

source/bin activate

I did what follows to achieve the same on emacs:

M-! then source/bin activate then RET

But then I guess the virtual environment is not activated and I am getting this error message:

/bin/bash: source/bin: No such file or directory

What am I missing?


It seems I have to use a package like auto-virtualenv; and for that I have to tell Emacs to use the MELPA repository. So following the documentation. I restarted Emacs but still can not install that package with it (M-! package-install RET auto-virtualenvRET )


Installing the virtual environment auto-virtualenv is done thanks to wvxvw's comment below. So I am supposed to get rid of the error I mentioned above, but no, it is still there.


When I run M-! then pwd I get this:


Then I type M-! and source/bin activate, I get this error message:

/bash: source/bin: No such file or directory

  • 2
    Several things in play here: your current directory at the point where you invoke this command isn't set to the parent directory of source/bin, activating virtual environment like this won't have the desired effect, there's a package for that, and the command is M-x pyvenv-activate iirc. I think, these days it is packaged with Elpy: github.com/jorgenschaefer/elpy
    – wvxvw
    Commented Mar 28, 2018 at 6:41
  • I am on the right directory, but as you said I need to install a package. I am trying to use auto-virtualenv but I am having difficulty to configure the .emacs file to use MELPA packages as described here Commented Mar 28, 2018 at 6:44
  • 1
    I think I'm actually using pyvenv.el, as for your setup: it looks standard. Can you try instead M-x list-packages, then find the package you want to install, then press i on it, then x?
    – wvxvw
    Commented Mar 28, 2018 at 8:24
  • Your comment solved the problem related to installing the virtual environment package. So thank you very much. I just do not understand why I still am getting the same error mentioned in my question when I run source/bin activate Commented Mar 28, 2018 at 11:14
  • Try M-! pwd to see what bash sees as its current directory, that will probably explain why it cannot find source/bin.
    – wvxvw
    Commented Mar 28, 2018 at 11:40

1 Answer 1


I think source/bin is not an executable.

Maybe the good command is:

. $PATH_TO_VIRTUALENV/bin/activate or source $PATH_TO_VIRTUALENV/bin/activate

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.