Closed michaelrgeller closed 7 years ago
Hi! To me it looks like the pip-installed version is running. Have you tried upgrading that to the newest version as well? If so, please make sure you have enough credits on your quantum experience account.
Did you get it working? @michaelrgeller
I tried it again, installing both from source and pip, and still get the same problem. Unfortunately I don’t have much time to spend on this now because I think it is really interesting. Anyhow, here is what happens. First uninstall and delete previous versions. Then
pip install projectq
Collecting projectq Using cached projectq-0.1.3.tar.gz Requirement already satisfied: numpy in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from projectq) Requirement already satisfied: future in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from projectq) Requirement already satisfied: pytest>=3.0 in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from projectq) Requirement already satisfied: pybind11>=1.7 in /Users/mgeller/Library/Python/2.7/lib/python/site-packages (from projectq) Requirement already satisfied: requests in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from projectq) Requirement already satisfied: py>=1.4.29 in /Users/mgeller/Library/Python/2.7/lib/python/site-packages (from pytest>=3.0->projectq) Requirement already satisfied: setuptools in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from pytest>=3.0->projectq) Requirement already satisfied: six>=1.10.0 in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from setuptools->pytest>=3.0->projectq) Requirement already satisfied: appdirs>=1.4.0 in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from setuptools->pytest>=3.0->projectq) Requirement already satisfied: packaging>=16.8 in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from setuptools->pytest>=3.0->projectq) Requirement already satisfied: pyparsing in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from packaging>=16.8->setuptools->pytest>=3.0->projectq) Installing collected packages: projectq Running setup.py install for projectq ... done Successfully installed projectq-0.1.3
pip list
projectq (0.1.3)
Here’s the script:
import projectq.setups.ibm from projectq.ops import H, Measure from projectq import MainEngine from projectq.backends import IBMBackend
eng = MainEngine() q1 = eng.allocate_qubit() H | q1 Measure | q1 eng.flush() print("Measured: {}".format(int(q1)))
python3 projectq_test.py
gives
(Note: This is the (slow) Python simulator.) Measured: 0
Seems fine. Now try
eng = MainEngine(IBMBackend()) q1 = eng.allocate_qubit() H | q1 Measure | q1 eng.flush() print("Measured: {}".format(int(q1)))
python3 projectq_test.py
gives
IBM QE user (e-mail) > mgeller@uga.edu IBM QE password >
After ~2 minutes,
Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/projectq/backends/_ibm/_ibm.py", line 232, in _run data = res['data']['p'] TypeError: 'NoneType' object is not subscriptable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "projectq_test.py", line 57, in
And I get the email:
Hi mgeller@uga.edu,
Sorry, the results of the execution of your quantum score projectq_experiment failed.
You can see the experiment code accessing to the next link:
https://quantumexperience.ng.bluemix.net/qstage/#/editor?codeId=03b5383fc63af77086181836664580f0 Thank you in advance for your help making IBM’s quantum presence on the web as exciting and cool as possible,
Sincerely,
the IBM Quantum Team
On Wed, Feb 1, 2017 at 2:51 PM, damiansteiger notifications@github.com wrote:
Did you get it working?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ProjectQ-Framework/ProjectQ/issues/10#issuecomment-276762534, or mute the thread https://github.com/notifications/unsubscribe-auth/ANqFeySdAHFmWw7y_Lk0g9Dp9O9IUUY1ks5rYOIpgaJpZM4LrzhO .
Thank you for trying again!
It seems that you installed the new version of ProjectQ for python2.7, but you're running your script using python3.6. Please, try executing
python2.7 projectq_test.py
instead or reinstalling using pip3 instead of pip.
Also, you can check that you have the newest version of ProjectQ (0.1.3) as follows:
import projectq
projectq.__version__
I'm using Python 3.6.0 and the latest source code from master.
In the examples folder, running quantum_random_numbers.py gives (Note: This is the (slow) Python simulator.) Measured: 0
Now try to use the IBM backend. Running quantum_random_numbers_ibm.py gives
IBM QE user (e-mail) > mgeller@uga.edu IBM QE password > x
I enter the login information, and receive an email message:
Hi mgeller@uga.edu,
Sorry, the results of the execution of your quantum score projectq_experiment failed.
You can see the experiment code accessing to the next link:
https://quantumexperience.ng.bluemix.net/qstage/#/editor?codeId=7f838b4658f61d1d805cb31f584a5552 Thank you in advance for your help making IBM’s quantum presence on the web as exciting and cool as possible,
Sincerely,
the IBM Quantum Team
The link points to a picture of the quantum circuit that looks correct. After a minute or so, I get the error
Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/projectq/backends/_ibm/_ibm.py", line 232, in _run data = res['data']['p'] TypeError: 'NoneType' object is not subscriptable
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "quantum_random_numbers_ibm.py", line 18, in
eng.flush()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/projectq/cengines/_main.py", line 229, in flush
self.receive([Command(self, FlushGate(), ([WeakQubitRef(self, -1)],))])
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/projectq/cengines/_main.py", line 214, in receive
self.send(command_list)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/projectq/cengines/_basics.py", line 191, in send
self.next_engine.receive(command_list)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/projectq/cengines/_tagremover.py", line 56, in receive
self.send([cmd])
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/projectq/cengines/_basics.py", line 191, in send
self.next_engine.receive(command_list)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/projectq/cengines/_optimize.py", line 234, in receive
self.send([cmd])
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/projectq/cengines/_basics.py", line 191, in send
self.next_engine.receive(command_list)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/projectq/cengines/_replacer/_replacer.py", line 190, in receive
self.send([cmd])
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/projectq/cengines/_basics.py", line 191, in send
self.next_engine.receive(command_list)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/projectq/cengines/_tagremover.py", line 56, in receive
self.send([cmd])
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/projectq/cengines/_basics.py", line 191, in send
self.next_engine.receive(command_list)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/projectq/cengines/_ibmcnotmapper.py", line 194, in receive
self._run()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/projectq/cengines/_ibmcnotmapper.py", line 147, in _run
self.next_engine.receive([cmd])
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/projectq/cengines/_optimize.py", line 234, in receive
self.send([cmd])
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/projectq/cengines/_basics.py", line 191, in send
self.next_engine.receive(command_list)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/projectq/backends/_ibm/_ibm.py", line 275, in receive
self._run()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/projectq/backends/_ibm/_ibm.py", line 262, in _run
raise Exception("Failed to run the circuit. Aborting.")
Exception: Failed to run the circuit. Aborting.
I also found same issue with the pip installed version.
Any advice would be appreciated.