15

I'm using virtualenv-1.4.5 on Mac OS X 10.6.2 (Xcode is installed) and Python 2.6. Here's what I get when I attempt to run a virtualenv...

 Mac-Pro:pylonsdev paul$ virtualenv --no-site-packages -v trythis
Creating trythis/lib/python2.6
Symlinking Python bootstrap modules
  Symlinking trythis/lib/python2.6/_abcoll.pyc
  Symlinking trythis/lib/python2.6/_abcoll.pyo
  Symlinking trythis/lib/python2.6/abc.pyc
  Symlinking trythis/lib/python2.6/abc.pyo
  Symlinking trythis/lib/python2.6/codecs.pyc
  Symlinking trythis/lib/python2.6/codecs.pyo
  Symlinking trythis/lib/python2.6/config
  Symlinking trythis/lib/python2.6/copy_reg.pyc
  Symlinking trythis/lib/python2.6/copy_reg.pyo
  Symlinking trythis/lib/python2.6/encodings
  Symlinking trythis/lib/python2.6/fnmatch.pyc
  Symlinking trythis/lib/python2.6/fnmatch.pyo
  Symlinking trythis/lib/python2.6/genericpath.pyc
  Symlinking trythis/lib/python2.6/genericpath.pyo
  Symlinking trythis/lib/python2.6/lib-dynload
  Symlinking trythis/lib/python2.6/linecache.pyc
  Symlinking trythis/lib/python2.6/linecache.pyo
  Symlinking trythis/lib/python2.6/locale.pyc
  Symlinking trythis/lib/python2.6/locale.pyo
  Symlinking trythis/lib/python2.6/ntpath.pyc
  Symlinking trythis/lib/python2.6/ntpath.pyo
  Symlinking trythis/lib/python2.6/os.pyc
  Symlinking trythis/lib/python2.6/os.pyo
  Symlinking trythis/lib/python2.6/posixpath.pyc
  Symlinking trythis/lib/python2.6/posixpath.pyo
  Symlinking trythis/lib/python2.6/re.pyc
  Symlinking trythis/lib/python2.6/re.pyo
  Symlinking trythis/lib/python2.6/sre.pyc
  Symlinking trythis/lib/python2.6/sre.pyo
  Symlinking trythis/lib/python2.6/sre_compile.pyc
  Symlinking trythis/lib/python2.6/sre_compile.pyo
  Symlinking trythis/lib/python2.6/sre_constants.pyc
  Symlinking trythis/lib/python2.6/sre_constants.pyo
  Symlinking trythis/lib/python2.6/sre_parse.pyc
  Symlinking trythis/lib/python2.6/sre_parse.pyo
  Symlinking trythis/lib/python2.6/stat.pyc
  Symlinking trythis/lib/python2.6/stat.pyo
  Symlinking trythis/lib/python2.6/types.pyc
  Symlinking trythis/lib/python2.6/types.pyo
  Symlinking trythis/lib/python2.6/UserDict.pyc
  Symlinking trythis/lib/python2.6/UserDict.pyo
  Symlinking trythis/lib/python2.6/warnings.pyc
  Symlinking trythis/lib/python2.6/warnings.pyo
Creating trythis/lib/python2.6/site-packages
Writing trythis/lib/python2.6/site.py
Writing trythis/lib/python2.6/orig-prefix.txt
Writing trythis/lib/python2.6/no-global-site-packages.txt
Creating parent directories for trythis/include
Symlinking trythis/include/python2.6
Creating trythis/bin
New python executable in trythis/bin/python
Changed mode of trythis/bin/python to 0755
Symlinking trythis/.Python
Error [Errno 2] No such file or directory while executing command install_name_tool -change /System/Library/Frameworks/Pyt...ython @executable_path/../.Python trythis/bin/python
Could not call install_name_tool -- you must have Apple's development tools installed
Traceback (most recent call last):
  File "/usr/local/bin/virtualenv", line 8, in <module>
    load_entry_point('virtualenv==1.4.5', 'console_scripts', 'virtualenv')()
  File "/Library/Python/2.6/site-packages/virtualenv-1.4.5-py2.6.egg/virtualenv.py", line 529, in main
    use_distribute=options.use_distribute)
  File "/Library/Python/2.6/site-packages/virtualenv-1.4.5-py2.6.egg/virtualenv.py", line 612, in create_environment
    site_packages=site_packages, clear=clear))
  File "/Library/Python/2.6/site-packages/virtualenv-1.4.5-py2.6.egg/virtualenv.py", line 806, in install_python
    py_executable])
  File "/Library/Python/2.6/site-packages/virtualenv-1.4.5-py2.6.egg/virtualenv.py", line 557, in call_subprocess
    cwd=cwd, env=env)
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/subprocess.py", line 595, in __init__
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/subprocess.py", line 1106, in _execute_child
OSError: [Errno 2] No such file or directory

