quantumlib / OpenFermion-PySCF

OpenFermion plugin to interface with the electronic structure package PySCF.
Apache License 2.0
105 stars 44 forks source link

2 tests fail #65

Open yurivict opened 2 years ago

yurivict commented 2 years ago
========================================================================================== FAILURES ==========================================================================================
______________________________________________________________________________ test_load_molecular_hamiltonian _______________________________________________________________________________

src = '37316d06-b95c-4ffb-91d3-5beaeb5c9326.hdf5', dst = '/usr/local/lib/python3.9/site-packages/openfermion/testing/data/H1-Li1_sto-3g_singlet.hdf5'
copy_function = <function copy2 at 0x83487a790>

    def move(src, dst, copy_function=copy2):
        """Recursively move a file or directory to another location. This is
        similar to the Unix "mv" command. Return the file or directory's
        destination.

        If the destination is a directory or a symlink to a directory, the source
        is moved inside the directory. The destination path must not already
        exist.

        If the destination already exists but is not a directory, it may be
        overwritten depending on os.rename() semantics.

        If the destination is on our current filesystem, then rename() is used.
        Otherwise, src is copied to the destination and then removed. Symlinks are
        recreated under the new name if os.rename() fails because of cross
        filesystem renames.

        The optional `copy_function` argument is a callable that will be used
        to copy the source or it will be delegated to `copytree`.
        By default, copy2() is used, but any function that supports the same
        signature (like copy()) can be used.

        A lot more could be done here...  A look at a mv.c shows a lot of
        the issues this implementation glosses over.

        """
        sys.audit("shutil.move", src, dst)
        real_dst = dst
        if os.path.isdir(dst):
            if _samefile(src, dst):
                # We might be on a case insensitive filesystem,
                # perform the rename anyway.
                os.rename(src, dst)
                return

            # Using _basename instead of os.path.basename is important, as we must
            # ignore any trailing slash to avoid the basename returning ''
            real_dst = os.path.join(dst, _basename(src))

            if os.path.exists(real_dst):
                raise Error("Destination path '%s' already exists" % real_dst)
        try:
>           os.rename(src, real_dst)
E           PermissionError: [Errno 13] Permission denied: '37316d06-b95c-4ffb-91d3-5beaeb5c9326.hdf5' -> '/usr/local/lib/python3.9/site-packages/openfermion/testing/data/H1-Li1_sto-3g_singlet.hdf5'

/usr/local/lib/python3.9/shutil.py:825: PermissionError

During handling of the above exception, another exception occurred:

    def test_load_molecular_hamiltonian():
        geometry = [('Li', (0., 0., 0.)), ('H', (0., 0., 1.4))]

>       lih_hamiltonian = openfermionpyscf.generate_molecular_hamiltonian(
                geometry, 'sto-3g', 1, 0, 2, 2)

