Closed chmwzc closed 1 month ago
Yes, that's correct: the GlobalBackend.__new__
is looking for an ImportError
(ModuleNotFoundError
is a subclass, so it's even redundant), while construct_backend
is turning it in a ValueError
.
I'd propose to change it back to a generic ImportError
. In this way it will be caught by GlobalBackend.__new__
, and keep looking for another backend.
I can also attempt to design a (tricky) test for the CI to reproduce it (I have to somehow hijack the import mechanism, because qibojit
will always be installed there).
I'd propose to change it back to a generic
ImportError
. In this way it will be caught byGlobalBackend.__new__
, and keep looking for another backend.
Yeah, this is good enough, I don't see the point in hacking around too much for a small bug like this :)
To Reproduce Install only qibo in a new virtual environment, then run
Error message:
From what I can see, I think the problem is here
https://github.com/qiboteam/qibo/blob/8fb9af92c8ee4049d6575571ab33edd756196f2d/src/qibo/backends/__init__.py#L88C1-L93C25
and here:
https://github.com/qiboteam/qibo/blob/8fb9af92c8ee4049d6575571ab33edd756196f2d/src/qibo/backends/__init__.py#L223C1-L236C1
The
raise_error(ValueError, ...)
is killing the try/except part in the for loop looking for available backends