title: Pycrypto install fatal error: gmp.h file not found
body: <p>It seems like there are a number of people who have had a similar problem, however, after much searching I haven't been able to find a solution that works with my particular architecture.  I'm trying to install Pycrypto (as a subsidiary of Fabric) to no avail.  </p>
  
  <p>I'm running Mac 10.8.2, python 2.7.3 via Homebrew, and XCode 4.6 -- installing with pip or easy_install (I've tried both).  From what I can tell, the problem could either be with respect to my version of XCode or because of my libraries.  The Command Line Tools for XCode have been installed and I have tried placing <code>setenv ARCHFLAGS "-arch i386 -arch x86_64"</code> in my .cshrc file.  I have also tried <code>ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer /Developer</code>.  As for the libraries, I've tried linking them via <code>ln -s /usr/local/lib/libgmp.dylib /usr/lib/libgmp.dylib</code> - but that also didn't work.  </p>
  
  <p>The error is always the same (see below) no matter what angle I attempt.  Any and all help would be appreciated.</p>
  
  <pre><code>/usr/local/share/python% pip install pycrypto
  Downloading/unpacking pycrypto
    Running setup.py egg_info for package pycrypto
  
  Installing collected packages: pycrypto
    Running setup.py install for pycrypto
      building 'Crypto.PublicKey._fastmath' extension
      /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -fno-strict-aliasing -fno-common -dynamic -arch i386 -arch x86_64 -pipe -mmacosx-version-min=10.8 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk -Wno-unused-value -Wno-empty-body -Qunused-arguments -fwrapv -Wall -Wstrict-prototypes -std=c99 -O3 -fomit-frame-pointer -Isrc/ -I/usr/include/ -I/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/_fastmath.c -o build/temp.macosx-10.8-intel-2.7/src/_fastmath.o
  src/_fastmath.c:36:11: fatal error: 'gmp.h' file not found
  # include &lt;gmp.h&gt;
            ^
  1 error generated.
  error: command '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang' failed with exit status 1
  Complete output from command /usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -c "import setuptools;__file__='/var/folders/ym/v8l23q_x2xz_qhx3m84n6ym00005fr/T/pip-build/pycrypto/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/ym/v8l23q_x2xz_qhx3m84n6ym00005fr/T/pip-Xb7nGV-record/install-record.txt --single-version-externally-managed:
  running install
  
  running build
  
  running build_py
  
  running build_ext
  
  running build_configure
  
  building 'Crypto.PublicKey._fastmath' extension
  
  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -fno-strict-aliasing -fno-common -dynamic -arch i386 -arch x86_64 -pipe -mmacosx-version-min=10.8 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk -Wno-unused-value -Wno-empty-body -Qunused-arguments -fwrapv -Wall -Wstrict-prototypes -std=c99 -O3 -fomit-frame-pointer -Isrc/ -I/usr/include/ -I/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/_fastmath.c -o build/temp.macosx-10.8-intel-2.7/src/_fastmath.o
  
  src/_fastmath.c:36:11: fatal error: 'gmp.h' file not found
  
  # include &lt;gmp.h&gt;
  
        ^
  
  1 error generated.
  
  error: command '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain    /usr/bin/clang' failed with exit status 1
  
  ----------------------------------------
  Command /usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -c "import setuptools;__file__='/var/folders/ym/v8l23q_x2xz_qhx3m84n6ym00005fr/T/pip-build/pycrypto/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/ym/v8l23q_x2xz_qhx3m84n6ym00005fr/T/pip-Xb7nGV-record/install-record.txt --single-version-externally-managed failed with error code 1 in /var/folders/ym/v8l23q_x2xz_qhx3m84n6ym00005fr/T/pip-build/pycrypto
  Storing complete log in /Users/me/.pip/pip.log
  </code></pre>
  
  <p>The error when I try to call Fabric:</p>
  
  <pre><code>Traceback (most recent call last):
    File "/usr/local/share/python/fab", line 5, in &lt;module&gt;
  from pkg_resources import load_entry_point
    File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/distribute-0.6.28-py2.7.egg/pkg_resources.py", line 2815, in &lt;module&gt;
  working_set.require(__requires__)
    File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/distribute-0.6.28-py2.7.egg/pkg_resources.py", line 690, in require
  needed = self.resolve(parse_requirements(requirements))
    File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/distribute-0.6.28-py2.7.egg/pkg_resources.py", line 588, in resolve
  raise DistributionNotFound(req)
  pkg_resources.DistributionNotFound: pycrypto&gt;=2.1,!=2.4
  </code></pre>