1

I'm having a lot of problems installing things with pip install.

Most pip installs fail. I'll give a few snippets here to demonstrate, but nearly every pip install fails in a similar way. I've tried some simple things like upgrading pip but no luck so far.

I'm running:

 pip 8.1.2 from /Library/Python/2.7/site-packages (python 2.7)
 OSX 10.10.4 Yosemite

For example, if I try to install a module such as a web scraping library, Things appear to start off fine:


pip install scrapy

Collecting scrapy /Library/Python/2.7/site-packages/pip/vendor/requests/packages/urllib3/util/ssl.py:318: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#snimissingwarning. SNIMissingWarning /Library/Python/2.7/site-packages/pip/vendor/requests/packages/urllib3/util/ssl.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning. InsecurePlatformWarning Using cached Scrapy-1.1.0-py2.py3-none-any.whl Requirement already satisfied (use --upgrade to upgrade): pyOpenSSL in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from scrapy) Requirement already satisfied (use --upgrade to upgrade): cssselect>=0.9 in /Library/Python/2.7/site-packages (from scrapy) Requirement already satisfied (use --upgrade to upgrade): PyDispatcher>=2.0.5 in /Library/Python/2.7/site-packages (from scrapy) Collecting parsel>=0.9.3 (from scrapy) Using cached parsel-1.0.2-py2.py3-none-any.whl Collecting lxml (from scrapy) Using cached lxml-3.6.0.tar.gz

but later ends up the same:


      Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?

details:


cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -arch i386 -pipe -I/Applications/MAMP/Library/include -I/Applications/MAMP/Library/include/libxml2 -Isrc/lxml/includes -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/lxml/lxml.etree.c -o build/temp.macosx-10.10-intel-2.7/src/lxml/lxml.etree.o -w -flat_namespace
  In file included from src/lxml/lxml.etree.c:320:
  src/lxml/includes/etree_defs.h:14:10: fatal error: 'libxml/xmlversion.h' file not found
  #include "libxml/xmlversion.h"
           ^
  1 error generated.
  Compile failed: command 'cc' failed with exit status 1
  creating var
  creating var/folders
  creating var/folders/y4
  creating var/folders/y4/5myrk5lj12990054wgpw6hmxrhplv2
  creating var/folders/y4/5myrk5lj12990054wgpw6hmxrhplv2/T
  cc -I/Applications/MAMP/Library/include -I/Applications/MAMP/Library/include/libxml2 -I/usr/include/libxml2 -c /var/folders/y4/5myrk5lj12990054wgpw6hmxrhplv2/T/xmlXPathInitFfTVls.c -o var/folders/y4/5myrk5lj12990054wgpw6hmxrhplv2/T/xmlXPathInitFfTVls.o
  /var/folders/y4/5myrk5lj12990054wgpw6hmxrhplv2/T/xmlXPathInitFfTVls.c:2:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
  main (int argc, char **argv) {
  ^
  1 warning generated.
  cc var/folders/y4/5myrk5lj12990054wgpw6hmxrhplv2/T/xmlXPathInitFfTVls.o -L/Applications/MAMP/Library/lib -lxml2 -o a.out
  ld: warning: ignoring file /Applications/MAMP/Library/lib/libxml2.dylib, missing required architecture x86_64 in file /Applications/MAMP/Library/lib/libxml2.dylib (2 slices)
  Undefined symbols for architecture x86_64:
    "_xmlXPathInit", referenced from:
        _main in xmlXPathInitFfTVls.o
  ld: symbol(s) not found for architecture x86_64
  clang: error: linker command failed with exit code 1 (use -v to see invocation)
  *********************************************************************************
  Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?
  Perhaps try: xcode-select --install
  *********************************************************************************
  error: command 'cc' failed with exit status 1

  ----------------------------------------
  Failed building wheel for lxml
MedicineMan
  • 15,008
  • 32
  • 101
  • 146
  • check this out : http://stackoverflow.com/a/19604913/758667 I guess you should install command line tools using `xcode-select --install` command – sheshkovsky May 21 '16 at 21:13
  • I tried that out. It seems to suggest that it installs the xcode command line tools, which I've already installed. – MedicineMan May 21 '16 at 21:15

1 Answers1

0

OK I have no idea why this worked, but this worked.

I went here: https://www.continuum.io/downloads

and I installed Anaconda for OSX python version 2.7.

I opened a new terminal window, confirmed that conda was installed and then tried using pip again. It was all fixed. No idea why this worked, but it worked for me.

MedicineMan
  • 15,008
  • 32
  • 101
  • 146