tensorflow / quantum

Hybrid Quantum-Classical Machine Learning in TensorFlow
https://www.tensorflow.org/quantum
Apache License 2.0
1.77k stars 558 forks source link

That sounds like the issues I linked. Colabs default Python version isn’t supported. #782

Open anikde opened 1 year ago

anikde commented 1 year ago
          That sounds like the issues I linked. Colabs default Python version isn’t supported.

Originally posted by @lockwo in https://github.com/tensorflow/quantum/issues/768#issuecomment-1535598819

anikde commented 1 year ago

It's true, the default version of python isn't supported. I came to an understanding that tensorflow_quantum works is compatible with python 3.8. So I installed python3.8 in google colab with help of an issue in tensorflow repo.

But then while importing tensorflow_quantum it shows ModuleNotFoundError: No module named 'tensorflow_quantum' For reference I have mentioned link to my colab notebook

lockwo commented 1 year ago

Yea, I've had a bunch of issues with colab now that they changed the version. In the linked notebook, I keep getting an error in that notebook that the runtime crashed, but that's not surprising, I usually encounter issues when hacking with colabs default versions. I have entirely stopped using colab + TFQ since the change in default python version.

Since TFQ has no problem installing on a fresh local environment with 3.8.10 it doesn't seem like there's any errors in TFQ, I would assume something else is at play in colab, which I don't know enough about to comment on.

lockwo commented 1 year ago

I actually had no problems with this colab: https://github.com/tensorflow/tensorflow/issues/60428#issuecomment-1527270841 from the TF issue you linked. Seemed to do the trick. image

anikde commented 1 year ago

That's really odd. I really can't think of any reason why am I getting that error, we both are running the same notebook. Screenshot from 2023-06-16 11-35-24

kiannaamaya commented 9 months ago

That notebook does not work for me either. When running, !sudo update-alternatives --config python3, I get, update-alternatives: error: no alternatives for python3.

Screenshot 2023-09-20 at 2 48 21 PM
lockwo commented 9 months ago

Yes, changing python versions in colab can be unreliable at best. I do not attempt it usually. If you are having version control problems with colab though, I would recommend contacting their support for more help.

knaughttyanyon commented 9 months ago

Duplicate of #798