# Error message when using pennylane molecular dataset

**URL:** <https://discuss.pennylane.ai/t/error-message-when-using-pennylane-molecular-dataset/3466>\
**Category:** PennyLane Help\
**Created:** [September 23, 2023, 7:06am UTC](https://discuss.pennylane.ai/t/error-message-when-using-pennylane-molecular-dataset/3466 "2023-09-23T07:06:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Den](https://avatars.discourse-cdn.com/v4/letter/d/ce7236/32.png) [@Den](https://discuss.pennylane.ai/u/Den)\
**Post date:** [September 23, 2023, 7:06am UTC](https://discuss.pennylane.ai/t/error-message-when-using-pennylane-molecular-dataset/3466/1 "2023-09-23T07:06:49Z")

</div>

I copied and pasted the data.load code from the N2H2 page ([N2H2 Molecule](https://pennylane.ai/datasets/qchem/n2h2-molecule)) and got an error message when executing it (code below). Am I missing something?

```auto
import pennylane as qml
from pennylane import numpy as np
qml.data.load("qchem", molname="N2H2", bondlength=1.247, basis="STO-3G")

```

The error message is below.

```auto
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Input In [18], in <cell line: 1>()
----> 1 qml.data.load("qchem", molname="N2H2", bondlength=1.247, basis="STO-3G")

File /usr/local/lib/python3.8/site-packages/pennylane/data/data_manager.py:272, in load(data_name, attributes, lazy, folder_path, force, num_threads, **params)
    269 for folder in all_folders:
    270 real_folder = os.path.join(directory_path, data_name, folder)
    271 data_files.append(
--> 272 Dataset(data_name, real_folder, folder.replace(pathsep, "_"), docstring, standard=True)
    273 )
    275 return data_files

File /usr/local/lib/python3.8/site-packages/pennylane/data/dataset.py:148, in Dataset. __init__ (self, standard, *args, **kwargs)
    146 raise ValueError(f"Expected {name} to be a str, got {type(val). __name__ }")
    147 self._is_standard = True
--> 148 self. __std_init__ (*args)
    149 else:
    150 self._is_standard = False

File /usr/local/lib/python3.8/site-packages/pennylane/data/dataset.py:122, in Dataset. __std_init__ (self, data_name, folder, attr_prefix, docstring)
    120 self._fullfile = prefix.format("full")
    121 if os.path.exists(self._fullfile):
--> 122 self.read(self._fullfile, lazy=True)
    123 else:
    124 self._fullfile = None

File /usr/local/lib/python3.8/site-packages/pennylane/data/dataset.py:206, in Dataset.read(self, filepath, lazy, assign_to)
    183 def read(self, filepath, lazy=False, assign_to=None):
    184 """Loads data from a saved file to the current dataset.
    185 
    186 Args:
   (...)
    204 tensor([1, 1, 0, 0], requires_grad=True)
    205 """
--> 206 data = self._read_file(filepath)
    207 file_contains_dataset = True
    208 if assign_to is not None:

File /usr/local/lib/python3.8/site-packages/pennylane/data/dataset.py:181, in Dataset._read_file(filepath)
    179 zstd, dill = _import_zstd_dill()
    180 depressed_pickle = zstd.decompress(compressed_pickle)
--> 181 return dill.loads(depressed_pickle)

File /usr/local/lib/python3.8/site-packages/dill/_dill.py:327, in loads(str, ignore, **kwds)
    316 """
    317 Unpickle an object from a string.
    318 
   (...)
    324 Default values for keyword arguments can be set in :mod:`dill.settings`.
    325 """
    326 file = StringIO(str)
--> 327 return load(file, ignore, **kwds)

File /usr/local/lib/python3.8/site-packages/dill/_dill.py:313, in load(file, ignore, **kwds)
    307 def load(file, ignore=None, **kwds):
    308 """
    309 Unpickle an object from a file.
    310 
    311 See :func:`loads` for keyword arguments.
    312 """
--> 313 return Unpickler(file, ignore=ignore, **kwds).load()

File /usr/local/lib/python3.8/site-packages/dill/_dill.py:525, in Unpickler.load(self)
    524 def load(self): #NOTE: if settings change, need to update attributes
--> 525 obj = StockUnpickler.load(self)
    526 if type(obj). __module__ == getattr(_main_module, ' __name__', ' __main__'):
    527 if not self._ignore:
    528 # point obj class to main

File /usr/local/lib/python3.8/site-packages/dill/_dill.py:661, in _create_code(*args)
    659 if len(args) == 16: return CodeType(*args)
    660 elif len(args) == 15: return CodeType(args[0], 0, *args[1:])
--> 661 return CodeType(args[0], 0, 0, *args[1:])
    662 elif hasattr(CodeType, 'co_kwonlyargcount'):
    663 if len(args) == 16: return CodeType(args[0], *args[2:])

TypeError: code() takes at most 16 arguments (19 given)

```

And, finally, make sure to include the versions of your packages. Specifically, show us the output of `qml.about()`.

---

<div class="post-metadata">

**Author:** ![Ivana\_at\_Xanadu](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/ivana_at_xanadu/32/1852_2.png) [@Ivana\_at\_Xanadu](https://discuss.pennylane.ai/u/Ivana_at_Xanadu)\
**Post date:** [September 26, 2023, 12:19pm UTC](https://discuss.pennylane.ai/t/error-message-when-using-pennylane-molecular-dataset/3466/2 "2023-09-26T12:19:44Z")

</div>

Hey @Den , I retraced your steps here and I’m not getting the same error. 🤔  
Did you include the full code you were running?  
It might also be helpful to include the output of `qml.about()`. 🙂

---

<div class="post-metadata">

**Author:** ![whatsis](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/whatsis/32/1019_2.png) [@whatsis](https://discuss.pennylane.ai/u/whatsis)\
**Post date:** [September 27, 2023, 6:04pm UTC](https://discuss.pennylane.ai/t/error-message-when-using-pennylane-molecular-dataset/3466/3 "2023-09-27T18:04:55Z")

</div>

Hey @Den, from the error message, it looks like you’re using an old version of PennyLane, which used `zstd` and `dill`. Please upgrade your PennyLane package, delete any existing dataset files/folders and let me know if the error message persists. 🙂
