zxcalc/quizx

Error installing pybindings

Closed this issue · 5 comments

When I try to install Quizx with its Python bindings, I get the following error:

error[E0308]: mismatched types
   --> src/lib.rs:231:36
    |
231 |     fn max_terms(&self) -> usize { self.d.max_terms() }
    |                            -----   ^^^^^^^^^^^^^^^^^^ expected `usize`, found `f64`
    |                            |
    |                            expected `usize` because of return type

Here is an exact description of what I tried, in a reproducible Dockerfile:

FROM rust:alpine3.16

#################
# PREREQUISITES #
#################

RUN apk update && \
    apk add \
        git \
        build-base \
        python3 \
        py3-pip

RUN pip3 install setuptools-rust

#################
# INSTALL QUIZX #
#################

RUN git clone https://github.com/Quantomatic/quizx.git /quizx

RUN cd /quizx/quizx && \
    cargo build && \
    cargo test

###########################
# INSTALL PYTHON BINDINGS #
###########################

RUN cd /quizx/pybindings && \
    python3 setup.py install

RUN cd /quizx/pybindings && \
    python3 setup2.py install

The error occurs for the last line.

Any updates on this issue? If not, I will try to work with the rust code directly.

This should be fixed by #8 (you can clone my branch if you want to use it before then) - it was just a case of the Python bindings not being kept up to date with the Rust library. However, in general the Python bindings aren't as feature-complete as the rust code - I would recommend working with the Rust library directly, or using PyZX if you prefer Python and don't need the speed (or the stabilizer decompositions).

Thanks, I can confirm that your branch fixes the installation issue, at least.

It's now merged into main. Thanks Tuomas!