LuchnikovI / QGOpt

Riemannian optimization for quantum technologies
Apache License 2.0
56 stars 6 forks source link

ImportError: cannot import name 'distribution_strategy_context' from 'tensorflow.python.distribute' #49

Open ACE07-Sev opened 7 months ago

ACE07-Sev commented 7 months ago

Issue with importing QGOpt.

Traceback (most recent call last):
  Cell In[15], line 6
    import QGOpt as qgo
  File /opt/conda/lib/python3.10/site-packages/QGOpt/__init__.py:4
    from QGOpt import optimizers
  File /opt/conda/lib/python3.10/site-packages/QGOpt/optimizers/__init__.py:3
    from QGOpt.optimizers.Adam import RAdam
  File /opt/conda/lib/python3.10/site-packages/QGOpt/optimizers/Adam.py:6
    from tensorflow.python.distribute import distribution_strategy_context as distribute_ctx
ImportError: cannot import name 'distribution_strategy_context' from 'tensorflow.python.distribute' (/opt/conda/lib/python3.10/site-packages/tensorflow/python/distribute/__init__.py)

Use %tb to get the full traceback.
Sherock commented 5 months ago

I have the same problem. Any advice?

Sherock commented 5 months ago

I have the same problem. Any advice?

I see. Go to QGOpt.optimizers.adam, change from tensorflow.python.distribute import distribution_strategy_context as distribute_ctx to from tensorflow.python.distribute import distribute_lib as distributie_ctx