gigasquid / clojure-mxnet

Clojure Package for MXNET
69 stars 3 forks source link

Add useful details installation to the README for OSX #7

Open agilecreativity opened 6 years ago

agilecreativity commented 6 years ago

Hi,

Here are steps that for anyone who is running latest version of OSX to help getting started quickly.

I am using the pre-built version of the jars for testing and I found this to be helpful for me and hope more people can benefit too.

brew search opencv@2

# Install the package
brew install opencv@2

Post installation steps:

This is necessary as in your system you might have both Python3 and Python 2 installed, and you will noticed the following message when you are having both of them.

brew info opencv@2
opencv@2: stable 2.4.13.6 (bottled) [keg-only]
Open source computer vision library
https://opencv.org/
/usr/local/Cellar/opencv@2/2.4.13.6_2 (278 files, 35.4MB)
  Poured from bottle on 2018-06-21 at 19:02:01
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/opencv@2.rb
==> Dependencies
Build: cmake ✘, pkg-config ✔
Required: eigen ✔, ffmpeg ✔, jpeg ✔, libpng ✔, libtiff ✔, openexr ✔, numpy ✔
Recommended: python@2 ✔
==> Options
--without-python@2
    Build without python2 support
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.

If you need to have this software first in your PATH run:
  echo 'export PATH="/usr/local/opt/opencv@2/bin:$PATH"' >> ~/.zshrc

For compilers to find this software you may need to set:
    LDFLAGS:  -L/usr/local/opt/opencv@2/lib
    CPPFLAGS: -I/usr/local/opt/opencv@2/include
For pkg-config to find this software you may need to set:
    PKG_CONFIG_PATH: /usr/local/opt/opencv@2/lib/pkgconfig

The line to note here is that I need to add the export PATH="/usr/local/opts/opencv@2/bin:$PATH" to my default shell (e.g. zsh in this case).

After this is done, then things are working properly when I use the pre-build version of the jars.

I suspect that if I have to build from source then the following flags may be required LDFLAGS, CPPFLAGS and PKG_CONFIG_PATH.

With this in place I was able to run the example tutorials properly using my non-gpu machine.

gigasquid commented 6 years ago

Thanks for helping to document these steps.

A note that for the latest version of the Scala jars, (that I just committed to master), the old version of opencv has be fixed on the Scala versions. So you will need to do a brew upgrade to 3.4 on your mac to use.

To clarify: [org.apache.mxnet/mxnet-full_2.11-osx-x86_64-cpu "1.2.1"] you should be able to do brew install opencv

for [org.apache.mxnet/mxnet-full_2.11-osx-x86_64-cpu "1.2.0"] - you will have to do brew install opencv@2 using the steps above