ngnrsaa / qflex

Flexible Quantum Circuit Simulator (qFlex) implements an efficient tensor network, CPU-based simulator of large quantum circuits.
Apache License 2.0
97 stars 24 forks source link

Disable Python in case of missing packages instead of error. #202

Closed s-mandra closed 4 years ago

s-mandra commented 4 years ago

Should fix #197.

s-mandra commented 4 years ago

Were you able to run this locally with an outdated/unavailable Python version? I tried making this change to my Dockerfile:

-RUN apk add g++ make gsl-dev git autoconf automake python3-dev py3-pybind11 py3-packaging py3-pytest py3-docopt
+RUN apk add g++ make gsl-dev git autoconf automake

and running docker-compose build qflex, and got this error:

make -C src/ pybind
make[1]: Entering directory '/qflex/src'
g++ pybind_main.cpp -o ../python//qflex`python3-config --extension-suffix` ordering.o grid.o circuit.o evaluate_circuit.o tensor.o contraction_utils.o read_circuit.o docopt/docopt.o pybind_main.h -O3  -std=c++17  -march=native -lgslcblas -lpthread -Wno-unknown-pragmas -Idocopt/ -fPIC -shared `python3 -m pybind11 --includes`
/bin/sh: python3-config: not found
/bin/sh: python3: not found
In file included from pybind_main.cpp:1:
pybind_main.h:4:10: fatal error: pybind11/complex.h: No such file or directory
 #include <pybind11/complex.h>
          ^~~~~~~~~~~~~~~~~~~~
compilation terminated.

The reason is because in Dockerfile line 14 I'm disabling all python checks to speedup the creation of the container :)

# Install dependences
RUN autoreconf -i && autoconf && ./configure --disable-python_checks

That's the reason why it fails. If you remove --disable-python_checks, it will disable python.

s-mandra commented 4 years ago

Were you able to run this locally with an outdated/unavailable Python version? I tried making this change to my Dockerfile:

-RUN apk add g++ make gsl-dev git autoconf automake python3-dev py3-pybind11 py3-packaging py3-pytest py3-docopt
+RUN apk add g++ make gsl-dev git autoconf automake

and running docker-compose build qflex, and got this error:

make -C src/ pybind
make[1]: Entering directory '/qflex/src'
g++ pybind_main.cpp -o ../python//qflex`python3-config --extension-suffix` ordering.o grid.o circuit.o evaluate_circuit.o tensor.o contraction_utils.o read_circuit.o docopt/docopt.o pybind_main.h -O3  -std=c++17  -march=native -lgslcblas -lpthread -Wno-unknown-pragmas -Idocopt/ -fPIC -shared `python3 -m pybind11 --includes`
/bin/sh: python3-config: not found
/bin/sh: python3: not found
In file included from pybind_main.cpp:1:
pybind_main.h:4:10: fatal error: pybind11/complex.h: No such file or directory
 #include <pybind11/complex.h>
          ^~~~~~~~~~~~~~~~~~~~
compilation terminated.

The reason is because in Dockerfile line 14 I'm disabling all python checks to speedup the creation of the container :)

# Install dependences
RUN autoreconf -i && autoconf && ./configure --disable-python_checks

That's the reason why it fails. If you remove --disable-python_checks, it will disable python.

Tested and it should work now.