tensorcircuit icon indicating copy to clipboard operation
tensorcircuit copied to clipboard

Will be better if removing tensorflow prerequisite?

Open royess opened this issue 3 years ago • 5 comments

Since tensorcircuit does not rely on any specific backends, I wonder if it will be better to remove tensorflow from prerequisites, whose binaries are rather big (~500MB).

royess avatar Jul 14 '22 12:07 royess

A very good question. Apart from the slow downloading due to the large size, TensorFlow as a requirement has other issues, too. Say in m1 mac, the package name is tensorflow-macos, which can lead to installation failure of tensorcircuit silently.

However, there are several reasons that support the inclusion of tensorflow as a requirement,

  1. some function utilities are now supported solely by tensorflow backend, such as tc.quantum.heisenberg_hamiltonian.
  2. if there is no requirement of tensorflow, then no backend with automatic differentiation is enabled by default which may confuse the users especially for newcomers. Namely, one need to manually install many things to make tensorcircuit work as expected. (this point is the main reason that I keep tensorflow as a requirement because I don't want to scare new users away by failure after pip install tensorcircuit)

Still, to remove or not to remove tf as a requirement, is an question to me. Not sure which side is better, and would love to listen to more feedbacks.

refraction-ray avatar Jul 14 '22 13:07 refraction-ray

2. if there is no requirement of tensorflow, then no backend with automatic differentiation is enabled by default which may confuse the users especially for newcomers. Namely, one need to manually install many things to make tensorcircuit work as expected. (this point is the main reason that I keep tensorflow as a requirement because I don't want to scare new users away by failure after pip install tensorcircuit)

For the second point, how about changing the installation guide to the following lines?

pip install tensorflow
pip install tensorcircuit

I suppose it will not be less friendly for new users.

royess avatar Jul 15 '22 02:07 royess

  1. some function utilities are now supported solely by tensorflow backend, such as tc.quantum.heisenberg_hamiltonian.

And I am also curious about whether it would be convenient for us to re-implement those utilities by uniform API of tc.backend.

royess avatar Jul 15 '22 02:07 royess

For now, my preference is to try something like below in furture releases pip install tensorcircuit # only requires numpy pip install tensorcircuit[tensorflow] # also install tensorflow

refraction-ray avatar Jul 15 '22 07:07 refraction-ray

And I am also curious about whether it would be convenient for us to re-implement those utilities by uniform API of tc.backend.

It is more than welcome if anyone wants to make these utilities backend agnostic, which is a good first issue. These methods are in https://github.com/tencent-quantum-lab/tensorcircuit/blob/41f02549d9ee9d0c599488963394cd9e05b3e21f/tensorcircuit/quantum.py#L1108-L1388

refraction-ray avatar Jul 15 '22 08:07 refraction-ray

closed, as the remaining issue is separately open in https://github.com/tencent-quantum-lab/tensorcircuit/issues/161

refraction-ray avatar Jul 12 '23 05:07 refraction-ray