WebFaction
Community site: login faq

I'm strugling to get past: mkvirtualenv --no-site-packages --distribute --python=/usr/local/bin/python2.7 my_env_name

After I run that and while in (my_env_name)[myusername@myserver ~]$ I can run yolk -l ("which should not be installed") and it shows that I have django 1.3.1 install too and a few other libs install all of which should not be installed. Also I don't see my new directory, I thought mkvirtualenv makes a new directory with lib, bin, ect..? if so where does it put it? I'm a complete noob and any help would be greatly welcome.

asked 13 Feb '12, 16:22

gfxcomplex
736
accept rate: 0%


I attempted to log in as your user and reproduce this issue, but was unable to import django,

[you@webX my_env_name]$ source bin/activate
(my_env_name)[you@webX my_env_name]$ python2.7
Python 2.7.1 (r271:86832, Sep 13 2011, 19:13:17) 
[GCC 4.4.4 20100726 (Red Hat 4.4.4-13)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named django

You can see what sys.path info the virtualenv is importing by printing sys.path

import sys
print sys.path

The directory is hidden, notice it starts with '.', so try enabling hidden files in your client or using 'ls -la' to look for it.

Yolk is a binary and not a python package and so it uses a different set of PATH info which is defined in .bash_profile, it is also not managed by virtualenv the same way,

$ which yolk
~/bin/yolk

More info on virtualenv can be found here.

permanent link

answered 13 Feb '12, 17:14

johns
5.3k212
accept rate: 23%

Ok so I found my .virtualenvs, though I tried to ll and ls -la none of which showed .virtualenvs

(13 Feb '12, 17:42) gfxcomplex

Try using this command, it is how I found the virtualenv when poking around,

find | grep activate
(13 Feb '12, 18:00) johns

I though --python=/usr/local/bin/python2.7 set the link to point to 2.7 vs 2.6?

permanent link

answered 13 Feb '12, 17:53

gfxcomplex
736
accept rate: 0%

I never trust this, I always use the full name of the binary when executing commands,

python2.7

But it should have copied the correct python binary into place as you state, that is what that command does. And virtualenv does have its own copy of the python binary in its ./bin/ directory for this reason. You can check by running

python
which python

and checking the version it reports.

(13 Feb '12, 18:02) johns

Thanks for all you help johns I figured it out, I had already once ran the mkenv with my_env_name as I was following a tut. That was to using that python flag so that's why it was using the 2.6 vs 7.

With your help I think I finally got my head around using virualenv thanks again.

(13 Feb '12, 18:24) gfxcomplex
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×906
×55

question asked: 13 Feb '12, 16:22

question was seen: 3,789 times

last updated: 13 Feb '12, 18:24

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM