MolSSI / QCFractal

A distributed compute and database platform for quantum chemistry.
https://molssi.github.io/QCFractal/
BSD 3-Clause "New" or "Revised" License
144 stars 47 forks source link

distutils has no attribute version #737

Closed chrisiacovella closed 11 months ago

chrisiacovella commented 1 year ago

Describe the bug

When saving a dataset downloaded from qcportal to hdf5 format, the following error is generated:

    257 n_records = len(ds.data.records)
    258 default_shape = (n_records,)
--> 260 if h5py.__version__ >= distutils.version.StrictVersion("2.10.0"):
    261     vlen_double_t = h5py.vlen_dtype(np.dtype("float64"))
    262     utf8_t = h5py.string_dtype(encoding="utf-8")

AttributeError: module 'distutils' has no attribute 'version'

The specific line causing the problem.

https://github.com/MolSSI/QCPortal/blob/ff6f8bdf733b648e927223c89126a3ba37f88b69/qcportal/collections/dataset_view.py#L260

I currently have installed:

qcelemental 0.25.1
qcportal 0.15.8
setuptools 68.8.0 python 3.11.4

Downgrading setup tools to 59.5.0 resolves the issue (changes to distutils occurred in 59.6.0, but also requires I downgrade to python 3.10

It is recommended to switch to using packaging, i.e.:

from packaging.version import parse as parse_version

parse_version("2.10.0")

To Reproduce

import qcportal as ptl

qcp_client = ptl.FractalClient()
qm9 = qcp_client.get_collection('Dataset', 'QM9')
qm9.download()
qm9.to_file(path='test.hdf5', encoding='hdf5')

Expected behavior

Additional context

bennybp commented 11 months ago

HDF5 has been removed from v0.50, although I may re-add it in the future. Either way, this issue is moot now.