Any suggestions why this error is being thrown?

Oberon Dude
  • 455
  • 2
  • 5
  • 6

7 Answers7

24

All you really need to do is install the Xcode "Command Line Tools", there is two ways to do it:

1.- If you already have Xcode installed, go to Preferences -> Downloads and select "Command Line Tools".

2.- Download the "Command Line Tools for Xcode" .dmg from: https://developer.apple.com/downloads.

You can install Xcode using the App Store, but it will not include the "Command Line Tools" by default.

guerrerocarlos
  • 1,374
  • 12
  • 6
12

Install XCode from the App Store to fix the problem. I had the same error, installed XCode, ran it after installing, and now virtualenv works.

slacy
  • 11,397
  • 8
  • 56
  • 61
Dwayne Bailey
  • 121
  • 1
  • 2
  • 1
    +1 to this. Went to AppStore, paid the $5, downloaded it (was confused for a minute because it still didn't work, but I hadn't run the installer yet, duh). After that, worked perfectly. – Robert Neville Mar 14 '11 at 01:29
  • 1
    +1 lame... upgraded to Lion and had to reinstall xcode to fix this issue – Aaron Jul 22 '11 at 23:43
  • I just updated to lion, and I am getting that error too, Will upgrade my xcode and see what happens! – Arthur Neves Jul 23 '11 at 20:21
4

Well, the error message includes this:

you must have Apple's development tools installed

Do you? They're on the separate XCode disk that came with OSX.

Daniel Roseman
  • 588,541
  • 66
  • 880
  • 895
  • 1
    Well code says you have not installed Xcode but you say you have. What does which install_name_tool at the command line say? It should be install_name_tool -> install_name_tool == /usr/bin/install_name_tool – mmmmmm Mar 01 '10 at 11:06
3

I had the same error messages trying to run virtualenv on a up-to-date Max OSX Lion installation with XCode installed.

However: Mark hints on Mar 1 2010:

Well code says you have not installed Xcode but you say you have. What does which install_name_tool at the command line say? It should be install_name_tool -> install_name_tool == /usr/bin/install_name_tool

I had the same problem. I had installed the latest Xcode in Lion (10.7.2).

 $ locate install_name_tool
 /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/install_name_tool
 /Developer/usr/bin/install_name_tool
 /Developer/usr/share/man/man1/install_name_tool.1

I made a simlink from the /Developer/usr/bin to the /usr/bin with

 $ sudo ln -s /Developer/usr/bin/install_name_tool /usr/bin/install_name_tool

Entering the 'which' command yields:

 $ which install_name_tool
 /usr/bin/install_name_tool

After that I did the virtualenv magic

$ virtualenv -p python2.6 myvirtenv
Running virtualenv with interpreter /opt/local/bin/python2.6
New python executable in myvirtenv/bin/python
Installing setuptools............................done.
Installing pip...............done.
Community
  • 1
  • 1
jochem
  • 247
  • 3
  • 15
1

There's also a bug with virtualenv on 10.6 See the ticket on virtualenv's bitbucket. Even if you solve the problem you're having you'll still run into another problem (I think image not found for Python.framework, but I don't remember - I didn't take any notes when I ran into this)

I did some investigating into this and I hope the root of the problem with be resolved with Python 2.7 - certainly people know about it, and submitted a patch to CPython to fix it.

However, it does seem like some people have had good results with 10.6.2 and virtualenv 1.4.5... or not using the system Python anymore (macports, build-by-hand).

RyanWilcox
  • 13,890
  • 1
  • 36
  • 60
  • URL is broken: "This repository does not have issue tracking enabled." This might be the ticket on github? https://github.com/pypa/virtualenv/issues/50 – Andrew B. Apr 25 '11 at 00:44
1

There is a solution for this using @gregglind's fork of virtualenv. I answered to the same problem here: mac osx: unable to use virtualenv

git clone https://github.com/gregglind/virtualenv.git
cd virtualenv
git checkout feature/install_name_tool
sudo python setup.py install
Community
  • 1
  • 1
Andrei Radulescu
  • 1,989
  • 1
  • 17
  • 29
0

add install_name_tool to your path

export PATH=$PATH:/Developer/usr/bin

fijiaaron
  • 5,015
  • 3
  • 35
  • 28