Ah ok, I saw this. If I understand it correctly it's a subset of it. I've
also tried to build it from source but I'm not sure at all I would solve
the primary issue: according to the official documentation, the output of
the build is the whl file:

https://www.tensorflow.org/install/install_sources

So, even if we update the port to build from source, we end up exactly with
the same issue: how to install the whl file.

Or perhaps my Python-foo is so weak I'm not seeing something obvious.

Thanks.

On 18 December 2017 at 23:10:01, Cunningham Ken (
ken.cunningham.web...@gmail.com) wrote:

https://github.com/Homebrew/homebrew-core/blob/master/Formula/libtensorflow.rb



On 2017-12-18, at 2:09 PM, Enrico Maria Crisostomo wrote:

Thanks Ken.

Actually I checked brew and they haven't got a formula for TensorFlow (at
least at the moment).

On 18 December 2017 at 22:57:42, Cunningham Ken (
ken.cunningham.web...@gmail.com) wrote:

FYI, I recall homebrew has tensorflow, so you might get some hints looking
at their formula.

Marius was taking this on a few months ago as well, so might have some
thoughts.

Ken


On 2017-12-18, at 1:52 PM, Enrico Maria Crisostomo wrote:

Hi,

I’m trying to create a port for TensorFlow and I have already accumulated
quite a number of doubts in just a couple of hours I've been working on it.

First of all, I realised (late) that TensorFlow (and some of its
dependencies) is built as a wheel package (a .whl file), and as such it
gets uploaded to the Python Package Index: ​
https://pypi.python.org/pypi/tensorflow/1.4.1.  whl files are meant to be
installed with pip, so my current port file does the following:

  if {${name} ne ${subport}} {

    build {
    }

    destroot.cmd        pip-${python.branch}
    destroot.pre_args
    destroot.args       \
        install \
        --no-cache-dir \
        --no-dependencies \
        --target ${destroot}${python.pkgd} \
        ${worksrcpath}/${distname}${extract.suffix}
    destroot.post_args

    livecheck.type      none
  }

You can see the PR here:
https://github.com/macports/macports-ports/pull/1131

The port apparently work, but I'd like to submit this port for review for
the following reasons:

  * I'm not sure we should install a whl file this way, invoking `pip`.

  * I had to redefine `master_sites` and `checksums` for each version of
Phyton.

  * I had to redefine the `extract` properties to skip extraction and just
copy the downloaded file into `${worksrcpath}`:

      extract.suffix      .whl
      extract.cmd         cp
      extract.pre_args
      extract.post_args   ${worksrcpath}
      extract.mkdir       yes

  * Is there a better idiom to refer to the currently-installed `pip`?

      destroot.cmd        pip-${python.branch}

  * Is there a better idiom to refer to the Python site packages directory
in the staging area?

      ${destroot}${python.pkgd}

Finally, I'm wondering whether this is a good idea at all.  I've grep-ed
the ports and I saw no other whl file installed this way.

If you can have a look at the PR I will appreciate any feedback and insight.

Cheers,
-- 
Enrico

Reply via email to