openfermionpyscf/_run_pyscf_test.py:20: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
openfermionpyscf/_run_pyscf.py:237: in generate_molecular_hamiltonian
    molecule = run_pyscf(
openfermionpyscf/_run_pyscf.py:205: in run_pyscf
    pyscf_molecular_data.save()
/usr/local/lib/python3.9/site-packages/openfermion/chem/molecular_data.py:717: in save
    shutil.move("{}.hdf5".format(tmp_name), "{}.hdf5".format(self.filename))
/usr/local/lib/python3.9/shutil.py:845: in move
    copy_function(src, real_dst)
/usr/local/lib/python3.9/shutil.py:444: in copy2
    copyfile(src, dst, follow_symlinks=follow_symlinks)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

src = '37316d06-b95c-4ffb-91d3-5beaeb5c9326.hdf5', dst = '/usr/local/lib/python3.9/site-packages/openfermion/testing/data/H1-Li1_sto-3g_singlet.hdf5'

    def copyfile(src, dst, *, follow_symlinks=True):
        """Copy data from src to dst in the most efficient way possible.

        If follow_symlinks is not set and src is a symbolic link, a new
        symlink will be created instead of copying the file it points to.

        """
        sys.audit("shutil.copyfile", src, dst)

        if _samefile(src, dst):
            raise SameFileError("{!r} and {!r} are the same file".format(src, dst))

        file_size = 0
        for i, fn in enumerate([src, dst]):
            try:
                st = _stat(fn)
            except OSError:
                # File most likely does not exist
                pass
            else:
                # XXX What about other special files? (sockets, devices...)
                if stat.S_ISFIFO(st.st_mode):
                    fn = fn.path if isinstance(fn, os.DirEntry) else fn
                    raise SpecialFileError("`%s` is a named pipe" % fn)
                if _WINDOWS and i == 0:
                    file_size = st.st_size

        if not follow_symlinks and _islink(src):
            os.symlink(os.readlink(src), dst)
        else:
            with open(src, 'rb') as fsrc:
                try:
>                   with open(dst, 'wb') as fdst:
E                   PermissionError: [Errno 13] Permission denied: '/usr/local/lib/python3.9/site-packages/openfermion/testing/data/H1-Li1_sto-3g_singlet.hdf5'

/usr/local/lib/python3.9/shutil.py:266: PermissionError
------------------------------------------------------------------------------------ Captured stdout call ------------------------------------------------------------------------------------
overwrite output file: addopts=
_______________________________________________________________________________________ test_run_pyscf _______________________________________________________________________________________

src = 'e420e408-8627-4146-8f01-6d197ff47f0c.hdf5', dst = '/usr/local/lib/python3.9/site-packages/openfermion/testing/data/H2_6-31g_singlet.hdf5'
copy_function = <function copy2 at 0x83487a790>

    def move(src, dst, copy_function=copy2):
        """Recursively move a file or directory to another location. This is
        similar to the Unix "mv" command. Return the file or directory's
        destination.

        If the destination is a directory or a symlink to a directory, the source
        is moved inside the directory. The destination path must not already
        exist.

        If the destination already exists but is not a directory, it may be
        overwritten depending on os.rename() semantics.

        If the destination is on our current filesystem, then rename() is used.
        Otherwise, src is copied to the destination and then removed. Symlinks are
        recreated under the new name if os.rename() fails because of cross
        filesystem renames.

        The optional `copy_function` argument is a callable that will be used
        to copy the source or it will be delegated to `copytree`.
        By default, copy2() is used, but any function that supports the same
        signature (like copy()) can be used.

        A lot more could be done here...  A look at a mv.c shows a lot of
        the issues this implementation glosses over.

        """
        sys.audit("shutil.move", src, dst)
        real_dst = dst
        if os.path.isdir(dst):
            if _samefile(src, dst):
                # We might be on a case insensitive filesystem,
                # perform the rename anyway.
                os.rename(src, dst)
                return

            # Using _basename instead of os.path.basename is important, as we must
            # ignore any trailing slash to avoid the basename returning ''
            real_dst = os.path.join(dst, _basename(src))

            if os.path.exists(real_dst):
                raise Error("Destination path '%s' already exists" % real_dst)
        try:
>           os.rename(src, real_dst)
E           PermissionError: [Errno 13] Permission denied: 'e420e408-8627-4146-8f01-6d197ff47f0c.hdf5' -> '/usr/local/lib/python3.9/site-packages/openfermion/testing/data/H2_6-31g_singlet.hdf5'

/usr/local/lib/python3.9/shutil.py:825: PermissionError

During handling of the above exception, another exception occurred:

    def test_run_pyscf():
>       new_mole = run_pyscf(molecule,
                             run_scf=True,
                             run_mp2=True,
                             run_cisd=True,
                             run_ccsd=True,
                             run_fci=True,
                             verbose=1)

openfermionpyscf/tests/_run_pyscf_test.py:32: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
openfermionpyscf/_run_pyscf.py:205: in run_pyscf
    pyscf_molecular_data.save()
/usr/local/lib/python3.9/site-packages/openfermion/chem/molecular_data.py:717: in save
    shutil.move("{}.hdf5".format(tmp_name), "{}.hdf5".format(self.filename))
/usr/local/lib/python3.9/shutil.py:845: in move
    copy_function(src, real_dst)
/usr/local/lib/python3.9/shutil.py:444: in copy2
    copyfile(src, dst, follow_symlinks=follow_symlinks)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

src = 'e420e408-8627-4146-8f01-6d197ff47f0c.hdf5', dst = '/usr/local/lib/python3.9/site-packages/openfermion/testing/data/H2_6-31g_singlet.hdf5'

    def copyfile(src, dst, *, follow_symlinks=True):
        """Copy data from src to dst in the most efficient way possible.

        If follow_symlinks is not set and src is a symbolic link, a new
        symlink will be created instead of copying the file it points to.

        """
        sys.audit("shutil.copyfile", src, dst)

        if _samefile(src, dst):
            raise SameFileError("{!r} and {!r} are the same file".format(src, dst))

        file_size = 0
        for i, fn in enumerate([src, dst]):
            try:
                st = _stat(fn)
            except OSError:
                # File most likely does not exist
                pass
            else:
                # XXX What about other special files? (sockets, devices...)
                if stat.S_ISFIFO(st.st_mode):
                    fn = fn.path if isinstance(fn, os.DirEntry) else fn
                    raise SpecialFileError("`%s` is a named pipe" % fn)
                if _WINDOWS and i == 0:
                    file_size = st.st_size

        if not follow_symlinks and _islink(src):
            os.symlink(os.readlink(src), dst)
        else:
            with open(src, 'rb') as fsrc:
                try:
>                   with open(dst, 'wb') as fdst:
E                   PermissionError: [Errno 13] Permission denied: '/usr/local/lib/python3.9/site-packages/openfermion/testing/data/H2_6-31g_singlet.hdf5'

/usr/local/lib/python3.9/shutil.py:266: PermissionError
------------------------------------------------------------------------------------ Captured stdout call ------------------------------------------------------------------------------------
overwrite output file: addopts=
Hartree-Fock energy for H2_6-31g_singlet (2 electrons) is -1.1267339671165666.
MP2 energy for H2_6-31g_singlet (2 electrons) is -1.1441304105295214.
CISD energy for H2_6-31g_singlet (2 electrons) is -1.1516827321098897.
CCSD energy for H2_6-31g_singlet (2 electrons) is -1.1516828675117317.
FCI energy for H2_6-31g_singlet (2 electrons) is -1.1516827321098888.
====================================================================================== warnings summary ======================================================================================
openfermionpyscf/_pyscf_molecular_data.py:72
  /disk-samsung/freebsd-ports/science/py-OpenFermion-PySCF/work-py39/OpenFermion-PySCF-0.5/openfermionpyscf/_pyscf_molecular_data.py:72: DeprecationWarning: invalid escape sequence \i
    """A 4-dimension array for electron repulsion integrals in the MO

../../../../../../usr/local/lib/python3.9/site-packages/pyscf/__init__.py:93
  /usr/local/lib/python3.9/site-packages/pyscf/__init__.py:93: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    if LooseVersion(numpy.__version__) <= '1.8.0':

../../../../../../usr/local/lib/python3.9/site-packages/setuptools/_distutils/version.py:346
../../../../../../usr/local/lib/python3.9/site-packages/setuptools/_distutils/version.py:346
../../../../../../usr/local/lib/python3.9/site-packages/setuptools/_distutils/version.py:346
../../../../../../usr/local/lib/python3.9/site-packages/setuptools/_distutils/version.py:346
../../../../../../usr/local/lib/python3.9/site-packages/setuptools/_distutils/version.py:346
../../../../../../usr/local/lib/python3.9/site-packages/setuptools/_distutils/version.py:346
../../../../../../usr/local/lib/python3.9/site-packages/setuptools/_distutils/version.py:346
../../../../../../usr/local/lib/python3.9/site-packages/setuptools/_distutils/version.py:346
  /usr/local/lib/python3.9/site-packages/setuptools/_distutils/version.py:346: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    other = LooseVersion(other)

../../../../../../usr/local/lib/python3.9/site-packages/pyscf/__init__.py:99
  /usr/local/lib/python3.9/site-packages/pyscf/__init__.py:99: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    elif '1.16.2' <= LooseVersion(numpy.__version__) < '1.18':

../../../../../../usr/local/lib/python3.9/site-packages/numpy/ctypeslib.py:137
  /usr/local/lib/python3.9/site-packages/numpy/ctypeslib.py:137: DeprecationWarning: 

    `numpy.distutils` is deprecated since NumPy 1.23.0, as a result
    of the deprecation of `distutils` itself. It will be removed for
    Python >= 3.12. For older Python versions it will remain present.
    It is recommended to use `setuptools < 60.0` for those Python versions.
    For more details, see:
      https://numpy.org/devdocs/reference/distutils_status_migration.html 

    from numpy.distutils.misc_util import get_shared_lib_extension

../../../../../../usr/local/lib/python3.9/site-packages/pyscf/lib/numpy_helper.py:884
../../../../../../usr/local/lib/python3.9/site-packages/pyscf/lib/numpy_helper.py:884
  /usr/local/lib/python3.9/site-packages/pyscf/lib/numpy_helper.py:884: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    if LooseVersion(numpy.__version__) <= LooseVersion('1.6.0'):

../../../../../../usr/local/lib/python3.9/site-packages/matplotlib/__init__.py:152
../../../../../../usr/local/lib/python3.9/site-packages/matplotlib/__init__.py:152
../../../../../../usr/local/lib/python3.9/site-packages/matplotlib/__init__.py:152
../../../../../../usr/local/lib/python3.9/site-packages/matplotlib/__init__.py:152
../../../../../../usr/local/lib/python3.9/site-packages/matplotlib/__init__.py:152
  /usr/local/lib/python3.9/site-packages/matplotlib/__init__.py:152: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    if LooseVersion(module.__version__) < minver:

../../../../../../usr/local/lib/python3.9/site-packages/openfermion/hamiltonians/hartree_fock.py:11
  /usr/local/lib/python3.9/site-packages/openfermion/hamiltonians/hartree_fock.py:11: DeprecationWarning: Please use `OptimizeResult` from the `scipy.optimize` namespace, the `scipy.optimize.optimize` namespace is deprecated.
    from scipy.optimize.optimize import OptimizeResult

../../../../../../usr/local/lib/python3.9/site-packages/pyscf/mp/mp2.py:357
../../../../../../usr/local/lib/python3.9/site-packages/pyscf/mp/mp2.py:357
../../../../../../usr/local/lib/python3.9/site-packages/pyscf/mp/mp2.py:357
../../../../../../usr/local/lib/python3.9/site-packages/pyscf/mp/mp2.py:357
openfermionpyscf/tests/_pyscf_molecular_data_test.py::test_accessing_rdm
openfermionpyscf/tests/_run_pyscf_test.py::test_run_pyscf
openfermionpyscf/tests/_run_pyscf_test.py::test_run_pyscf
openfermionpyscf/tests/_run_pyscf_test.py::test_run_pyscf
openfermionpyscf/tests/_run_pyscf_test.py::test_run_pyscf
  /usr/local/lib/python3.9/site-packages/pyscf/mp/mp2.py:357: DeprecationWarning: `np.bool` is a deprecated alias for the builtin `bool`. To silence this warning, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.
  Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
    moidx = numpy.ones(mp.mo_occ.size, dtype=numpy.bool)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
==================================================================== 2 failed, 2 passed, 29 warnings in 93.82s (0:01:33) =====================================================================
*** Error code 1

Version: 0.5 Python-3.9 FreeBSD 13.1