quantumlib / ReCirq

Research using Cirq!
https://quantumai.google/cirq/experiments
Apache License 2.0
275 stars 117 forks source link

Dependencies issues for running the routing notebook #327

Open Jaakik opened 1 year ago

Jaakik commented 1 year ago

Many imports in the notebooks are failing due to version incpompatibilies for the routing with tket notebook


ImportError                               Traceback (most recent call last)
[<ipython-input-26-f469bcac2048>](https://localhost:8080/#) in <module>
      1 import cirq
----> 2 import recirq
      3 import networkx as nx
      4 from cirq.contrib.svg import SVGCircuit
      5 import numpy as np

6 frames
[/usr/local/lib/python3.8/dist-packages/sphinx/util/rst.py](https://localhost:8080/#) in <module>
     19 from docutils.statemachine import StringList
     20 from docutils.utils import Reporter
---> 21 from jinja2 import Environment, environmentfilter
     22 
     23 from sphinx.locale import __

ImportError: cannot import name 'environmentfilter' from 'jinja2' (/usr/local/lib/python3.8/dist-packages/jinja2/__init__.py)

---------------------------------------------------------------------------
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.

To view examples of installing some common dependencies, click the
"Open Examples" button below.
---------------------------------------------------------------------------```

and when installing: 
`try:
    import recirq
except ImportError:
    !pip install -q git+https://github.com/quantumlib/ReCirq sympy~=1.6`

`  Preparing metadata (setup.py) ... done
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
notebook 5.7.16 requires jinja2<=3.0.0, but you have jinja2 3.1.2 which is incompatible.
flask 1.1.4 requires click<8.0,>=5.1, but you have click 8.0.0 which is incompatible.
flask 1.1.4 requires Jinja2<3.0,>=2.10.1, but you have jinja2 3.1.2 which is incompatible.`
PranithChowdary commented 1 year ago

One solution to try is to upgrade the notebook package to a version that is compatible with the jinja2 version you have installed. You can do this by running !pip install notebook==6.1.5 (or any version that is compatible with your jinja2 version).

Then, you can try installing recirq again using !pip install recirq. If this does not work, you can try uninstalling and reinstalling jinja2 and recirq, ensuring that you have compatible versions of both packages.