0

I am trying to setup virtualenv to keep my python env clean and organized. Well, actually I'm trying to install scrapy as I wrote about here which opened this can of python worms that I'm now trying cleanup after will virtualenv.

The final verdict was to install virtualenv (which is failing) and hence this post. This is where I'm at:

$ virtualenv test
-bash: virtualenv: command not found

I understand that this means wherever virtualenv installed via pip install virtualenv isn't in my path but it should be after following these:

  1. Can't pip install virtualenv in OS X 10.8 with brewed python 2.7

  2. http://hackercodex.com/guide/python-development-environment-on-mac-osx/

  3. https://github.com/Homebrew/homebrew/issues/12667#issuecomment-6257342

  4. http://www.lowindata.com/2013/installing-scientific-python-on-mac-os-x/

  5. Delete all virtualenv and start from scratch

brew doctor returns ready to brew.

My guess is that my system python and my brew python aren't playing nicely but I'm out of ideas as to what else I can do to fix this.

At this point I'm willing to do a clean install of just about everything (even mac os x) if that's what it takes. I'm pretty sure I sudo pip install'd something(s) a while ago and I'm paying the price for it now.

More details of the install:

~ ∮ pip install virtualenv
Requirement already satisfied (use --upgrade to upgrade): virtualenv in /usr/local/lib/python2.7/site-packages
Cleaning up...
~ ∮ pip install virtualenvwrapper
Requirement already satisfied (use --upgrade to upgrade): virtualenvwrapper in /usr/local/lib/python2.7/site-packages
Requirement already satisfied (use --upgrade to upgrade): virtualenv in /usr/local/lib/python2.7/site-packages (from virtualenvwrapper)
Requirement already satisfied (use --upgrade to upgrade): virtualenv-clone in /usr/local/lib/python2.7/site-packages (from virtualenvwrapper)
Requirement already satisfied (use --upgrade to upgrade): stevedore in /usr/local/lib/python2.7/site-packages (from virtualenvwrapper)
Cleaning up...

I tried both brew install python --with-brewed-openssl AND brew install python --framework (after uninstalling the previous when it wasn't working) (and all the other suggestions in the above links)

thanks in advance!

Community
  • 1
  • 1
santeko
  • 360
  • 5
  • 10
  • What is the result if you type `which virtualenv` – Ben Mar 14 '14 at 02:34
  • @Ben returns empty. however, in `/usr/local/lib/python2.7/site-packages` there exists virtualenv, virtualenv_clone and virtualenvwrapper files. – santeko Mar 14 '14 at 05:48
  • This leads me to think its installing ok, but is a path issue. However, I know `brew doctor` checks these paths as I've seen comments about needing or not needing certain paths in my PATH variable. I made the suggested changes and now brew seems content with this setup. – santeko Mar 14 '14 at 07:14
  • My `which virtualenv` returns `/usr/local/bin/virtualenv` - Mac 10.9 with homebrew python. I guess try a `pip uninstall` on virtualenv and then reinstall again with pip, see if it puts it in the same place... – Ben Mar 14 '14 at 16:38
  • this works! Although I don't really understand why. On the homebrew python page they explain where & why python modules will be saved in /site-packages https://github.com/Homebrew/homebrew/wiki/Homebrew-and-Python#site-packages-and-the-pythonpath I'm going to see if this fixes my scrapy issue (linked at the beginning of this post) as well. – santeko Mar 14 '14 at 17:27
  • Great, I'll submit it as an answer then. – Ben Mar 14 '14 at 17:42

1 Answers1

6

virtualenv looks to be in the wrong place. On Mac 10.9 it should be in /usr/local/bin/virtualenv.

Try a pip uninstall on virtualenv and then reinstall again with pip, see if it puts it in the right location.

Ben
  • 6,986
  • 6
  • 44
  • 71
  • this works, although I'd still like to know why it was broken in the first place and how this fixed it. according to the homebrew python github page pip is suppose to install things in `/usr/local/lib/python2.7/site-packages` which is where it was. there are two issues in my head, 1) `virtualenv` was in `/site-packages` so why wasn't it working and 2) when I pip reinstalled it, why did it put it somewhere other than where it said it would install modules: https://github.com/Homebrew/homebrew/wiki/Homebrew-and-Python#site-packages-and-the-pythonpath (edit for correct link) – santeko Mar 14 '14 at 19:57
  • Agreed, I'd be interested in knowing too (I had the same problem). Does this file exist for you: `~/.pydistutils.cfg` / what's in it? – Ben Mar 15 '14 at 16:52
  • `~/.pydistutils.cfg` does not exist for me. – santeko Mar 16 '14 at 00:24
  • I confess that I wouldn't have reinstalled virtualenv if there were no upvotes on this answer already. Good thing I did and I am too, clueless about why this worked. Alls well that ends well. – Kunal Vyas Apr 06 '15 at 11:14