22

1) I installed virtualenv using pip.
2) I ran the command virtualenv venv
3) Then I ran source venv/bin/activate but it says that there is no such file or directory.

When I cd into venv/bin I find 3 things - python, python 2.7, and python 3.5. Does anyone know the problem?

Thomas
  • 5,322
  • 6
  • 37
  • 46
Aaron Cheung
  • 241
  • 1
  • 2
  • 6
  • Just to check: what OS are you running this on? (Windows virtualenv, at least the one in front of me, puts activate in the scripts directory but then again, it also puts python in there vs bin) (Also, what other directories does venv have?) – Foon Jan 17 '17 at 01:53
  • I'm running it on mac osx. Venv also has include and lib. I feel like I downloaded too many versions of python now its screwing everything up. – Aaron Cheung Jan 18 '17 at 21:08
  • Hmm... I'm not used to virtualenv dropping down both python 2.7 and 3.5 as the result of running the command once... can you run virtualenv new-venv-18-Jan (or some other name that you've absolutely never used before), and include all the output you get from running that command? (Assuming you still don't get activate in the new virtualenv) – Foon Jan 18 '17 at 21:40
  • Its says: New python executable in... Installing setuptools, pip, wheel... Complete output from command... ImportError: dlopen ... Symbol not found ... Expected in: flat namespace ...Installing setuptools, pip, wheel...done. setuptools pip wheel failed with error code 1 Thats pretty much a summary of what it says – Aaron Cheung Jan 18 '17 at 23:33
  • So you ran `sudo pip install virtualenv` on your system Python? You really aren't giving us much help here ... – holdenweb Jan 19 '17 at 17:23
  • For some weird reason the `activate` files were created without the execute file privileges (664 to be precise). Changing the permissions didn't help though. – shad0w_wa1k3r Oct 15 '17 at 14:56
  • 3
    @AshishNitinPatil This is intentional. You shouldn't execute `activate`, but source it e.g. "source activate" or ". activate" (note space) – ivan_onys Feb 02 '18 at 13:16

7 Answers7

28

i have had the same problem. and what i did is just run the command virtualenv env again. And then more files were generated under directory env/bin, including the activate file. it's so weird.

crmpicco
  • 15,553
  • 24
  • 124
  • 206
jiaqi jiang
  • 381
  • 2
  • 2
5

I solved the similar problem running python3.7 -m venv venv, you can change for your version of python that is installed in your enviroment.

1

I solved a similar problem by naming it venv2 when I ran virtualenv. I already had a virtual environment named venv for another project. This allowed me to proceed.

Steve Scott
  • 1,176
  • 3
  • 17
  • 23
1

I experienced this problem when using the --upgrade option. Removed the option, and all ran as expected.

1

According to Python doc, the installation step is

$ python3 -m pip install --user virtualenv

$ python3 -m venv env

The last command gives a warning message,

The virtual environment was not created successfully because ensurepip is not
available.  On Debian/Ubuntu systems, you need to install the python3-venv
package using the following command.

    apt-get install python3-venv

You may need to use sudo with that command.  After installing the python3-venv
package, recreate your virtual environment.
$ sudo apt-get install python3-venv

Now, activate is available.

WhaSukGO
  • 455
  • 6
  • 13
0

I double it is caused by some networking issue, I run it twice to get 'activate' script installed. Maybe first it can't connect to some source so it just abort installation.

0

I had this happen on rasbian when I hadn't installed python3-pip before creating the venv.

Dustin Wyatt
  • 3,849
  • 5
  • 29
  • 55