Problem quantum datasets

Hello! If applicable, put your complete code example down below. Make sure that your code:

  • is 100% self-contained — someone can copy-paste exactly what is here and run it to
    reproduce the behaviour you are observing
  • includes comments
# Put code here
import pennylane as qml

[ds] = qml.data.load("other", name='hidden-manifold')

If you want help with diagnosing an error, please put the full error message below:

# Put full error message here
{
	"name": "JSONDecodeError",
	"message": "Expecting property name enclosed in double quotes: line 7 column 7 (char 90)",
	"stack": "---------------------------------------------------------------------------
JSONDecodeError                           Traceback (most recent call last)
File c:\\Users\\antot\\anaconda3\\envs\\QML\\Lib\\site-packages\\requests\\models.py:971, in Response.json(self, **kwargs)
    970 try:
--> 971     return complexjson.loads(self.text, **kwargs)
    972 except JSONDecodeError as e:
    973     # Catch JSON-related errors and raise as requests.JSONDecodeError
    974     # This aliases json.JSONDecodeError and simplejson.JSONDecodeError

File c:\\Users\\antot\\anaconda3\\envs\\QML\\Lib\\json\\__init__.py:346, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)
    343 if (cls is None and object_hook is None and
    344         parse_int is None and parse_float is None and
    345         parse_constant is None and object_pairs_hook is None and not kw):
--> 346     return _default_decoder.decode(s)
    347 if cls is None:

File c:\\Users\\antot\\anaconda3\\envs\\QML\\Lib\\json\\decoder.py:337, in JSONDecoder.decode(self, s, _w)
    333 \"\"\"Return the Python representation of ``s`` (a ``str`` instance
    334 containing a JSON document).
    335 
    336 \"\"\"
--> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end())
    338 end = _w(s, end).end()

File c:\\Users\\antot\\anaconda3\\envs\\QML\\Lib\\json\\decoder.py:353, in JSONDecoder.raw_decode(self, s, idx)
    352 try:
--> 353     obj, end = self.scan_once(s, idx)
    354 except StopIteration as err:

JSONDecodeError: Expecting property name enclosed in double quotes: line 7 column 7 (char 90)

During handling of the above exception, another exception occurred:

JSONDecodeError                           Traceback (most recent call last)
Cell In[3], line 3
      1 import pennylane as qml
----> 3 [ds] = qml.data.load(\"other\", name='mnist-pca')
      4 #print(qml.data.list_datasets()) # list of available datasets
      5 
      6 #ds.train['4']['inputs'] # points in 4-dimensional space
      7 #ds.train['4']['labels'] # labels for the points above

File c:\\Users\\antot\\anaconda3\\envs\\QML\\Lib\\site-packages\\pennylane\\data\\data_manager\\__init__.py:247, in load(data_name, attributes, folder_path, force, num_threads, block_size, **params)
    156 def load(  # pylint: disable=too-many-arguments
    157     data_name: str,
    158     attributes: Optional[typing.Iterable[str]] = None,
   (...)
    163     **params: Union[ParamArg, str, List[str]],
    164 ):
    165     r\"\"\"Downloads the data if it is not already present in the directory and returns it as a list of
    166     :class:`~pennylane.data.Dataset` objects. For the full list of available datasets, please see
    167     the `datasets website <https://pennylane.ai/datasets>`_.
   (...)
    245     -1.0791430411076344
    246     \"\"\"
--> 247     foldermap = _get_foldermap()
    248     data_struct = _get_data_struct()
    250     params = format_params(**params)

File c:\\Users\\antot\\anaconda3\\envs\\QML\\Lib\\site-packages\\pennylane\\data\\data_manager\\__init__.py:46, in _get_foldermap()
     43 response = get(FOLDERMAP_URL, timeout=5.0)
     44 response.raise_for_status()
---> 46 return FolderMapView(response.json())

File c:\\Users\\antot\\anaconda3\\envs\\QML\\Lib\\site-packages\\requests\\models.py:975, in Response.json(self, **kwargs)
    971     return complexjson.loads(self.text, **kwargs)
    972 except JSONDecodeError as e:
    973     # Catch JSON-related errors and raise as requests.JSONDecodeError
    974     # This aliases json.JSONDecodeError and simplejson.JSONDecodeError
--> 975     raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)

JSONDecodeError: Expecting property name enclosed in double quotes: line 7 column 7 (char 90)"
}

And, finally, make sure to include the versions of your packages. Specifically, show us the output of qml.about().
Name: PennyLane
Version: 0.37.0
Summary: PennyLane is a cross-platform Python library for quantum computing, quantum machine learning, and quantum chemistry. Train a quantum computer the same way as a neural network.
Home-page: GitHub - PennyLaneAI/pennylane: PennyLane is a cross-platform Python library for quantum computing, quantum machine learning, and quantum chemistry. Train a quantum computer the same way as a neural network.
Author:
Author-email:
License: Apache License 2.0
Location: C:\Users\antot\anaconda3\envs\QML\Lib\site-packages
Requires: appdirs, autograd, autoray, cachetools, networkx, numpy, packaging, pennylane-lightning, requests, rustworkx, scipy, semantic-version, toml, typing-extensions
Required-by: PennyLane-qiskit, PennyLane_Lightning

