0

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?

EDIT 1:

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 )

EDIT 2:

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.

EDIT 3:

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

/home/h4ck3r/development/app

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 Mar 28 '18 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 – Billal Begueradj Mar 28 '18 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 Mar 28 '18 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 – Billal Begueradj Mar 28 '18 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 Mar 28 '18 at 11:40
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, privacy policy and cookie policy

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