XanaduAI / thewalrus

A library for the calculation of hafnians, Hermite polynomials and Gaussian boson sampling.
https://the-walrus.readthedocs.io
Apache License 2.0
100 stars 56 forks source link

[openSUSE Linux] E ModuleNotFoundError: No module named 'thewalrus' #184

Closed kevinsmia1939 closed 4 years ago

kevinsmia1939 commented 4 years ago

Hello, I am trying to package thewalrus into linux openSUSE Tumbleweed.

I write spec file that contain compile instruction for the source code. Which can be found here: https://build.opensuse.org/package/show/home:andythe_great/python-thewalrus With full error log here: https://build.opensuse.org/package/live_build_log/home:andythe_great/python-thewalrus/openSUSE_Tumbleweed/x86_64

The dependencies installed are as follows.

Python 3.8.4
gcc-c++ 10-1
python3-Cython-0.29
python3-dask-2.21
python3-numba-0.49
python3-numpy-1.18.4
python3-pytest-5.4.3
python3-scipy-1.4.1
eigen3 3.3.7
lapacke-devel 3.8.0

I encounter an issue during testing using pytest. I'm uncertain why the error occured. Thanks

[  276s] + pytest
[  277s] ============================= test session starts ==============================
[  277s] platform linux -- Python 3.8.4, pytest-5.4.3, py-1.9.0, pluggy-0.13.1
[  277s] rootdir: /home/abuild/rpmbuild/BUILD/thewalrus-0.12.0
[  278s] collected 0 items / 13 errors
[  278s] 
[  278s] ==================================== ERRORS ====================================
[  278s] ___________ ERROR collecting thewalrus/tests/test_fock_gradients.py ____________
[  278s] ImportError while importing test module '/home/abuild/rpmbuild/BUILD/thewalrus-0.12.0/thewalrus/tests/test_fock_gradients.py'.
[  278s] Hint: make sure your test modules/packages have valid Python names.
[  278s] Traceback:
[  278s] thewalrus/tests/test_fock_gradients.py:16: in <module>
[  278s]     from thewalrus.fock_gradients import (
[  278s] E   ModuleNotFoundError: No module named 'thewalrus'
[  278s] _______________ ERROR collecting thewalrus/tests/test_hafnian.py _______________
[  278s] ImportError while importing test module '/home/abuild/rpmbuild/BUILD/thewalrus-0.12.0/thewalrus/tests/test_hafnian.py'.
[  278s] Hint: make sure your test modules/packages have valid Python names.
[  278s] Traceback:
[  278s] thewalrus/tests/test_hafnian.py:21: in <module>
[  278s]     import thewalrus as hf
[  278s] E   ModuleNotFoundError: No module named 'thewalrus'
[  278s] ___________ ERROR collecting thewalrus/tests/test_hafnian_approx.py ____________
[  278s] ImportError while importing test module '/home/abuild/rpmbuild/BUILD/thewalrus-0.12.0/thewalrus/tests/test_hafnian_approx.py'.
[  278s] Hint: make sure your test modules/packages have valid Python names.
[  278s] Traceback:
[  278s] thewalrus/tests/test_hafnian_approx.py:21: in <module>
[  278s]     from thewalrus import hafnian, haf_real
[  278s] E   ModuleNotFoundError: No module named 'thewalrus'
[  278s] __________ ERROR collecting thewalrus/tests/test_hafnian_repeated.py ___________
[  278s] ImportError while importing test module '/home/abuild/rpmbuild/BUILD/thewalrus-0.12.0/thewalrus/tests/test_hafnian_repeated.py'.
[  278s] Hint: make sure your test modules/packages have valid Python names.
[  278s] Traceback:
[  278s] thewalrus/tests/test_hafnian_repeated.py:21: in <module>
[  278s]     from thewalrus import hafnian_repeated
[  278s] E   ModuleNotFoundError: No module named 'thewalrus'
[  278s] ______ ERROR collecting thewalrus/tests/test_hermite_multidimensional.py _______
[  278s] ImportError while importing test module '/home/abuild/rpmbuild/BUILD/thewalrus-0.12.0/thewalrus/tests/test_hermite_multidimensional.py'.
[  278s] Hint: make sure your test modules/packages have valid Python names.
[  278s] Traceback:
[  278s] thewalrus/tests/test_hermite_multidimensional.py:22: in <module>
[  278s]     from thewalrus import hermite_multidimensional, hafnian_batched, hafnian_repeated
[  278s] E   ModuleNotFoundError: No module named 'thewalrus'
[  278s] _____________ ERROR collecting thewalrus/tests/test_integration.py _____________
[  278s] ImportError while importing test module '/home/abuild/rpmbuild/BUILD/thewalrus-0.12.0/thewalrus/tests/test_integration.py'.
[  278s] Hint: make sure your test modules/packages have valid Python names.
[  278s] Traceback:
[  278s] thewalrus/tests/test_integration.py:20: in <module>
[  278s]     from thewalrus.quantum import density_matrix, state_vector, probabilities, update_probabilities_with_loss
[  278s] E   ModuleNotFoundError: No module named 'thewalrus'
[  278s] ______________ ERROR collecting thewalrus/tests/test_permanent.py ______________
[  278s] ImportError while importing test module '/home/abuild/rpmbuild/BUILD/thewalrus-0.12.0/thewalrus/tests/test_permanent.py'.
[  278s] Hint: make sure your test modules/packages have valid Python names.
[  278s] Traceback:
[  278s] thewalrus/tests/test_permanent.py:21: in <module>
[  278s]     from thewalrus import perm, perm_real, perm_complex, permanent_repeated
[  278s] E   ModuleNotFoundError: No module named 'thewalrus'
[  278s] _______________ ERROR collecting thewalrus/tests/test_quantum.py _______________
[  278s] ImportError while importing test module '/home/abuild/rpmbuild/BUILD/thewalrus-0.12.0/thewalrus/tests/test_quantum.py'.
[  278s] Hint: make sure your test modules/packages have valid Python names.
[  278s] Traceback:
[  278s] thewalrus/tests/test_quantum.py:24: in <module>
[  278s]     from thewalrus.symplectic import rotation, squeezing, interferometer, two_mode_squeezing, beam_splitter, loss
[  278s] E   ModuleNotFoundError: No module named 'thewalrus'
[  278s] ______________ ERROR collecting thewalrus/tests/test_reference.py ______________
[  278s] ImportError while importing test module '/home/abuild/rpmbuild/BUILD/thewalrus-0.12.0/thewalrus/tests/test_reference.py'.
[  278s] Hint: make sure your test modules/packages have valid Python names.
[  278s] Traceback:
[  278s] thewalrus/tests/test_reference.py:21: in <module>
[  278s]     from thewalrus.reference import T, spm, pmp, hafnian
[  278s] E   ModuleNotFoundError: No module named 'thewalrus'
[  278s] _______________ ERROR collecting thewalrus/tests/test_samples.py _______________
[  278s] ImportError while importing test module '/home/abuild/rpmbuild/BUILD/thewalrus-0.12.0/thewalrus/tests/test_samples.py'.
[  278s] Hint: make sure your test modules/packages have valid Python names.
[  278s] Traceback:
[  278s] thewalrus/tests/test_samples.py:21: in <module>
[  278s]     from thewalrus.samples import (
[  278s] E   ModuleNotFoundError: No module named 'thewalrus'
[  278s] __________ ERROR collecting thewalrus/tests/test_samples_classical.py __________
[  278s] ImportError while importing test module '/home/abuild/rpmbuild/BUILD/thewalrus-0.12.0/thewalrus/tests/test_samples_classical.py'.
[  278s] Hint: make sure your test modules/packages have valid Python names.
[  278s] Traceback:
[  278s] thewalrus/tests/test_samples_classical.py:20: in <module>
[  278s]     from thewalrus.csamples import rescale_adjacency_matrix_thermal, generate_thermal_samples
[  278s] E   ModuleNotFoundError: No module named 'thewalrus'
[  278s] _____________ ERROR collecting thewalrus/tests/test_symplectic.py ______________
[  278s] ImportError while importing test module '/home/abuild/rpmbuild/BUILD/thewalrus-0.12.0/thewalrus/tests/test_symplectic.py'.
[  278s] Hint: make sure your test modules/packages have valid Python names.
[  278s] Traceback:
[  278s] thewalrus/tests/test_symplectic.py:21: in <module>
[  278s]     from thewalrus import symplectic
[  278s] E   ModuleNotFoundError: No module named 'thewalrus'
[  278s] _____________ ERROR collecting thewalrus/tests/test_torontonian.py _____________
[  278s] ImportError while importing test module '/home/abuild/rpmbuild/BUILD/thewalrus-0.12.0/thewalrus/tests/test_torontonian.py'.
[  278s] Hint: make sure your test modules/packages have valid Python names.
[  278s] Traceback:
[  278s] thewalrus/tests/test_torontonian.py:20: in <module>
[  278s]     from thewalrus import tor
[  278s] E   ModuleNotFoundError: No module named 'thewalrus'
[  278s] =========================== short test summary info ============================
[  278s] ERROR thewalrus/tests/test_fock_gradients.py
[  278s] ERROR thewalrus/tests/test_hafnian.py
[  278s] ERROR thewalrus/tests/test_hafnian_approx.py
[  278s] ERROR thewalrus/tests/test_hafnian_repeated.py
[  278s] ERROR thewalrus/tests/test_hermite_multidimensional.py
[  278s] ERROR thewalrus/tests/test_integration.py
[  278s] ERROR thewalrus/tests/test_permanent.py
[  278s] ERROR thewalrus/tests/test_quantum.py
[  278s] ERROR thewalrus/tests/test_reference.py
[  278s] ERROR thewalrus/tests/test_samples.py
[  278s] ERROR thewalrus/tests/test_samples_classical.py
[  278s] ERROR thewalrus/tests/test_symplectic.py
[  278s] ERROR thewalrus/tests/test_torontonian.py
[  278s] !!!!!!!!!!!!!!!!!!! Interrupted: 13 errors during collection !!!!!!!!!!!!!!!!!!!
[  278s] ============================== 13 errors in 1.81s ==============================
[  279s] error: Bad exit status from /var/tmp/rpm-tmp.xH9I3J (%check)

My guess is that

josh146 commented 4 years ago

Hi @kevinsmia1939!

Can I ask what version of The Walrus, and what version of the tests you are using? It looks like there might be a mismatch between the two versions.

kevinsmia1939 commented 4 years ago

Hi @kevinsmia1939!

Can I ask what version of The Walrus, and what version of the tests you are using? It looks like there might be a mismatch between the two versions.

Hello,

thewalrus version is 0.12.0 By "version of the test" did you have external testing data or tool? The test that was done simply use pytest 5.4.3 and the test data in the source code given in the .tar.gz file in github.

josh146 commented 4 years ago

Thanks @kevinsmia1939! And where are you accessing the test directory from? It would be useful if you could post the command you are using to invoke pytest as well 🙂

kevinsmia1939 commented 4 years ago

Thanks @kevinsmia1939! And where are you accessing the test directory from? It would be useful if you could post the command you are using to invoke pytest as well slightly_smiling_face

From discussing with other packager, it seems like pytest would not work during package building. So I switch to gtest and it work now, thanks.