Full Pennylane installation

Hi @jerteach,

I’ve made a new Github issue for this. Regarding:

In order to look into this, it would be helpful to know which demo needs version 4.8 - is it all of the ones except the pyquil ones? Thanks!

I posted in the issues https://github.com/PennyLaneAI/qml/issues/169#issuecomment-734066792

basically for me these files do not work after converting to 4.7.2

quantum_neural_net.py
qonn.py
tutorial_doubly_stochastic.py
tutorial_plugins_hybrid.py

Has anyone from PennyLaneAI loaded my Gitpod? @glassnotes @antalszava @josh @Tom_Bromley ?

The nice thing about Gitpod, is that on first load it is a fresh install so everyone’s Gitpod is exactly the same.

These steps will be fairly easy to follow: (I have not made videos yet as I have not solved my Quantum Machine Learning to IOT devices simplification problem yet)

  1. Login to Github, as Gitpod authorizes using Github

  2. Load my Gitpod https://gitpod.io/#github.com/hpssjellis/my-examples-for-quantum-computing Takes about 10 minutes so put it in it’s own browser window.

  3. It should auto place you in pennylaneai/qml-demos if not use the terminal at the bottom of the screen to ls and cd to get there.

  4. Run these commands to check if the code is working

python3 quantum_neural_net.py

python3 qonn.py

python3 tutorial_plugins_hybrid.py

You might be asked to load a Port Browser to show the plt.show() matplotlib Tab Open Ports --> Open Preview or Browser. I ctrl z as some of the programs take a while to run.

  1. Now reduce the version of antlr4-python3-runtime:
pip3 install antlr4-python3-runtime==4.7.2

  1. And try the above commands again. I get errors.

  2. I have a fancy error writing bash file if you like:

./a01-show-errors.sh
Enter file name of python file showing errors
making an errors.txt file to append these errors
qonn

Note: Filename only, no extension. Github code here

  1. I hope it is useful, my Grade 9-12 students at https://www.gearbots.org/overview/ find https://www.gitpod.io/ very useful and easy to use.

.

.

.

  1. Update: It seems that python3 tutorial_doubly_stochastic.py is now working, it takes a long time to run, so perhaps I got impatient. Here is my error logs for the other three.
*********************
*********************
Running Python file: quantum_neural_net
*********************

2020-11-27 17:46:27.068247: W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library 'libcudart.so.10.1'; dlerror: libcudart.so.10.1: cannot open shared object file: No such file or directory
2020-11-27 17:46:27.068329: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
Traceback (most recent call last):
  File "quantum_neural_net.py", line 44, in <module>
    dev = qml.device("strawberryfields.fock", wires=1, cutoff_dim=10)
  File "/workspace/.pip-modules/lib/python3.7/site-packages/pennylane/__init__.py", line 187, in device
    plugin_device_class = plugin_devices[name].load()
  File "/workspace/.pip-modules/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2446, in load
    self.require(*args, **kwargs)
  File "/workspace/.pip-modules/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2469, in require
    items = working_set.resolve(reqs, env, installer, extras=self.extras)
  File "/workspace/.pip-modules/lib/python3.7/site-packages/pkg_resources/__init__.py", line 775, in resolve
    raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (antlr4-python3-runtime 4.7.2 (/workspace/.pip-modules/lib/python3.7/site-packages), Requirement.parse('antlr4-python3-runtime==4.8'), {'quantum-blackbird'})

*********************
*********************
Running Python file: qonn
*********************

2020-11-27 17:46:42.251644: W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library 'libcudart.so.10.1'; dlerror: libcudart.so.10.1: cannot open shared object file: No such file or directory
2020-11-27 17:46:42.251724: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
Traceback (most recent call last):
  File "qonn.py", line 90, in <module>
    dev = qml.device("strawberryfields.fock", wires=4, cutoff_dim=4)
  File "/workspace/.pip-modules/lib/python3.7/site-packages/pennylane/__init__.py", line 187, in device
    plugin_device_class = plugin_devices[name].load()
  File "/workspace/.pip-modules/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2446, in load
    self.require(*args, **kwargs)
  File "/workspace/.pip-modules/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2469, in require
    items = working_set.resolve(reqs, env, installer, extras=self.extras)
  File "/workspace/.pip-modules/lib/python3.7/site-packages/pkg_resources/__init__.py", line 775, in resolve
    raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (antlr4-python3-runtime 4.7.2 (/workspace/.pip-modules/lib/python3.7/site-packages), Requirement.parse('antlr4-python3-runtime==4.8'), {'quantum-blackbird'})

