4

I'm trying to create an environment using virtualenv.

virtualenv test
New python executable in test/bin/python
Error [Errno 2] No such file or directory while executing command install_name_tool -change /System/Library/Fram.../Versions/2.6/Python @executable_path/../.Python test/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.6.4', 'console_scripts', 'virtualenv')()
  File "/Library/Python/2.6/site-packages/virtualenv-1.6.4-py2.6.egg/virtualenv.py", line 810, in main
    never_download=options.never_download)
  File "/Library/Python/2.6/site-packages/virtualenv-1.6.4-py2.6.egg/virtualenv.py", line 901, in create_environment
    site_packages=site_packages, clear=clear))
  File "/Library/Python/2.6/site-packages/virtualenv-1.6.4-py2.6.egg/virtualenv.py", line 1166, in install_python
    py_executable])
  File "/Library/Python/2.6/site-packages/virtualenv-1.6.4-py2.6.egg/virtualenv.py", line 843, 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

Folder is created alright, but files like activate are missing. Anyone? (I have xcode 3.2.3 installed. running python 2.6, osx 10.6.8)

goh
  • 27,631
  • 28
  • 89
  • 151

4 Answers4

4

Your developer tools are not installed correctly. I recommend installing Xcode 4.

LaC
  • 12,624
  • 5
  • 39
  • 38
  • 1
    For use with the Apple-supplied Python on OS X 10.6, you are actually better off sticking with Xcode 3 (3.2.6 is current for OS X 10.6), rather than using Xcode 4. See, for example, http://stackoverflow.com/questions/5944332/broken-pipe-error-when-using-pip-to-install-pycrypto-on-mac-os-x/5944375#5944375. – Ned Deily Jul 25 '11 at 18:48
  • 1
    and do your self a favor and install brew python brew install python --framework --universal – jassinm Aug 05 '11 at 01:48
3

I had the same error messages trying to run virtualenv on a up-to-date Max OS X Lion (10.7.2) installation with XCode installed and very up-to-date using the App Store.

I missed the /usr/bin/install_name_tool as well, however it is there in the system. Use the terminal in the following code blocks.

 $ 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.

Works like a charm now!

jochem
  • 247
  • 3
  • 15
0

Use install_name_tool from @gregglind's fork of virtualenv:

git clone https://github.com/gregglind/virtualenv.git
cd virtualenv
git checkout feature/install_name_tool
sudo python setup.py install

Credits: macdhuibh (https://github.com/pypa/virtualenv/issues/7)

Andrei Radulescu
  • 1,989
  • 1
  • 17
  • 29
0

Get the XCode Command line tools from here:

https://developer.apple.com/downloads/index.action?name=for%20Xcode%20-#

I just fresh installed Lion, and installed XCode from the App Store - and these didn't get installed at the same time, need a separate install now I guess...