Atoms are too close after installation

Hello. I have previously been able to use psi4 just fine on my iMac (macOS version 14.5 arm64 M1 chip). I am now trying to install and use Psi4 on my MacBook Pro (macOS 14.5 arm64 M3 chip) as well as help two new members of my research group install and start using Psi4. I installed using Conda and now when I try to use Psi4 in a Jupyter notebook I get the following error regardless of what molecule I use. I have even tried following the tutorial found in the documentation. I am using the Conda environment I found in the Psi4 GitHub here. Here is the current example I am trying to use (please note I am wanting to do dft calculations like I can on the other computer but this installation will not let me do even this):

import psi4
import matplotlib.pyplot as plt
import numpy as np
#! Sample HF/cc-pVDZ H2O Computation
psi4.set_memory('500 MB')
h2o = psi4.geometry("""
O
H 1 0.96
H 1 0.96 2 104.5
""")
psi4.energy('scf/cc-pvdz')
{
	"name": "ValidationError",
	"message": "Following atoms are too close: [(0, np.int64(1), np.float64(0.0)), (0, np.int64(2), np.float64(0.0)), (1, np.int64(2), np.float64(0.0))]",
	"stack": "---------------------------------------------------------------------------
ValidationError                           Traceback (most recent call last)
File /opt/anaconda3/envs/p4env311/lib/python3.11/site-packages/psi4/driver/qcdb/molecule.py:1646, in Molecule.to_dict(self, force_c1, force_units, np_out)
   1645 try:
-> 1646     validated_molrec = qcel.molparse.from_arrays(speclabel=False, verbose=0, domain='qm', **molrec)
   1647 except qcel.ValidationError as err:
   1648     # * this can legitimately happen if total chg or mult has been set
   1649     #   independently b/c fragment chg/mult not reset. so try again.

File /opt/anaconda3/envs/p4env311/lib/python3.11/site-packages/qcelemental/molparse/from_arrays.py:352, in from_arrays(geom, elea, elez, elem, mass, real, elbl, name, units, input_units_to_au, fix_com, fix_orientation, fix_symmetry, fragment_separators, fragment_charges, fragment_multiplicities, molecular_charge, molecular_multiplicity, comment, provenance, connectivity, fragment_files, hint_types, geom_hints, geom_unsettled, variables, domain, missing_enabled_return, np_out, speclabel, tooclose, zero_ghost_fragments, nonphysical, mtol, copy, verbose)
    351 else:
--> 352     processed = validate_and_fill_geometry(geom=geom, tooclose=tooclose, copy=copy)
    353     update_with_error(molinit, processed)

File /opt/anaconda3/envs/p4env311/lib/python3.11/site-packages/qcelemental/molparse/from_arrays.py:612, in validate_and_fill_geometry(geom, tooclose, copy)
    611 if tooclose_inds:
--> 612     raise ValidationError(
    613         \"\"\"Following atoms are too close: {}\"\"\".format([(i, j, dist) for i, j, dist in tooclose_inds])
    614     )
    616 return {\"geom\": npgeom.reshape((-1))}

ValidationError: Following atoms are too close: [(0, np.int64(1), np.float64(0.0)), (0, np.int64(2), np.float64(0.0)), (1, np.int64(2), np.float64(0.0))]

During handling of the above exception, another exception occurred:

ValidationError                           Traceback (most recent call last)
Cell In[2], line 11
      3 psi4.set_memory('500 MB')
      5 h2o = psi4.geometry(\"\"\"
      6 O
      7 H 1 0.96
      8 H 1 0.96 2 104.5
      9 \"\"\")
---> 11 psi4.energy('scf/cc-pvdz')

File /opt/anaconda3/envs/p4env311/lib/python3.11/site-packages/psi4/driver/driver.py:524, in energy(name, **kwargs)
    521         shutil.copy(item, targetfile)
    523 logger.info(f\"Compute energy(): method={lowername}, basis={core.get_global_option('BASIS').lower()}, molecule={molecule.name()}, nre={'w/EFP' if hasattr(molecule, 'EFP') else molecule.nuclear_repulsion_energy()}\")
--> 524 logger.debug(\"w/EFP\" if hasattr(molecule, \"EFP\") else pp.pformat(molecule.to_dict()))
    525 wfn = procedures['energy'][lowername](lowername, molecule=molecule, **kwargs)
    526 logger.info(f\"Return energy(): {core.variable('CURRENT ENERGY')}\")

File /opt/anaconda3/envs/p4env311/lib/python3.11/site-packages/psi4/driver/qcdb/molecule.py:1655, in Molecule.to_dict(self, force_c1, force_units, np_out)
   1653 molrec['fragment_charges'] = [None] * len(fragments)
   1654 molrec['fragment_multiplicities'] = [None] * len(fragments)
-> 1655 validated_molrec = qcel.molparse.from_arrays(speclabel=False, nonphysical=True, verbose=0, domain='qm', **molrec)
   1656 forgive.append('fragment_charges')
   1657 forgive.append('fragment_multiplicities')

File /opt/anaconda3/envs/p4env311/lib/python3.11/site-packages/qcelemental/molparse/from_arrays.py:352, in from_arrays(geom, elea, elez, elem, mass, real, elbl, name, units, input_units_to_au, fix_com, fix_orientation, fix_symmetry, fragment_separators, fragment_charges, fragment_multiplicities, molecular_charge, molecular_multiplicity, comment, provenance, connectivity, fragment_files, hint_types, geom_hints, geom_unsettled, variables, domain, missing_enabled_return, np_out, speclabel, tooclose, zero_ghost_fragments, nonphysical, mtol, copy, verbose)
    349     nat = len(molinit[\"geom_unsettled\"])
    351 else:
--> 352     processed = validate_and_fill_geometry(geom=geom, tooclose=tooclose, copy=copy)
    353     update_with_error(molinit, processed)
    354     nat = molinit[\"geom\"].shape[0] // 3

File /opt/anaconda3/envs/p4env311/lib/python3.11/site-packages/qcelemental/molparse/from_arrays.py:612, in validate_and_fill_geometry(geom, tooclose, copy)
    609         tooclose_inds.extend([(x, y, dist) for y, dist in zip(indices + x + 1, dists[indices] ** 0.5)])
    611 if tooclose_inds:
--> 612     raise ValidationError(
    613         \"\"\"Following atoms are too close: {}\"\"\".format([(i, j, dist) for i, j, dist in tooclose_inds])
    614     )
    616 return {\"geom\": npgeom.reshape((-1))}

ValidationError: Following atoms are too close: [(0, np.int64(1), np.float64(0.0)), (0, np.int64(2), np.float64(0.0)), (1, np.int64(2), np.float64(0.0))]"
}

I have seen somewhat similar problems on this forum but they all involved fixes that do not seem to apply to my issue. Below are the outputs requested for when Psi4 does not build properly according to the best practices.

psi4 --version
1.9
which conda python psi4
conda () {
	\local cmd="${1-__missing__}"
	case "$cmd" in
		(activate | deactivate) __conda_activate "$@" ;;
		(install | update | upgrade | remove | uninstall) __conda_exe "$@" || \return
			__conda_reactivate ;;
		(*) __conda_exe "$@" ;;
	esac
}
/opt/anaconda3/envs/p4env311/bin/python
/opt/anaconda3/envs/p4env311/bin/psi4
conda list
# packages in environment at /opt/anaconda3/envs/p4env311:
#
# Name                    Version                   Build  Channel
annotated-types           0.7.0              pyhd8ed1ab_0    conda-forge
appdirs                   1.4.4              pyh9f0ad1d_0    conda-forge
appnope                   0.1.4              pyhd8ed1ab_0    conda-forge
asttokens                 2.4.1              pyhd8ed1ab_0    conda-forge
brotli                    1.0.9                h80987f9_8  
brotli-bin                1.0.9                h80987f9_8  
bzip2                     1.0.8                h93a5062_5    conda-forge
ca-certificates           2024.7.4             hf0a4a13_0    conda-forge
certifi                   2024.7.4        py311hca03da5_0  
cffi                      1.16.0          py311h4a08483_0    conda-forge
comm                      0.2.2              pyhd8ed1ab_0    conda-forge
contourpy                 1.0.5           py311h48ca7d4_0  
cycler                    0.11.0             pyhd3eb1b0_0  
debugpy                   1.8.2           py311hb9542d7_0    conda-forge
decorator                 5.1.1              pyhd8ed1ab_0    conda-forge
dftd3-python              1.0.0           py311h1a911b7_2    conda-forge
dkh                       1.2                  h587b571_0    conda-forge
exceptiongroup            1.2.0              pyhd8ed1ab_2    conda-forge
executing                 2.0.1              pyhd8ed1ab_0    conda-forge
flexcache                 0.3                pyhd8ed1ab_0    conda-forge
flexparser                0.3.1              pyhd8ed1ab_0    conda-forge
fonttools                 4.51.0          py311h80987f9_0  
freetype                  2.12.1               hadb7bae_2    conda-forge
gau2grid                  2.0.7                h03532ee_3    conda-forge
gtest                     1.14.0               h420ef59_2    conda-forge
importlib-metadata        8.0.0              pyha770c72_0    conda-forge
importlib_metadata        8.0.0                hd8ed1ab_0    conda-forge
ipykernel                 6.29.5             pyh57ce528_0    conda-forge
ipython                   8.26.0             pyh707e725_0    conda-forge
jedi                      0.19.1             pyhd8ed1ab_0    conda-forge
jupyter_client            8.6.2              pyhd8ed1ab_0    conda-forge
jupyter_core              5.7.2           py311h267d04e_0    conda-forge
kiwisolver                1.4.4           py311h313beb8_0  
krb5                      1.21.3               h237132a_0    conda-forge
lcms2                     2.16                 ha0e7c42_0    conda-forge
lerc                      4.0.0                h9a09cb3_0    conda-forge
libblas                   3.9.0           22_osxarm64_openblas    conda-forge
libbrotlicommon           1.0.9                h80987f9_8  
libbrotlidec              1.0.9                h80987f9_8  
libbrotlienc              1.0.9                h80987f9_8  
libcblas                  3.9.0           22_osxarm64_openblas    conda-forge
libcxx                    18.1.8               h167917d_0    conda-forge
libdeflate                1.20                 h93a5062_0    conda-forge
libecpint                 1.0.7               h6597342_10    conda-forge
libedit                   3.1.20191231         hc8eb9b7_2    conda-forge
libexpat                  2.6.2                hebf3989_0    conda-forge
libffi                    3.4.2                h3422bc3_5    conda-forge
libgfortran               5.0.0           13_2_0_hd922786_3    conda-forge
libgfortran5              13.2.0               hf226fd6_3    conda-forge
libint                    2.7.3dev1            h8694fdf_0    conda-forge/label/libint_dev
libjpeg-turbo             3.0.3                h80987f9_0  
liblapack                 3.9.0           22_osxarm64_openblas    conda-forge
libopenblas               0.3.27          openmp_h517c56d_1    conda-forge
libpcm                    1.2.3                ha82066f_8    conda-forge
libpng                    1.6.43               h091b4b1_0    conda-forge
libsodium                 1.0.18               h27ca646_1    conda-forge
libsqlite                 3.46.0               hfb93653_0    conda-forge
libtiff                   4.6.0                h07db509_3    conda-forge
libwebp-base              1.4.0                h93a5062_0    conda-forge
libxc-c                   6.2.2            cpu_hbc0346d_4    conda-forge
libxcb                    1.16                 hf2054a2_0    conda-forge
libzlib                   1.3.1                hfb2fe0b_1    conda-forge
llvm-openmp               18.1.8               hde57baf_0    conda-forge
matplotlib                3.8.4           py311hca03da5_0  
matplotlib-base           3.8.4           py311h000fb6e_2    conda-forge
matplotlib-inline         0.1.7              pyhd8ed1ab_0    conda-forge
mctc-lib                  0.3.1                h1b58363_0    conda-forge
msgpack-python            1.0.8           py311h6bde47b_0    conda-forge
ncurses                   6.5                  hb89a1cb_0    conda-forge
nest-asyncio              1.6.0              pyhd8ed1ab_0    conda-forge
networkx                  3.3                pyhd8ed1ab_1    conda-forge
numpy                     2.0.0           py311h4268184_0    conda-forge
openjpeg                  2.5.2                h9f1df11_0    conda-forge
openssl                   3.3.1                hfb2fe0b_1    conda-forge
optking                   0.2.1              pyhd8ed1ab_0    conda-forge
packaging                 24.1               pyhd8ed1ab_0    conda-forge
parso                     0.8.4              pyhd8ed1ab_0    conda-forge
pcmsolver                 1.2.3                      py_9    conda-forge
pexpect                   4.9.0              pyhd8ed1ab_0    conda-forge
pickleshare               0.7.5                   py_1003    conda-forge
pillow                    10.4.0          py311hd7951ec_0    conda-forge
pint                      0.24.1             pyhd8ed1ab_1    conda-forge
pip                       24.0               pyhd8ed1ab_0    conda-forge
platformdirs              4.2.2              pyhd8ed1ab_0    conda-forge
prompt-toolkit            3.0.47             pyha770c72_0    conda-forge
psi4                      1.9             py311he858063_0    conda-forge
psutil                    6.0.0           py311hd3f4193_0    conda-forge
pthread-stubs             0.3                  h1a28f6b_1  
ptyprocess                0.7.0              pyhd3deb0d_0    conda-forge
pugixml                   1.14                 h13dd4ca_0    conda-forge
pure_eval                 0.2.2              pyhd8ed1ab_0    conda-forge
py-cpuinfo                9.0.0              pyhd8ed1ab_0    conda-forge
pybind11-abi              4                    hd8ed1ab_3    conda-forge
pycparser                 2.22               pyhd8ed1ab_0    conda-forge
pydantic                  2.8.2              pyhd8ed1ab_0    conda-forge
pydantic-core             2.20.1          py311h98c6a39_0    conda-forge
pygments                  2.18.0             pyhd8ed1ab_0    conda-forge
pyparsing                 3.0.9           py311hca03da5_0  
python                    3.11.9          h932a869_0_cpython    conda-forge
python-dateutil           2.9.0              pyhd8ed1ab_0    conda-forge
python_abi                3.11                    4_cp311    conda-forge
pyyaml                    6.0.1           py311heffc1b2_1    conda-forge
pyzmq                     26.0.3          py311h9bed540_0    conda-forge
qcelemental               0.28.0             pyhd8ed1ab_0    conda-forge
qcengine                  0.30.0             pyhd8ed1ab_0    conda-forge
readline                  8.2                  h92ec313_1    conda-forge
scipy                     1.14.0          py311hceeca8c_1    conda-forge
setuptools                70.3.0             pyhd8ed1ab_0    conda-forge
simple-dftd3              1.0.0                h22a4c5e_0    conda-forge
six                       1.16.0             pyh6c4a22f_0    conda-forge
stack_data                0.6.2              pyhd8ed1ab_0    conda-forge
tk                        8.6.13               h5083fa2_1    conda-forge
toml-f                    0.4.2                h1ed020f_0    conda-forge
tornado                   6.4.1           py311hd3f4193_0    conda-forge
traitlets                 5.14.3             pyhd8ed1ab_0    conda-forge
typing-extensions         4.12.2               hd8ed1ab_0    conda-forge
typing_extensions         4.12.2             pyha770c72_0    conda-forge
tzdata                    2024a                h0c530f3_0    conda-forge
unicodedata2              15.1.0          py311h80987f9_0  
wcwidth                   0.2.13             pyhd8ed1ab_0    conda-forge
wheel                     0.43.0             pyhd8ed1ab_1    conda-forge
xorg-libxau               1.0.11               hb547adb_0    conda-forge
xorg-libxdmcp             1.1.3                h27ca646_0    conda-forge
xz                        5.2.6                h57fd34a_0    conda-forge
yaml                      0.2.5                h3422bc3_2    conda-forge
zeromq                    4.3.5                hcc0f68c_4    conda-forge
zipp                      3.19.2             pyhd8ed1ab_0    conda-forge
zstd                      1.5.6                hb46c0d2_0    conda-forge

Any help would be greatly appreciated as I have run out of ideas as to what could be causing the issue. Please let me know if any additional information is needed.

check your numpy version. I suspect you’re ghitting PSA: Psi4 and numpy v2 · Issue #3184 · psi4/psi4 · GitHub . If you’ve somehow got np v2 installed, do conda install numpy=1 -c conda-forge in the env.

Thank you. That fixed it.

1 Like