Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Build a Social Network with Flask Making Strong Users Cryptographic Hashing with Flask-Bcrypt

Daniel Bowen
Daniel Bowen
8,577 Points

Can't install b-crypt (El Capitan OSX)

Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/c/j1gfpgbx4k14tgfy08r559dh0000gn/T/pip-build-oshr1_p/cffi/

I've searched what I can, and my Google-fu has failed me. Any suggestions or ideas?

Daniel Bowen
Daniel Bowen
8,577 Points

After hours of messing with it, I've narrowed it down to a problem with my python installation. XCode also currently doesn't work. I think it has to do with Python having been updated, but I've no idea how to get it back to the original version of 2.7 that El Capitan came with. I'm still pretty new to Mac, been developing on Windows exclusively for a long time.

(venv) Is-iMac:Python Projects hellspawn$ pip install flask-bcrypt
Collecting flask-bcrypt
  Using cached Flask-Bcrypt-0.7.1.tar.gz
Requirement already satisfied (use --upgrade to upgrade): Flask in /Users/hellspawn/Projects/myproject/venv/lib/python3.6/site-packages (from flask-bcrypt)
Collecting bcrypt (from flask-bcrypt)
  Using cached bcrypt-3.1.0.tar.gz
Requirement already satisfied (use --upgrade to upgrade): Werkzeug>=0.7 in /Users/hellspawn/Projects/myproject/venv/lib/python3.6/site-packages (from Flask->flask-bcrypt)
Requirement already satisfied (use --upgrade to upgrade): Jinja2>=2.4 in /Users/hellspawn/Projects/myproject/venv/lib/python3.6/site-packages (from Flask->flask-bcrypt)
Requirement already satisfied (use --upgrade to upgrade): click>=2.0 in /Users/hellspawn/Projects/myproject/venv/lib/python3.6/site-packages (from Flask->flask-bcrypt)
Requirement already satisfied (use --upgrade to upgrade): itsdangerous>=0.21 in /Users/hellspawn/Projects/myproject/venv/lib/python3.6/site-packages (from Flask->flask-bcrypt)
Collecting cffi>=1.1 (from bcrypt->flask-bcrypt)
  Using cached cffi-1.7.0.tar.gz
    Complete output from command python setup.py egg_info:
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    2016-07-01 03:50:35.734 xcodebuild[2304:53328] [MT] DVTPlugInLoading: Failed to load code for plug-in com.apple.dt.dbg.DebuggerLLDB (/Applications/Xcode.app/Contents/PlugIns/DebuggerLLDB.ideplugin), error = Error Domain=NSCocoaErrorDomain Code=3587 "dlopen_preflight(/Applications/Xcode.app/Contents/PlugIns/DebuggerLLDB.ideplugin/Contents/MacOS/DebuggerLLDB): Library not loaded: /System/Library/Frameworks/Python.framework/Versions/2.7/Python
      Referenced from: /Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Versions/A/LLDB
      Reason: image not found" UserInfo={NSLocalizedFailureReason=The bundle is damaged or missing necessary resources., NSLocalizedRecoverySuggestion=Try reinstalling the bundle., NSFilePath=/Applications/Xcode.app/Contents/PlugIns/DebuggerLLDB.ideplugin/Contents/MacOS/DebuggerLLDB, NSDebugDescription=dlopen_preflight(/Applications/Xcode.app/Contents/PlugIns/DebuggerLLDB.ideplugin/Contents/MacOS/DebuggerLLDB): Library not loaded: /System/Library/Frameworks/Python.framework/Versions/2.7/Python
      Referenced from: /Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Versions/A/LLDB
      Reason: image not found, NSBundlePath=/Applications/Xcode.app/Contents/PlugIns/DebuggerLLDB.ideplugin, NSLocalizedDescription=The bundle “DebuggerLLDB” couldn’t be loaded because it is damaged or missing necessary resources.}, dyldError = dlopen(/Applications/Xcode.app/Contents/PlugIns/DebuggerLLDB.ideplugin/Contents/MacOS/DebuggerLLDB, 0): Library not loaded: /System/Library/Frameworks/Python.framework/Versions/2.7/Python
      Referenced from: /Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Versions/A/LLDB
      Reason: image not found
    2016-07-01 03:50:35.735 xcodebuild[2304:53328] [MT] DVTAssertions: Warning in /Library/Caches/com.apple.xbs/Sources/IDEFrameworks/IDEFrameworks-10188.1/IDEFoundation/Initialization/IDEInitialization.m:246
    Details:  Xcode failed its initial plug-in scan, error = Error Domain=DVTPlugInErrorDomain Code=2 "Loading a plug-in failed." UserInfo={DVTPlugInIdentifierErrorKey=com.apple.dt.dbg.DebuggerLLDB, DVTPlugInExecutablePathErrorKey=/Applications/Xcode.app/Contents/PlugIns/DebuggerLLDB.ideplugin/Contents/MacOS/DebuggerLLDB, NSLocalizedRecoverySuggestion=The plug-in or one of its prerequisite plug-ins may be missing or damaged and may need to be reinstalled., DVTPlugInDYLDErrorMessageErrorKey=dlopen(/Applications/Xcode.app/Contents/PlugIns/DebuggerLLDB.ideplugin/Contents/MacOS/DebuggerLLDB, 0): Library not loaded: /System/Library/Frameworks/Python.framework/Versions/2.7/Python
      Referenced from: /Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Versions/A/LLDB
      Reason: image not found, NSLocalizedDescription=Loading a plug-in failed., NSFilePath=/Applications/Xcode.app/Contents/PlugIns/DebuggerLLDB.ideplugin, NSLocalizedFailureReason=The plug-in “com.apple.dt.dbg.DebuggerLLDB” at path “/Applications/Xcode.app/Contents/PlugIns/DebuggerLLDB.ideplugin” could not be loaded.  The plug-in or one of its prerequisite plug-ins may be missing or damaged., NSUnderlyingError=0x7f978b428ee0 {Error Domain=NSCocoaErrorDomain Code=3587 "dlopen_preflight(/Applications/Xcode.app/Contents/PlugIns/DebuggerLLDB.ideplugin/Contents/MacOS/DebuggerLLDB): Library not loaded: /System/Library/Frameworks/Python.framework/Versions/2.7/Python
      Referenced from: /Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Versions/A/LLDB
      Reason: image not found" UserInfo={NSLocalizedFailureReason=The bundle is damaged or missing necessary resources., NSLocalizedRecoverySuggestion=Try reinstalling the bundle., NSFilePath=/Applications/Xcode.app/Contents/PlugIns/DebuggerLLDB.ideplugin/Contents/MacOS/DebuggerLLDB, NSDebugDescription=dlopen_preflight(/Applications/Xcode.app/Contents/PlugIns/DebuggerLLDB.ideplugin/Contents/MacOS/DebuggerLLDB): Library not loaded: /System/Library/Frameworks/Python.framework/Versions/2.7/Python
      Referenced from: /Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Versions/A/LLDB
      Reason: image not found, NSBundlePath=/Applications/Xcode.app/Contents/PlugIns/DebuggerLLDB.ideplugin, NSLocalizedDescription=The bundle “DebuggerLLDB” couldn’t be loaded because it is damaged or missing necessary resources.}}}
    Function: BOOL _IDEInitializePlugInManager(IDEInitializationOptions, NSError *__autoreleasing *)
    Thread:   <NSThread: 0x7f978b514fb0>{number = 1, name = main}
    Please file a bug at http://bugreport.apple.com with this warning message and any useful information you can provide.
    xcodebuild: error: Initialization failed.
        Reason: Loading a plug-in failed.
    clang: error: unable to find utility "clang", not a developer tool or in PATH
    2016-07-01 03:50:36.034 xcodebuild[2308:53342] [MT] DVTPlugInLoading: Failed to load code for plug-in com.apple.dt.dbg.DebuggerLLDB (/Applications/Xcode.app/Contents/PlugIns/DebuggerLLDB.ideplugin), error = Error Domain=NSCocoaErrorDomain Code=3587 "dlopen_preflight(/Applications/Xcode.app/Contents/PlugIns/DebuggerLLDB.ideplugin/Contents/MacOS/DebuggerLLDB): Library not loaded: /System/Library/Frameworks/Python.framework/Versions/2.7/Python
      Referenced from: /Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Versions/A/LLDB
      Reason: image not found" UserInfo={NSLocalizedFailureReason=The bundle is damaged or missing necessary resources., NSLocalizedRecoverySuggestion=Try reinstalling the bundle., NSFilePath=/Applications/Xcode.app/Contents/PlugIns/DebuggerLLDB.ideplugin/Contents/MacOS/DebuggerLLDB, NSDebugDescription=dlopen_preflight(/Applications/Xcode.app/Contents/PlugIns/DebuggerLLDB.ideplugin/Contents/MacOS/DebuggerLLDB): Library not loaded: /System/Library/Frameworks/Python.framework/Versions/2.7/Python
      Referenced from: /Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Versions/A/LLDB
      Reason: image not found, NSBundlePath=/Applications/Xcode.app/Contents/PlugIns/DebuggerLLDB.ideplugin, NSLocalizedDescription=The bundle “DebuggerLLDB” couldn’t be loaded because it is damaged or missing necessary resources.}, dyldError = dlopen(/Applications/Xcode.app/Contents/PlugIns/DebuggerLLDB.ideplugin/Contents/MacOS/DebuggerLLDB, 0): Library not loaded: /System/Library/Frameworks/Python.framework/Versions/2.7/Python
      Referenced from: /Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Versions/A/LLDB
      Reason: image not found
    2016-07-01 03:50:36.035 xcodebuild[2308:53342] [MT] DVTAssertions: Warning in /Library/Caches/com.apple.xbs/Sources/IDEFrameworks/IDEFrameworks-10188.1/IDEFoundation/Initialization/IDEInitialization.m:246
    Details:  Xcode failed its initial plug-in scan, error = Error Domain=DVTPlugInErrorDomain Code=2 "Loading a plug-in failed." UserInfo={DVTPlugInIdentifierErrorKey=com.apple.dt.dbg.DebuggerLLDB, DVTPlugInExecutablePathErrorKey=/Applications/Xcode.app/Contents/PlugIns/DebuggerLLDB.ideplugin/Contents/MacOS/DebuggerLLDB, NSLocalizedRecoverySuggestion=The plug-in or one of its prerequisite plug-ins may be missing or damaged and may need to be reinstalled., DVTPlugInDYLDErrorMessageErrorKey=dlopen(/Applications/Xcode.app/Contents/PlugIns/DebuggerLLDB.ideplugin/Contents/MacOS/DebuggerLLDB, 0): Library not loaded: /System/Library/Frameworks/Python.framework/Versions/2.7/Python
      Referenced from: /Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Versions/A/LLDB
      Reason: image not found, NSLocalizedDescription=Loading a plug-in failed., NSFilePath=/Applications/Xcode.app/Contents/PlugIns/DebuggerLLDB.ideplugin, NSLocalizedFailureReason=The plug-in “com.apple.dt.dbg.DebuggerLLDB” at path “/Applications/Xcode.app/Contents/PlugIns/DebuggerLLDB.ideplugin” could not be loaded.  The plug-in or one of its prerequisite plug-ins may be missing or damaged., NSUnderlyingError=0x7fd511d02d30 {Error Domain=NSCocoaErrorDomain Code=3587 "dlopen_preflight(/Applications/Xcode.app/Contents/PlugIns/DebuggerLLDB.ideplugin/Contents/MacOS/DebuggerLLDB): Library not loaded: /System/Library/Frameworks/Python.framework/Versions/2.7/Python
      Referenced from: /Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Versions/A/LLDB
      Reason: image not found" UserInfo={NSLocalizedFailureReason=The bundle is damaged or missing necessary resources., NSLocalizedRecoverySuggestion=Try reinstalling the bundle., NSFilePath=/Applications/Xcode.app/Contents/PlugIns/DebuggerLLDB.ideplugin/Contents/MacOS/DebuggerLLDB, NSDebugDescription=dlopen_preflight(/Applications/Xcode.app/Contents/PlugIns/DebuggerLLDB.ideplugin/Contents/MacOS/DebuggerLLDB): Library not loaded: /System/Library/Frameworks/Python.framework/Versions/2.7/Python
      Referenced from: /Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Versions/A/LLDB
      Reason: image not found, NSBundlePath=/Applications/Xcode.app/Contents/PlugIns/DebuggerLLDB.ideplugin, NSLocalizedDescription=The bundle “DebuggerLLDB” couldn’t be loaded because it is damaged or missing necessary resources.}}}
    Function: BOOL _IDEInitializePlugInManager(IDEInitializationOptions, NSError *__autoreleasing *)
    Thread:   <NSThread: 0x7fd511c154f0>{number = 1, name = main}
    Please file a bug at http://bugreport.apple.com with this warning message and any useful information you can provide.
    xcodebuild: error: Initialization failed.
        Reason: Loading a plug-in failed.
    clang: error: unable to find utility "clang", not a developer tool or in PATH

        No working compiler found, or bogus compiler options
        passed to the compiler from Python's distutils module.
        See the error messages above.
        (If they are about -mno-fused-madd and you are on OS/X 10.8,
        see http://stackoverflow.com/questions/22313407/ .)

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/_c/j1gfpgbx4k14tgfy08r559dh0000gn/T/pip-build-f1x8k5ll/cffi/

1 Answer

Daniel Bowen
Daniel Bowen
8,577 Points

After fiddling with it for a day and seeing messages of nothing but "Reinstall OSX", which is entirely unreasonable to ever have to do just because of one mistake, I manually downloaded the 2.7.10 Python from python.org. I installed it, manually copied the framework from Library/Frameworks to System/Library/Frameworks.

I destroyed my original virtualenv, created a new one, resintalled all of flask and its dependencies, and everything installed fine. Just wanted this out there for anyone else who might have this issue.