Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed building wheel for eclipse-zenoh #72

Closed
lottz opened this issue Aug 22, 2022 · 6 comments
Closed

Failed building wheel for eclipse-zenoh #72

lottz opened this issue Aug 22, 2022 · 6 comments
Labels
bug Something isn't working

Comments

@lottz
Copy link

lottz commented Aug 22, 2022

Describe the bug

Standard python example running on Raspberry PI
Code:

from zenoh import Zenoh
import random
import time

random.seed()

def read_temp():
    return random.randint(15, 30)

def run_sensor_loop(w):
    # read and produce a temperature every second
    while True:
        t = read_temp()
        w.put('/myfactory/machine1/temp',t)
        print (t)
        time.sleep(15)

if __name__ == "__main__":
    z = Zenoh({'peer': 'tcp/127.0.0.1:7447'})
    w = z.workspace('/')
    run_sensor_loop(w)

Error Message:

Traceback (most recent call last):
  File "zenoh_producer.py", line 27, in <module>
    run_sensor_loop(w)
  File "zenoh_producer.py", line 20, in run_sensor_loop
    w.put('/myfactory/machine1/temp',t)
  File "/usr/local/lib/python3.7/dist-packages/zenoh/workspace.py", line 50, in put
    self.rt.write_data(
AttributeError: 'dict' object has no attribute 'write_data'

Any hints what led to this error message?

To reproduce

  1. Start Zenoh Broker
  2. Execute provided code
  3. Works on Ubuntu 22.04 but led to the shown error on ARM / Raspberry Pi OS.

System info

No LSB modules are available.
Distributor ID: Raspbian
Description: Raspbian GNU/Linux 10 (buster)
Release: 10
Codename: buster
Operating System: Raspbian GNU/Linux 10 (buster)
Kernel: Linux 5.10.103-v7l+
Architecture: arm

  • Rust: rustc 1.63.0 (4b91a6ea7 2022-08-08)
  • Python 3.7.3
  • The zenoh router v0.5.0-beta.8-326-g70d7b22
@lottz lottz added the bug Something isn't working label Aug 22, 2022
@JEnoch
Copy link
Member

JEnoch commented Aug 22, 2022

It seems that you're Python environment is using an old version of Zenoh Python (probably 0.4.0 looking at the log wrt. workspace.py line 50).
You need to use a version that matches your zenoh router (v0.5.0-beta.8-326-g70d7b22 == v0.5.0-beta.9).

So, please, can you try to uninstall any previous version of zenoh and reinstall the version 0.5.0-b9:

pip uninstall eclipse-zenoh zenoh
pip install eclipse-zenoh==0.5.0b9

@lottz
Copy link
Author

lottz commented Aug 22, 2022

Uninstalling zenoh-0.4.0:
  Would remove:
    /usr/local/lib/python3.7/dist-packages/zenoh-0.4.0.dist-info/*
    /usr/local/lib/python3.7/dist-packages/zenoh/*
Proceed (y/n)? y
  Successfully uninstalled zenoh-0.4.0

When trying to install the 0.5 Version:

--extern event_listener=/tmp/pip-install-s0go_vz5/eclipse-zenoh/target/release/deps/libevent_listener-e772c0c8cfb99780.rmeta --cap-lints allow`
  error: attributes are not yet allowed on `if` expressions
     --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/async-lock-2.4.0/src/mutex.rs:165:13
      |
  165 |             #[cfg(not(target_arch = "wasm32"))]
      |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  
  error: aborting due to previous error
  
  error: could not compile `async-lock`.
  
  Caused by:
    process didn't exit successfully: `rustc --crate-name async_lock --edition=2018 /root/.cargo/registry/src/github.com-1ecc6299db9ec823/async-lock-2.4.0/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C metadata=9d1fd37a6929c054 -C extra-filename=-9d1fd37a6929c054 --out-dir /tmp/pip-install-s0go_vz5/eclipse-zenoh/target/release/deps -L dependency=/tmp/pip-install-s0go_vz5/eclipse-zenoh/target/release/deps --extern event_listener=/tmp/pip-install-s0go_vz5/eclipse-zenoh/target/release/deps/libevent_listener-e772c0c8cfb99780.rmeta --cap-lints allow` (exit code: 1)
  warning: build failed, waiting for other jobs to finish...
  error: build failed
  error: `cargo rustc --lib --message-format=json-render-diagnostics --manifest-path Cargo.toml --release -v --features pyo3/extension-module -- --crate-type cdylib` failed with code 101
  
  ----------------------------------------
  Failed building wheel for eclipse-zenoh
  Running setup.py clean for eclipse-zenoh
Failed to build eclipse-zenoh

This error occurs...

    warning: build failed, waiting for other jobs to finish...
    error[E0658]: use of unstable library feature 'matches_macro'
       --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/tracing-core-0.1.21/src/event.rs:104:9
        |
    104 |         matches!(self.parent, Parent::Root)
        |         ^^^^^^^
        |
        = note: for more information, see https://github.com/rust-lang/rust/issues/65721
    
    error[E0658]: use of unstable library feature 'matches_macro'
       --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/tracing-core-0.1.21/src/event.rs:115:9
        |
    115 |         matches!(self.parent, Parent::Current)
        |         ^^^^^^^
        |
        = note: for more information, see https://github.com/rust-lang/rust/issues/65721
    
    error[E0658]: use of unstable library feature 'matches_macro'
       --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/tracing-core-0.1.21/src/metadata.rs:383:9
        |
    383 |         matches!(self, Kind(KindInner::Span))
        |         ^^^^^^^
        |
        = note: for more information, see https://github.com/rust-lang/rust/issues/65721
    
    error[E0658]: use of unstable library feature 'matches_macro'
       --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/tracing-core-0.1.21/src/metadata.rs:388:9
        |
    388 |         matches!(self, Kind(KindInner::Event))
        |         ^^^^^^^
        |
        = note: for more information, see https://github.com/rust-lang/rust/issues/65721
    
    error[E0658]: use of unstable library feature 'matches_macro'
       --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/tracing-core-0.1.21/src/span.rs:154:9
        |
    154 |         matches!(self.parent, Parent::Root)
        |         ^^^^^^^
        |
        = note: for more information, see https://github.com/rust-lang/rust/issues/65721
    
    error[E0658]: use of unstable library feature 'matches_macro'
       --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/tracing-core-0.1.21/src/span.rs:165:9
        |
    165 |         matches!(self.parent, Parent::Current)
        |         ^^^^^^^
        |
        = note: for more information, see https://github.com/rust-lang/rust/issues/65721
    
    error[E0658]: use of unstable library feature 'matches_macro'
       --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/tracing-core-0.1.21/src/span.rs:280:10
        |
    280 |         !matches!(self.inner, CurrentInner::Unknown)
        |          ^^^^^^^
        |
        = note: for more information, see https://github.com/rust-lang/rust/issues/65721
    
    error[E0658]: use of unstable library feature 'matches_macro'
       --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/tracing-core-0.1.21/src/subscriber.rs:535:9
        |
    535 |         matches!(self.0, InterestKind::Never)
        |         ^^^^^^^
        |
        = note: for more information, see https://github.com/rust-lang/rust/issues/65721
    
    error[E0658]: use of unstable library feature 'matches_macro'
       --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/tracing-core-0.1.21/src/subscriber.rs:542:9
        |
    542 |         matches!(self.0, InterestKind::Sometimes)
        |         ^^^^^^^
        |
        = note: for more information, see https://github.com/rust-lang/rust/issues/65721
    
    error[E0658]: use of unstable library feature 'matches_macro'
       --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/tracing-core-0.1.21/src/subscriber.rs:549:9
        |
    549 |         matches!(self.0, InterestKind::Always)
        |         ^^^^^^^
        |
        = note: for more information, see https://github.com/rust-lang/rust/issues/65721
    
    error: aborting due to 10 previous errors

    For more information about this error, try `rustc --explain E0658`.
    error: could not compile `tracing-core`.
    
    Caused by:
      process didn't exit successfully: `rustc --crate-name tracing_core --edition=2018 /root/.cargo/registry/src/github.com-1ecc6299db9ec823/tracing-core-0.1.21/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 --cfg 'feature="lazy_static"' --cfg 'feature="std"' -C metadata=87b49e5adf300f4a -C extra-filename=-87b49e5adf300f4a --out-dir /tmp/pip-install-s0go_vz5/eclipse-zenoh/target/release/deps -L dependency=/tmp/pip-install-s0go_vz5/eclipse-zenoh/target/release/deps --extern lazy_static=/tmp/pip-install-s0go_vz5/eclipse-zenoh/target/release/deps/liblazy_static-0409578b23b8d4e0.rmeta --cap-lints allow` (exit code: 1)
    error: `cargo rustc --lib --message-format=json-render-diagnostics --manifest-path Cargo.toml --release -v --features pyo3/extension-module -- --crate-type cdylib` failed with code 101
    
    ----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-s0go_vz5/eclipse-zenoh/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-anvks5q8/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-s0go_vz5/eclipse-zenoh/

@JEnoch
Copy link
Member

JEnoch commented Aug 22, 2022

Now it seems that pip calls an old version of rustc.
The 2 messages refer to features that have been added to rustc a long time ago:

  • attributes are not yet allowed on 'if' expressions was solved with rust 1.43.0 (see "Language" section, 2nd bullet)
  • use of unstable library feature 'matches_macro' was stabilized with rust 1.42.0 (see "Stabilized APIs" section, `matches!")

Buster has a rustc package which is an old version (1.41.1).
If this package is installed on your Raspbian, you should probably remove it to make sure that pip will use the correct rustc version - i.e. the 1.63.0 you probably installed via rustup and which should be found in ~/.cargo/bin

@lottz
Copy link
Author

lottz commented Aug 23, 2022

Unfortunately setup tools does not seem to recognize the rustc toolchain (PATH is set)
Indeed rustup used for installation.

sudo pip3 install eclipse-zenoh==0.5.0b9
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting eclipse-zenoh==0.5.0b9
  Using cached https://files.pythonhosted.org/packages/ca/d7/1625f0d45ddb37f31bf9f9dc9de5a92ce1fa9458d1c13076ca6326b544d2/eclipse-zenoh-0.5.0b9.tar.gz
  Installing build dependencies ... done
Building wheels for collected packages: eclipse-zenoh
  Running setup.py bdist_wheel for eclipse-zenoh ... error
  Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-538i0qpz/eclipse-zenoh/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-_o7e_gs_ --python-tag cp37:
  running bdist_wheel
  running build
  running build_ext
  running build_rust
  error: can't find Rust compiler
  
  If you are using an outdated pip version, it is possible a prebuilt wheel is available for this package but pip is not able to install from it. Installing from the wheel would avoid the need for a Rust compiler.  
  If you did intend to build this package from source, try installing a Rust compiler from your system package manager and ensure it is on the PATH during installation. Alternatively, rustup (available at https://rustup.rs) is the recommended way to download and update the Rust compiler toolchain.  
  ----------------------------------------
  Failed building wheel for eclipse-zenoh
  Running setup.py clean for eclipse-zenoh
  Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-538i0qpz/eclipse-zenoh/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" clean --all:
  running clean
  'build/lib.linux-armv7l-cpython-37' does not exist -- can't clean it
  'build/bdist.linux-armv7l' does not exist -- can't clean it
  'build/scripts-3.7' does not exist -- can't clean it
  running clean_rust
  error: can't find Rust compiler
  
  If you are using an outdated pip version, it is possible a prebuilt wheel is available for this package but pip is not able to install from it. Installing from the wheel would avoid the need for a Rust compiler.  
  To update pip, run:  
      pip install --upgrade pip  
  and then retry package installation.
  
  If you did intend to build this package from source, try installing a Rust compiler from your system package manager and ensure it is on the PATH during installation. Alternatively, rustup (available at https://rustup.rs) is the recommended way to download and update the Rust compiler toolchain.
    ----------------------------------------
  Failed cleaning build dir for eclipse-zenoh
Failed to build eclipse-zenoh
Installing collected packages: eclipse-zenoh
  Running setup.py install for eclipse-zenoh ... error
    Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-538i0qpz/eclipse-zenoh/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-yen6ckbs/install-record.txt --single-version-externally-managed --compile:
    running install
    /tmp/pip-build-env-hnpovx5_/lib/python3.7/site-packages/setuptools/command/install.py:37: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
      setuptools.SetuptoolsDeprecationWarning,
    running build
    running build_ext
    running build_rust
    error: can't find Rust compiler
    
    If you are using an outdated pip version, it is possible a prebuilt wheel is available for this package but pip is not able to install from it. Installing from the wheel would avoid the need for a Rust compiler.
  
    If you did intend to build this package from source, try installing a Rust compiler from your system package manager and ensure it is on the PATH during installation. Alternatively, rustup (available at https://rustup.rs) is the recommended way to download and update the Rust compiler toolchain.
    
    ----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-538i0qpz/eclipse-zenoh/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-yen6ckbs/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-538i0qpz/eclipse-zenoh/

Where does the build configuration need to be adjusted?

@lottz lottz changed the title [Bug] AttributeError: 'dict' object has no attribute 'write_data' Failed building wheel for eclipse-zenoh Aug 23, 2022
@JEnoch
Copy link
Member

JEnoch commented Aug 23, 2022

What is your version of pip? 19.3.1 minimum is required to build the from source distribution package.

Note that while for 0.5.0b9 release we didn't manage to pre-build wheels for ARMs platforms, they will be available for the 0.6.0 release to come soon.

@lottz
Copy link
Author

lottz commented Aug 23, 2022

pip 22.2.2 from /home/pi/.local/lib/python3.7/site-packages/pip (python 3.7)
Ok then i ll just wait for the 0.6.0 release :-)

@lottz lottz closed this as completed Aug 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants