ReCirq icon indicating copy to clipboard operation
ReCirq copied to clipboard

Dependencies issues for running the routing notebook

Open Jaakik opened this issue 2 years ago • 1 comments

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.`


Jaakik avatar Jan 11 '23 07:01 Jaakik

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.

PranithChowdary avatar Apr 07 '23 04:04 PranithChowdary

This no longer appears to be relevant. A sample of notebooks I tried in my environment with Python 3.11 and Jupyter worked. Plus, this issue references Python 3.8, which means it's fairly old at this point. Closing.

mhucka avatar Aug 18 '25 00:08 mhucka