Opened 7 years ago

Closed 7 years ago

#55541 closed request (wontfix)

Installing a Python wheel (whl) file using a port

Reported by: emcrisostomo (Enrico Maria Crisostomo) Owned by:
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc:
Port: py-tensorflow-tensorboard

Description

Hi,

I'm trying to create a port for TensorFlow and since I'm no Python expert I have some doubts about it.

Here is TensorFlow's package on the Python Package Index: https://pypi.python.org/pypi/tensorflow/1.4.1. I realised (late) that this package is a wheel package and is meant to be installed with pip or wheel. Even the instruction to install TensorFlow from source (https://www.tensorflow.org/install/install_sources) describe the process of building a whl package and then install it with pip, so when I realised I thought it wouldn't be a problem.

In the port, I tried to run python -m wheel install archive.whl but I didn't succeed in doing it either in the build or in the destroot phases. Given the kind of error I think I'm forgetting something obvious. This is the port file:

PortSystem          1.0
PortGroup           python 1.0

name                py-tensorflow-tensorboard
version             0.4.0rc3
platforms           darwin
license             Apache-2
maintainers         @emcrisostomo openmaintainer

description         TensorFlow helps the tensors flow
long_description    TensorBoard is a suite of web applications for inspecting \
                    and understanding your TensorFlow runs and graphs.

homepage            https://github.com/tensorflow/tensorboard
master_sites        https://pypi.python.org/packages/d5/fb/80df4eb3234c41beeeb3122b1966effbf08608fb80d2fa74bb72f8da9cb3

if {${python.version} < 30} {
    distname            tensorflow_tensorboard-${version}-py2-none-any
} else {
    distname            tensorflow_tensorboard-${version}-py3-none-any
}

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

checksums           rmd160  52c4d0d3bf8856e2ebc87ae9785319e4416ccdce \
                    sha256  2b8741aed01f35c95b781d25ebf1a84a45c2980746a616a36ade7ed8078d88ee

python.versions     27 34 35 36

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

    depends_build-append \
        port:py${python.version}-wheel

    # Futures should be only included if python is < 27
    depends_lib-append \
        port:py${python.version}-wheel \
        port:py${python.version}-bleach \
        port:py${python.version}-markdown \
        port:py${python.version}-html5lib \
        port:py${python.version}-werkzeug \
        port:py${python.version}-protobuf3 \
        port:py${python.version}-six \
        port:py${python.version}-numpy

    if {${python.version} eq 27} {
        depends_lib-append \
            port:py${python.version}-futures \
    }

    build {
    }

    destroot.cmd        python${python.branch}
    destroot.pre_args
    destroot.args       -m wheel install ${worksrcpath}/${distname}${extract.suffix}
    destroot.post_args

    livecheck.type      none
}

The error I'm getting is

:debug:destroot system:  cd "/opt/local/var/macports/build/_Users_enricomariacrisostomo_ports_python_py-tensorflow-tensorboard/py27-tensorflow-tensorboard/work/tensorflow_tensorboard-0.4.0rc3-py2-none-any" && python2.7 -m wheel install /opt/local/var/macports/build/_Users_enricomariacrisostomo_ports_python_py-tensorflow-tensorboard/py27-tensorflow-tensorboard/work/tensorflow_tensorboard-0.4.0rc3-py2-none-any/tensorflow_tensorboard-0.4.0rc3-py2-none-any.whl
:info:destroot Traceback (most recent call last):
:info:destroot   File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 174, in _run_module_as_main
:info:destroot     "__main__", fname, loader, pkg_name)
:info:destroot   File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 72, in _run_code
:info:destroot     exec code in run_globals
:info:destroot   File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/wheel/__main__.py", line 19, in <module>
:info:destroot     sys.exit(main())
:info:destroot   File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/wheel/__main__.py", line 15, in main
:info:destroot     sys.exit(wheel.tool.main())
:info:destroot   File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/wheel/tool/__init__.py", line 372, in main
:info:destroot     args.func(args)
:info:destroot   File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/wheel/tool/__init__.py", line 314, in install_f
:info:destroot     args.wheel_dirs, args.force, args.list_files)
:info:destroot   File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/wheel/tool/__init__.py", line 233, in install
:info:destroot     wf.install(force=force)
:info:destroot   File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/wheel/install.py", line 346, in install
:info:destroot     os.makedirs(ddir)
:info:destroot   File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 157, in makedirs
:info:destroot     mkdir(name, mode)
:info:destroot OSError: [Errno 1] Operation not permitted: '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/tensorboard'

Besides the main error, I certainly have other things where I'd really appreciate some feedback:

  • Using that master_site was the only way I got it working. Is there a better way? I tried some acrobatics with the pypi to no avail.
  • Downloading a binary package and skip extraction and build is already asked in another issue: https://github.com/macports/macports-base/pull/49
  • Is using python${python.branch} the correct way to refer to the currently installed python binary? Is there a better idiom to do the same things?

Thanks.

Change History (6)

comment:1 Changed 7 years ago by emcrisostomo (Enrico Maria Crisostomo)

Writing the ticket was like talking to the duck. It's correct that I can't write in that directory because we're still staging the files in ${destroot}. I tried using pip --target ${destroot} but it then complains that:

:info:destroot The directory '/opt/local/var/macports/build/_Users_enricomariacrisostomo_ports_python_py-tensorflow-tensorboard/py27-tensorflow-tensorboard/work/.home/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.

and frankly running pip from a port sounds wrong to me.

Last edited 7 years ago by emcrisostomo (Enrico Maria Crisostomo) (previous) (diff)

comment:2 Changed 7 years ago by mf2k (Frank Schima)

Keywords: python removed
Port: py-tensorflow-tensorboard added

comment:3 Changed 7 years ago by mf2k (Frank Schima)

Trac is not for tech support. Follow-up on the Macports Developers mailing list instead.

comment:4 Changed 7 years ago by emcrisostomo (Enrico Maria Crisostomo)

Thanks Frank.

comment:5 Changed 7 years ago by emcrisostomo (Enrico Maria Crisostomo)

Sent a message to the developer's mailing list, we can close this ticket.

comment:6 Changed 7 years ago by mf2k (Frank Schima)

Resolution: wontfix
Status: newclosed
Note: See TracTickets for help on using tickets.