Hamlib Dataset download fails

Dear Pennylane team,
when I try to download any of the datasets in the “other” category through qml.data, I get a FileNotFound error.

import pennylane as qml
[ds] = qml.data.load("other", name="hamlib-max3sat")

or

import pennylane as qml
[ds] = qml.data.load("other", name="hamlib-tsp")

I get the following error:

File ~/.local/share/virtualenvs/BA-PvaVEQ8H/lib/python3.12/site-packages/fsspec/implementations/http.py:435, in HTTPFileSystem._info(self, url, **kwargs)
    432     except Exception as exc:
    433         if policy == "get":
    434             # If get failed, then raise a FileNotFoundError
--> 435             raise FileNotFoundError(url) from exc
    436         logger.debug("", exc_info=exc)
    438 return {"name": url, "size": None, **info, "type": "file"}

FileNotFoundError: https://datasets.cloud.pennylane.ai/datasets/h5/tmp/TSP/TSP_TSP.h5

I am using Pennylane Version 0.37.0, Python 3.12.3 on a macOS-14.5-arm64-arm-64bit.

Besides this error, I wonder if it is possible to directly calculate the TSP Hamiltonian of a given graph, in a fashion similar to qml.qaoa.cost.max_weight_cycle. I’d be interested to hear if you are planning to add more Hamiltonian calculation functions for other optimization problems as well.

Thanks a lot for your assistance.

Hi @FedeHR ! Thank you for the feedback!

I haven’t been able to reproduce the error. In the meantime, you can try to access the link through a browser. You should be able to download the dataset that way and then access it with qml.data.Dataset.open()

directly calculating the TSP Hamiltonian given a graph

We don’t have a function for this yet, but it could be an interesting feature. We do have plans to include tools to build spin Hamiltonians in the upcoming releases, but not for specific optimization problems. Are you working with optimization problem Hamiltonians a lot?

Edit: the issue might be with Python certificates on MacOS. Not tested from our end yet, but you could try following this article to install certifi.

Hello Diego, thanks for your reply, I downloaded the link manually and I’ll be using it as you suggested.

Yes, currently I’m writing a thesis where I use Hamiltonians for combinatorial optimization problems. I am using the qiskit-optimization package, but I also wanted to try Pennylane for this task.

I’ll definetely try this as well.
Thanks a lot for the prompt response! I look forward to your tools to build spin Hamiltonians in future releases.
Best regards,
Federico

2 Likes