Platform info: Windows-10-10.0.22631-SP0
Python version: 3.11.7
Numpy version: 1.24.4
Scipy version: 1.11.4
Installed devices:

  • default.clifford (PennyLane-0.37.0)
  • default.gaussian (PennyLane-0.37.0)
  • default.mixed (PennyLane-0.37.0)
  • default.qubit (PennyLane-0.37.0)
  • default.qubit.autograd (PennyLane-0.37.0)
  • default.qubit.jax (PennyLane-0.37.0)
  • default.qubit.legacy (PennyLane-0.37.0)
  • default.qubit.tf (PennyLane-0.37.0)
  • default.qubit.torch (PennyLane-0.37.0)
  • default.qutrit (PennyLane-0.37.0)
  • default.qutrit.mixed (PennyLane-0.37.0)
  • default.tensor (PennyLane-0.37.0)
  • null.qubit (PennyLane-0.37.0)
  • lightning.qubit (PennyLane_Lightning-0.37.0)
  • qiskit.aer (PennyLane-qiskit-0.37.0)
  • qiskit.basicaer (PennyLane-qiskit-0.37.0)
  • qiskit.basicsim (PennyLane-qiskit-0.37.0)
  • qiskit.ibmq (PennyLane-qiskit-0.37.0)
  • qiskit.ibmq.circuit_runner (PennyLane-qiskit-0.37.0)
  • qiskit.ibmq.sampler (PennyLane-qiskit-0.37.0)
  • qiskit.remote (PennyLane-qiskit-0.37.0)

Hi @antoniotudisco , welcome to the Forum!

I can replicate this with PennyLane v0.38.1. I think this might be a bug. Let me check with the team to see if there’s a workaround or solution. Thanks for flagging this!

Thank you for the answer.
However, I tried to create a new environment with pennylane version v0.38 and I have the same problem.

>>> qml.about()
Name: PennyLane
Version: 0.38.0
Summary: PennyLane is a cross-platform Python library for quantum computing, quantum machine learning, and quantum chemistry. Train a quantum computer the same way as a neural network.
Home-page: https://github.com/PennyLaneAI/pennylane
Author:
Author-email:
License: Apache License 2.0
Location: C:\Users\antot\anaconda3\envs\provaQML\Lib\site-packages
Requires: appdirs, autograd, autoray, cachetools, networkx, numpy, packaging, pennylane-lightning, requests, rustworkx, scipy, toml, typing-extensions
Required-by: PennyLane_Lightning

Platform info:           Windows-11-10.0.22631-SP0
Python version:          3.12.5
Numpy version:           1.26.4
Scipy version:           1.14.1
Installed devices:
- default.clifford (PennyLane-0.38.0)
- default.gaussian (PennyLane-0.38.0)
- default.mixed (PennyLane-0.38.0)
- default.qubit (PennyLane-0.38.0)
- default.qubit.autograd (PennyLane-0.38.0)
- default.qubit.jax (PennyLane-0.38.0)
- default.qubit.legacy (PennyLane-0.38.0)
- default.qubit.tf (PennyLane-0.38.0)
- default.qubit.torch (PennyLane-0.38.0)
- default.qutrit (PennyLane-0.38.0)
- default.qutrit.mixed (PennyLane-0.38.0)
- default.tensor (PennyLane-0.38.0)
- null.qubit (PennyLane-0.38.0)
- lightning.qubit (PennyLane_Lightning-0.38.0)

I tried:

>>> [ds] = qml.data.load("other", name='hidden-manifold')

And the error is:

Traceback (most recent call last):
  File "C:\Users\antot\anaconda3\envs\provaQML\Lib\site-packages\requests\models.py", line 974, in json
    return complexjson.loads(self.text, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\antot\anaconda3\envs\provaQML\Lib\json\__init__.py", line 346, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\antot\anaconda3\envs\provaQML\Lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\antot\anaconda3\envs\provaQML\Lib\json\decoder.py", line 353, in raw_decode
    obj, end = self.scan_once(s, idx)
               ^^^^^^^^^^^^^^^^^^^^^^
json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 7 column 7 (char 90)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\antot\anaconda3\envs\provaQML\Lib\site-packages\pennylane\data\data_manager\__init__.py", line 323, in load
    foldermap = _get_foldermap()
                ^^^^^^^^^^^^^^^^
  File "C:\Users\antot\anaconda3\envs\provaQML\Lib\site-packages\pennylane\data\data_manager\__init__.py", line 46, in _get_foldermap
    return FolderMapView(response.json())
                         ^^^^^^^^^^^^^^^
  File "C:\Users\antot\anaconda3\envs\provaQML\Lib\site-packages\requests\models.py", line 978, in json
    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting property name enclosed in double quotes: line 7 column 7 (char 90)
>>> [ds] = qml.data.load("other", name='hidden-manifold')
Traceback (most recent call last):
  File "C:\Users\antot\anaconda3\envs\provaQML\Lib\site-packages\requests\models.py", line 974, in json
    return complexjson.loads(self.text, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\antot\anaconda3\envs\provaQML\Lib\json\__init__.py", line 346, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\antot\anaconda3\envs\provaQML\Lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\antot\anaconda3\envs\provaQML\Lib\json\decoder.py", line 353, in raw_decode
    obj, end = self.scan_once(s, idx)
               ^^^^^^^^^^^^^^^^^^^^^^
json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 7 column 7 (char 90)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\antot\anaconda3\envs\provaQML\Lib\site-packages\pennylane\data\data_manager\__init__.py", line 323, in load
    foldermap = _get_foldermap()
                ^^^^^^^^^^^^^^^^
  File "C:\Users\antot\anaconda3\envs\provaQML\Lib\site-packages\pennylane\data\data_manager\__init__.py", line 46, in _get_foldermap
    return FolderMapView(response.json())
                         ^^^^^^^^^^^^^^^
  File "C:\Users\antot\anaconda3\envs\provaQML\Lib\site-packages\requests\models.py", line 978, in json
    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting property name enclosed in double quotes: line 7 column 7 (char 90)

I apologize, it was necessary to delete the datasets folder and pycache as it was conflicting

1 Like

I’m glad to hear that the issue is solved for you! Thanks for confirming :raised_hands:

1 Like