Code Monkey home page Code Monkey logo

Comments (5)

schani avatar schani commented on August 19, 2024 3

This, together with #6, made the build succeed, but after installing the wheel file, it seems like it can't find the native library:

[17:41]: python
Python 2.7.13 |Continuum Analytics, Inc.| (default, Dec 20 2016, 23:09:15)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
>>> import sonnet as snt
>>> import tensorflow as tf
>>> snt.resampler(tf.constant([0.]), tf.constant([0.]))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/ubuntu/anaconda3/envs/p27-tf1/lib/python2.7/site-packages/sonnet/python/ops/resampler.py", line 62, in resampler
    raise ImportError("_gen_resampler could not be imported.")
ImportError: _gen_resampler could not be imported.

The wheel file also doesn't contain a native library:

[17:44]: unzip -l ./sonnet-install/sonnet-1.0-py2-none-any.whl  | less
Archive:  ./sonnet-install/sonnet-1.0-py2-none-any.whl
  Length      Date    Time    Name
---------  ---------- -----   ----
     4817  2017-04-13 17:41   sonnet/__init__.py
     8064  2017-04-13 17:41   sonnet/examples/dataset_shakespeare.py
      809  2017-04-13 17:41   sonnet/examples/__init__.py
    11702  2017-04-13 17:41   sonnet/examples/rnn_shakespeare.py
     3751  2017-04-13 17:41   sonnet/examples/module_with_build_args.py
   892315  2017-04-13 17:41   sonnet/examples/data/ts.train.txt
   111539  2017-04-13 17:41   sonnet/examples/data/ts.valid.txt
   111540  2017-04-13 17:41   sonnet/examples/data/ts.test.txt
      844  2017-04-13 17:41   sonnet/python/__init__.py
     5452  2017-04-13 17:41   sonnet/python/modules/experimental.py
    15044  2017-04-13 17:41   sonnet/python/modules/base.py
     7712  2017-04-13 17:41   sonnet/python/modules/pondering_rnn.py
    13392  2017-04-13 17:41   sonnet/python/modules/rnn_core.py
    20102  2017-04-13 17:41   sonnet/python/modules/batch_norm.py
     7109  2017-04-13 17:41   sonnet/python/modules/embed.py
    12396  2017-04-13 17:41   sonnet/python/modules/util.py
      829  2017-04-13 17:41   sonnet/python/modules/__init__.py
     7812  2017-04-13 17:41   sonnet/python/modules/block_matrix.py
     7402  2017-04-13 17:41   sonnet/python/modules/attention.py
     2053  2017-04-13 17:41   sonnet/python/modules/clip_gradient.py
   105355  2017-04-13 17:41   sonnet/python/modules/conv.py
     2044  2017-04-13 17:41   sonnet/python/modules/scale_gradient.py
    34392  2017-04-13 17:41   sonnet/python/modules/gated_rnn.py
    19266  2017-04-13 17:41   sonnet/python/modules/basic_rnn.py
    23212  2017-04-13 17:41   sonnet/python/modules/spatial_transformer.py
     3510  2017-04-13 17:41   sonnet/python/modules/sequential.py
    43211  2017-04-13 17:41   sonnet/python/modules/basic.py
    21282  2017-04-13 17:41   sonnet/python/modules/nets/convnet.py
    10619  2017-04-13 17:41   sonnet/python/modules/nets/alexnet.py
     1301  2017-04-13 17:41   sonnet/python/modules/nets/__init__.py
     8110  2017-04-13 17:41   sonnet/python/modules/nets/mlp.py
    13456  2017-04-13 17:41   sonnet/python/modules/nets/dilation.py
   264952  2017-04-13 17:41   sonnet/python/ops/_resampler.so
    10734  2017-04-13 17:41   sonnet/python/ops/nest.py
      833  2017-04-13 17:41   sonnet/python/ops/__init__.py
     3377  2017-04-13 17:41   sonnet/python/ops/initializers.py
     2860  2017-04-13 17:41   sonnet/python/ops/resampler.py
       10  2017-04-13 17:41   sonnet-1.0.dist-info/DESCRIPTION.rst
     1134  2017-04-13 17:41   sonnet-1.0.dist-info/metadata.json
        7  2017-04-13 17:41   sonnet-1.0.dist-info/top_level.txt
       92  2017-04-13 17:41   sonnet-1.0.dist-info/WHEEL
      888  2017-04-13 17:41   sonnet-1.0.dist-info/METADATA
     3867  2017-04-13 17:41   sonnet-1.0.dist-info/RECORD
---------                     -------
  1819196                     43 files

from sonnet.

ibab avatar ibab commented on August 19, 2024

It looks like bazel has a problem with sandboxing on your machine.
Can you tru re-running the command with

--genrule_strategy=standalone --spawn_strategy=standalone

added to the command line?

from sonnet.

fivejjs avatar fivejjs commented on August 19, 2024

I got the same error as @schani for both Python 2.7 and Python 3.6
There is a warning during compiling

please do not import '//sonnet/cc:ops/resampler.cc' directly. You should either move the file to this package or depend on an appropriate rule there. Since this rule was created by the macro 'tf_custom_op_library', the error might have been caused by the macro implementation in /home/??/sonnet/sonnet/tensorflow.bzl:108:25.

from sonnet.

yukoga avatar yukoga commented on August 19, 2024

While I got the same error as reported, resolved with moving out from build directory.

$ git clone https://github.com/deepmind/sonnet.git
$ cd sonnet/tensorflow
$ ./configure
$ cd ../
$ mkdir /tmp/sonnet
$ bazel build --config=opt :install
$ ./bazel-bin/install /tmp/sonnet
$ pip install /tmp/sonnet/*.whl
$ python

import sonnet as snt
import tensorflow as tf
snt.resampler(tf.constant([0.]), tf.constant([0.]))
Traceback (most recent call last):
File "", line 1, in
File "sonnet/python/ops/resampler.py", line 65, in resampler
raise ImportError("_gen_resampler could not be imported.")
ImportError: _gen_resampler could not be imported.

$ cd # out from sonnet source directory.
$ python

import sonnet as snt
import tensorflow as tf
snt.resampler(tf.constant([0.]), tf.constant([0.]))
<tf.Tensor 'resampler/Resampler:0' shape=(1,) dtype=float32>

from sonnet.

adria-p avatar adria-p commented on August 19, 2024

Duplicate of #25 . Also, as pointed out, please move out of the sonnet to import it, as you might be importing only the python dependencies (a fix for this use case is coming in the following days).

from sonnet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.