These instructions are based on Mistobaan'sgistbut expanded and updated to work with thelatest tensorflow OSX CUDA PR.
Similar, also got stuck installing tensorflow on Mac OSX El Captain. Activid activclient for mac. The numpy version on El Caption is incompatible, and it is non-trivial to update numpy using pip. 'RuntimeError: module compiled against API version 0xa but this version of numpy is 0x9'.
RequirementsOS X 10.10 (Yosemite) or newer
I tested these intructions on OS X v10.10.5. They will probably work onOS X v10.11 (El Capitan), too.
Xcode Command-Line Tools
These instructions assume you have Xcode installed and your machine is already set upto compile c/c++ code.
https://powerfulzen233.weebly.com/best-laser-printer-for-mac-yosemite.html. If not, simply type
gcc into a terminal and it will prompt you to download andinstall the Xcode Command-Line Tools.
homebrew
To compile tensorflow on OS X, you need several dependent libraries. The easiest way toget them is to install them with the homebrew package manager.
If you don't already have
brew installed, you can install it like this:
If you don't want to blindly run a ruby script loaded from the internet, they havealternate install options.
coreutils, swig, bazel
First, make sure you have
brew up to date with the latest available packages:
Then install these tools:
Check the version to make sure you installed bazel 0.1.4 or greater.bazel 0.1.3 or below will fail when building tensorflow.
NVIDIA's CUDA libraries
Also installed from
brew :
Check the version to make sure you installed CUDA 7.5. Older versions will fail.
NVIDIA's cuDNN library
NVIDIA requires you to sign up and be approved before you can download this.
First, go sign up here: https://powerfulzen233.weebly.com/mac-osx-mojave-for-windows.html.
When you sign up, make sure you provide accurate information. A human at NVIDIA willreview your application. If it's a business day, hopefully you'll get approved quickly.
Then go here to download cuDNN:
Click 'Download' to fill out their survey and agree to their Terms.Finally, you'll see the download options.
However, you'll only see download options for cuDNN v4 and cuDNN v3. You'll want toscroll to the very bottom and click 'Archived cuDNN Releases'.
This will take you to this page where you can download cuDNN v2: Mojave app store.
On that page, download 'cuDNN v2 Library for OSX'.
Next, tou need to manually install it by copying over some files:
Finally, you need to make sure the library is in your library load path.Edit your
~/.bash_profile file and add this line at the bottom:
After that, close and reopen your terminal window to apply the change.
Tensorflow Version For El Capitan DownloadCheckout tensorflow
Since OS X CUDA support is still an unmerged pull request(#664), you need to checkout that specific branch:
Look up your NVIDIA card's Graphics Capability on the CUDA website
Before you start, open up System Report in OSX:
Tensorflow Version For El Capitan 10
In System Report, click on 'Graphics/Displays' and find out the exact modelNVIDIA card you have:
Then go to https://developer.nvidia.com/cuda-gpus and find that exact modelname in the list:
There it will list the Compute Capability for your card. For the GeForce GT 650Mused in late 2011 Macbook Pro Retinas, it is
3.0 . Write this down as it'scritical to have this number for the next step.
Configure and Build tensorflow
You will first need to configure the tensorflow build options:
During the config process, it will ask you a bunch of questions. You can usethe answers below except make sure to use the Compute Capability for your NVIDIA cardyou looked up in the previous step:
Now you can actually build and install tensorflow!
Verify Installaion
You need to exit the tensorflow build folder to test your installation.
Now, run
python and paste in this test script:
You should get output that looks something like this:
Yay! Now you can train your models using a GPU!
If you are using a Retina Macbook Pro with only a 1GB GeForce 650M, youwill probably run into Out of Memory errors with medium to large models. But atleast it will make small-scale experimentation faster.
Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |