question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Config of pyquil gives a syntax error

See original GitHub issue

I am running Ubuntu version 16.04 installed via crouton on an acer chromebook 11. I followed the docs and did pip install pyquil, which ran successfully, and then I ran pyquil-config-setup which gave the following:

Traceback (most recent call last):
  File "/home/physicsnerd/.local/bin/pyquil-config-setup", line 7, in <module>
    from pyquil.setup.pyquil_config_setup import main
  File "/home/physicsnerd/.local/lib/python2.7/site-packages/pyquil/setup/pyquil_config_setup.py", line 19, in <module>
    from pyquil.api._config import PyquilConfig
  File "/home/physicsnerd/.local/lib/python2.7/site-packages/pyquil/api/__init__.py", line 23, in <module>
    from pyquil.api.job import Job
  File "/home/physicsnerd/.local/lib/python2.7/site-packages/pyquil/api/job.py", line 21, in <module>
    from pyquil.parser import parse_program
  File "/home/physicsnerd/.local/lib/python2.7/site-packages/pyquil/parser.py", line 19, in <module>
    from pyquil.quil import Program
  File "/home/physicsnerd/.local/lib/python2.7/site-packages/pyquil/quil.py", line 26, in <module>
    from pyquil._parser.PyQuilListener import run_parser
  File "/home/physicsnerd/.local/lib/python2.7/site-packages/pyquil/_parser/PyQuilListener.py", line 23, in <module>
    from antlr4 import *
  File "/home/physicsnerd/.local/lib/python2.7/site-packages/antlr4/__init__.py", line 1, in <module>
    from antlr4.Token import Token
  File "/home/physicsnerd/.local/lib/python2.7/site-packages/antlr4/Token.py", line 59
    def text(self, text:str):
                       ^
SyntaxError: invalid syntax

This is what running pip install pyquil gave for output (it seemed to run successfully; I’m only putting this here just in case it is useful):

Collecting pyquil
  Downloading pyquil-1.6.2.tar.gz (73kB)
    100% |################################| 81kB 719kB/s 
Collecting requests>=2.4.2 (from pyquil)
  Using cached requests-2.18.4-py2.py3-none-any.whl
Collecting numpy>=1.10 (from pyquil)
  Downloading numpy-1.13.3-cp27-cp27mu-manylinux1_x86_64.whl (16.6MB)
    100% |################################| 16.7MB 32kB/s 
Collecting matplotlib>=1.5 (from pyquil)
  Downloading matplotlib-2.1.1-cp27-cp27mu-manylinux1_x86_64.whl (15.0MB)
    100% |################################| 15.0MB 21kB/s 
Collecting typing>=3.6 (from pyquil)
  Downloading typing-3.6.2-py2-none-any.whl
Collecting urllib3>=1.21.1 (from pyquil)
  Using cached urllib3-1.22-py2.py3-none-any.whl
Collecting antlr4-python2-runtime>=4.7; python_version < "3" (from pyquil)
  Downloading antlr4-python2-runtime-4.7.1.tar.gz (111kB)
    100% |################################| 112kB 751kB/s 
Collecting antlr4-python3-runtime>=4.7; python_version >= "3" (from pyquil)
  Downloading antlr4-python3-runtime-4.7.1.tar.gz (111kB)
    100% |################################| 112kB 1.3MB/s 
Collecting idna<2.7,>=2.5 (from requests>=2.4.2->pyquil)
  Using cached idna-2.6-py2.py3-none-any.whl
Collecting chardet<3.1.0,>=3.0.2 (from requests>=2.4.2->pyquil)
  Using cached chardet-3.0.4-py2.py3-none-any.whl
Collecting certifi>=2017.4.17 (from requests>=2.4.2->pyquil)
  Downloading certifi-2017.11.5-py2.py3-none-any.whl (330kB)
    100% |################################| 337kB 902kB/s 
Collecting cycler>=0.10 (from matplotlib>=1.5->pyquil)
  Downloading cycler-0.10.0-py2.py3-none-any.whl
Collecting six>=1.10 (from matplotlib>=1.5->pyquil)
  Downloading six-1.11.0-py2.py3-none-any.whl
Collecting pytz (from matplotlib>=1.5->pyquil)
  Downloading pytz-2017.3-py2.py3-none-any.whl (511kB)
    100% |################################| 512kB 736kB/s 
Collecting subprocess32 (from matplotlib>=1.5->pyquil)
  Downloading subprocess32-3.2.7.tar.gz (54kB)
    100% |################################| 61kB 2.7MB/s 
Collecting python-dateutil>=2.0 (from matplotlib>=1.5->pyquil)
  Downloading python_dateutil-2.6.1-py2.py3-none-any.whl (194kB)
    100% |################################| 194kB 1.8MB/s 
Collecting backports.functools-lru-cache (from matplotlib>=1.5->pyquil)
  Downloading backports.functools_lru_cache-1.4-py2.py3-none-any.whl
Collecting pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 (from matplotlib>=1.5->pyquil)
  Downloading pyparsing-2.2.0-py2.py3-none-any.whl (56kB)
    100% |################################| 61kB 2.8MB/s 
Building wheels for collected packages: pyquil, antlr4-python2-runtime, antlr4-python3-runtime, subprocess32
  Running setup.py bdist_wheel for pyquil ... done
  Stored in directory: /home/physicsnerd/.cache/pip/wheels/ac/f0/65/9c2117811f8a77d4f6c549b9741f324cb9e7ed55e85ec195a4
  Running setup.py bdist_wheel for antlr4-python2-runtime ... done
  Stored in directory: /home/physicsnerd/.cache/pip/wheels/a6/43/d3/18b2ff3978bdc7bec8aa963e85dbc569c8ef4bd290f40017fa
  Running setup.py bdist_wheel for antlr4-python3-runtime ... done
  Stored in directory: /home/physicsnerd/.cache/pip/wheels/12/ef/55/3d28ddbef18ae00a21e1ef4ae367e5ada2a24ffb4ea3b927cd
  Running setup.py bdist_wheel for subprocess32 ... done
  Stored in directory: /home/physicsnerd/.cache/pip/wheels/7d/4c/a4/ce9ceb463dae01f4b95e670abd9afc8d65a45f38012f8030cc
Successfully built pyquil antlr4-python2-runtime antlr4-python3-runtime subprocess32
Installing collected packages: urllib3, idna, chardet, certifi, requests, numpy, six, cycler, pytz, subprocess32, python-dateutil, backports.functools-lru-cache, pyparsing, matplotlib, typing, antlr4-python2-runtime, antlr4-python3-runtime, pyquil
Successfully installed antlr4-python2-runtime-4.7.1 antlr4-python3-runtime-4.7.1 backports.functools-lru-cache-1.4 certifi-2017.11.5 chardet-3.0.4 cycler-0.10.0 idna-2.6 matplotlib-2.1.1 numpy-1.13.3 pyparsing-2.2.0 pyquil-1.6.2 python-dateutil-2.6.1 pytz-2017.3 requests-2.18.4 six-1.10.0 subprocess32-3.2.7 typing-3.6.2 urllib3-1.22

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
stevenheidelcommented, Jan 2, 2018

Looks like a Python permissions issue: https://stackoverflow.com/questions/21093002/error-could-not-create-usr-local-lib-python2-7-dist-packages-virtualenv-suppo

Not sure if that link will help but it’s worth a shot.

Alternatively, try using Python 3. Support for Python 2 will be dropped from PyQuil in the future.

0reactions
stevenheidelcommented, May 23, 2018

Yes I’ll close it

Read more comments on GitHub >

github_iconTop Results From Across the Web

Changelog — pyQuil 3.3.2 documentation - Rigetti Computing
The teleportation and Meyer penny game examples had a syntax error (gh-778, gh-772). When running on the QPU, you could get into trouble...
Read more >
pyQuil Documentation - Rigetti Computing
an error. PyQuil 2 makes this task easy with the function decorator @pyquil_protect, found in the module pyquil.api.
Read more >
pyQuil Documentation - Rigetti Computing
an error. PyQuil 2 makes this task easy with the function decorator @pyquil_protect, found in the module pyquil.api.
Read more >
Changelog — pyQuil 2.7.0 documentation - Rigetti Computing
The teleportation and Meyer penny game examples had a syntax error (gh-778, gh-772). When running on the QPU, you could get into trouble...
Read more >
Programs and Gates — pyQuil 3.3.2 documentation
In this hybrid model, the program ansatz (template of gates) is fixed, and iteratively updated with new parameters. These new parameters are often...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found