Installing a Python wheel (whl) file using a port - Tensorflow

Ken Cunningham ken.cunningham.webuse at gmail.com
Mon Dec 18 22:09:58 UTC 2017


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.webuse at 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
>> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macports.org/pipermail/macports-dev/attachments/20171218/d48eebe7/attachment-0001.html>


More information about the macports-dev mailing list