*********************
*********************
Running Python file: tutorial_plugins_hybrid
*********************

2020-11-27 17:47:00.378067: W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library 'libcudart.so.10.1'; dlerror: libcudart.so.10.1: cannot open shared object file: No such file or directory
2020-11-27 17:47:00.378151: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
Traceback (most recent call last):
  File "tutorial_plugins_hybrid.py", line 140, in <module>
    dev_fock = qml.device("strawberryfields.fock", wires=2, cutoff_dim=2)
  File "/workspace/.pip-modules/lib/python3.7/site-packages/pennylane/__init__.py", line 187, in device
    plugin_device_class = plugin_devices[name].load()
  File "/workspace/.pip-modules/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2446, in load
    self.require(*args, **kwargs)
  File "/workspace/.pip-modules/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2469, in require
    items = working_set.resolve(reqs, env, installer, extras=self.extras)
  File "/workspace/.pip-modules/lib/python3.7/site-packages/pkg_resources/__init__.py", line 775, in resolve
    raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (antlr4-python3-runtime 4.7.2 (/workspace/.pip-modules/lib/python3.7/site-packages), Requirement.parse('antlr4-python3-runtime==4.8'), {'quantum-blackbird'})



Hi @jerteach! Unfortunately I haven’t had a chance to check out your gitpod, but it sounds like it is progressing nicely :slight_smile:

The only issue seems to be that a single environment will not support running all tutorials! Does gitpod allow you to have different environments for different groups of tutorials? Perhaps you could use something like a virtual env.

I could load 2 gitpods, that would not be hard, or just run a bash file that install and uninstalls. but I have moved on from this issue as a few of the non-working tutorials seem to need a connection to a site that I don’t have, Anyway thanks for your help with this. It is closed for me now.

2 Likes

Hi @jerteach,

Just as a brief follow-up here, on the off-chance that you are referring to the fact that a couple demos use Rigetti’s Forest and its “QVM”, these are actually not located at a website, but need to be activated locally (running a one-liner in a terminal), and can then be accessed via a local address. Not sure how you might do this on your gitpod system though

@nathan

If someone can post an example (with fake Rigetti activation codes) I would give it a try, I think I have a Rigetti login, just never got their system to work. I really liked their potential to use Javascript, but no action has happened on that account for a while so I don’t think it is still active.

Hi @jerteach,

You can download and run both the compiler and the qvm virtual machine locally, without needing any login details (things may have worked differently if you tried Rigetti Forest in the distant past). You can find the download and installation instructions here. When we build those tutorials for our docs, we have it set up to run the necessary quilc compiler & qvm simulator in a separate process. The python scripts then “communicate” with these, even though all processes are running in the same machine. I’m not sure how it works on your gitpod system, but our docker commands are something like

docker run -d -p 5555:5555 rigetti/quilc -R -p 5555
docker run -d -p 5000:5000 rigetti/qvm -S -p 5000

Note: we don’t maintain these libraries, so we can’t necessarily help with any debugging issues you may come across.

1 Like

Those docker commands used to give me nightmares. Docker was a godsend when it first came out, but since using Gitpod.io I have forgotten everything I knew about Docker.

Thanks @nathan for posting the code. I tried loading both the sites using Gitpod but could not get them running.

Sorry you couldn’t get it to work @jerteach. To be honest, while I used to have working versions of quilc and qvm running on my computer, when I recently installed the newest versions, they no longer run for me either. They do still work in our online build system (which creates the tutorials) though, so I had hoped they might work for you (don’t know much about gitpod though)

1 Like