pythonpipclangmacos-high-sierra

clang fails with pip install on macos


I am running pip install scrypt==0.8.0.
I get the following error: error: command '/usr/bin/clang' failed with exit status 1. I have xcode-select, gcc etc. installed. when i try to cd into that folder it doesn't exist and running clang --version it gives me:

Apple LLVM version 9.0.0 (clang-900.0.38)
Target: x86_64-apple-darwin17.2.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

full error: https://pastebin.com/JZW1jRCy


Solution

  • Well... It seems that the problem lies on Apple's side. I was able to reproduce the issue on my Macbook with High Sierra. I found this discussion on github regarding other cryptographic library for python and the solution they used worked for me.

    $  env LDFLAGS="-L$(brew --prefix openssl)/lib" CFLAGS="-I$(brew --prefix openssl)/include" pip install scrypt==0.8.0
    

    Scrypt installed without any problems and I was able to import it in my interpreter:

    $  python
    Python 3.6.3 (default, Oct  4 2017, 06:09:15) 
    [GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.37)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import scrypt
    >>> dir(scrypt)
    ['ERROR_MESSAGES', 'IS_PY2', 'MAXMEMFRAC_DEFAULT', 'MAXMEM_DEFAULT', 'MAXTIME_DEFAULT', 'MAXTIME_DEFAULT_ENC', 'POINTER', '__all__', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', '__warningregistry__', '_crypto_scrypt', '_ensure_bytes', '_scrypt', '_scryptdec_buf', '_scryptenc_buf', 'c_char_p', 'c_double', 'c_int', 'c_size_t', 'c_uint32', 'c_uint64', 'cdll', 'create_string_buffer', 'decrypt', 'encrypt', 'error', 'hash', 'imp', 'os', 'pointer', 'sys']
    >>>
    

    I see, however, that cryptography library describes alternative solution here. Unfortunatelly, I was unable to reproduce the issue locally after using mentioned solution so I can't say if it solves the problem. I'd suggest going through it first since it seems less intrusive.