Compiling Py-ChemShell-23.0.1 on RHEL Compatible OS

Hi, We have been trying to compile ChemShell-py-23.0.1 from the last couple of days. Although our machine has python3.10 version but the CMake FinePython module is not selecting the python version. This is the error massage we are getting. Could someone help us to fix this issue.

"CMake Error at /usr/share/cmake3/Modules/FindPackageHandleStandardArgs.cmake:164 (message):
Could NOT find PythonLibs (missing: PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS)
(Required is at least version “3.8”)
Call Stack (most recent call first):
/usr/share/cmake3/Modules/FindPackageHandleStandardArgs.cmake:445 (_FPHSA_FAILURE_MESSAGE)
/usr/share/cmake3/Modules/FindPythonLibs.cmake:310 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
CMakeLists.txt:404 (find_package)

– Configuring incomplete, errors occurred!
See also “/home/aleph/fd/chem1680/chemsh-py-23.0.1/chemsh/CMakeFiles/CMakeOutput.log”.
Traceback (most recent call last):
File “/home/aleph/fd/chem1680/chemsh-py-23.0.1/./setup”, line 1095, in
main()
File “/home/aleph/fd/chem1680/chemsh-py-23.0.1/./setup”, line 1073, in main
subprocess.run(getCMakeCmd(args),
File “/home/aleph/fd/chem1680/miniforge3/envs/chemshell/lib/python3.10/subprocess.py”, line 526, in run
raise CalledProcessError(retcode, process.args,"

Thanks,
Hafiz

Hi Hafiz,

Sorry you are running into issues installing Py-ChemShell. Given that the problem is with CMake, may I ask what version of CMake you are using? One possible snag is when the version of CMake is older than the version of Python that it is trying to find. If you are able to try a more recent version of CMake, this may help with this problem.

Please let me know if this suggestion does not help and I will try and work with you further to resolve this issue. In this case, it would be helpful to have the full command you gave to ./setup, along with the full terminal output from this.

All the best,
Tom

Hi Tom,

Thank you for your prompt response. I updated the CMake version 3.29.3 and provided the Python path to the to it explicitly. Using this command.

./setup --mpi --fc mpiifort --cc mpiicc --cpc mpiicpc --pythonlib /home/aleph/fd/chem1680/miniforge3/lib/libpython3.10.so --pythondir /home/aleph/fd/chem1680/miniforge3/include/python3.10/

It seems like ChemShell is complied without any error. But When I tried to do test it, it failed “Failures: 314 Passes: 0 Unsupported: 0 Unknown: 0”
Is it the right installation or I have missed something.?

Thanks,
Hafiz

Hi Hafiz,

That setup command looks reasonable to me. Please let me know the answers to the following questions:

  1. What files do you have in chemsh-py/bin? This is where a successful build should place ChemShell. There should be two files called chemsh and chemsh.x inside a subdirectory named after the type of system you have built for (e.g. intel)
  2. What command did you give to run the tests?
  3. What is the contents of chemsh-py/tests/fragment/connect_ethane.err and chemsh-py/tests/fragment/connect_ethane.log?

All the best,
Tom

Hi Tom,

1- chemsh-py/bin/intel folder have two file, chemsh and chemsh.x.
when I test this chemsh -h it gives me all the Available options which mean the ChemShell is compiled properly.

  1. I went to the folder tests and use ./test command. It gives me this
" ======================================================================
 Py-ChemShell test suite
 ======================================================================

 Searching for executable chemsh ...
 Testing executable: /home/aleph/fd/chem1680/chemsh-py-23.0.1/bin/intel/chemsh

 Running test sets: all

 Test directory: fragment
  - connect_ethane.py -------- FAILED --------- F  0.05
------ all others softwares showed failed status
----------------------------------------------------------------------
 Failures: 314  Passes:   0  Unsupported:   0  Unknown:   0
 ----------------------------------------------------------------------
  1. The content of chemsh-py/tests/fragment/connect_ethane.err is
/home/aleph/fd/chem1680/chemsh-py-23.0.1/bin/intel/chemsh.x: error while loading shared libraries: libmkl_intel_lp64.so.2: cannot open shared object file: No such file or directory
0.05user 0.05system 0:00.14elapsed 74%CPU (0avgtext+0avgdata 8656maxresident)k
0inputs+32outputs (0major+6768minor)pagefaults 0swaps

similarly, chemsh-py/tests/fragment/connect_ethane.log is this

 >>> Executing command:
 mpirun -n 1 /home/aleph/fd/chem1680/chemsh-py-23.0.1/bin/intel/chemsh.x -dbg 0 connect_ethane.py
 >>> Serial run failed. Exiting...
 Exit code: 127

Hafiz

Hi Hafiz,

Thanks for the quick response, there seems to be a problem linking to the Intel MKL math library. There is an option -mkl to the setup script that can be pointed to this and defaults to /opt/intel/mkl/lib/intel64 . Is this where mkl is installed on your system?

I would like to improve the automatic linking of intel libraries, so please do let me know what version of the intel compilers you have installed.

All the best,
Tom

Hi Tom,

In my system directory I have two intel path, but the version is same intel64.
/opt/intel/mkl/lib/intel64_lin/
/opt/intel/mkl/lib/intel64/

I am not sure, if there any difference or if both are the same.

Thanks,
Hafiz

Hi Hafiz,

I hope you had a good bank holiday weekend.

The ChemShell setup tool will try and set the correct default path to the MKL library based on the version of your intel compiler, potentially this is not working correctly for your install. Please look in your _chemsh_build.log file (in the same directory as setup) which records the build parameters used by the script. Please find the bottom entry here and look at the value of -DMKL given in the CMake command at the bottom of the file.

Based on what you’ve said I think the correct value in your case will be /opt/intel/mkl/lib/intel64, but one possibility is that this has been set to /opt/intel/oneapi/mkl/latest/lib/intel64, which is the default for new Intel oneAPI installs.

The default value can be overwritten by setting the option directly to the setup script e.g. ./setup -mkl /opt/intel/mkl/lib/intel64/. When configured correctly, this path should point to a folder that explicitly contains libmkl_intel_lp64.so.2

Let me know if this helps.

All the best,
Tom

Hi Tom,

I tired to recompile with your suggestions. As earlier it compiled without any error but when I do test, it’s giving same error.
The content of _chemsh_build.log is this, it seems like with -mkl command it’s still not taking the right path.

========================

Wed May 29 16:29:49 2024

========================

By chem1680

./setup --mpi --fc mpiifort --cc mpiicc --cpc mpiicpc --pythonlib /home/aleph/fd/chem1680/miniforge3/lib/libpython3.10.so --pythondir /home/aleph/fd/chem1680/miniforge3/include/python3.10/ -mkl /opt/intel/mkl/lib/intel64/

cmake -DCMAKE_Fortran_COMPILER:FILEPATH=mpiifort -DCMAKE_C_COMPILER:FILEPATH=mpiicc -DCHEMSH_ARCH:STRING= -DCMAKE_CXX_COMPILER:FILEPATH=mpiicpc -DHOSTNAME:STRING=aleph -DCHEMSH_MAKE_NJOBS:STRING=4 -DCHEMSH_64_BIT:BOOL=OFF -DCHEMSH_Fortran_FLAGS:STRING="" -DCHEMSH_C_FLAGS:STRING="" -DCHEMSH_LD_FLAGS:STRING="" --no-warn-unused-cli -DCHEMSH_COMPILE_OPT_LEVEL:STRING=2 -DLD_LIBRARY_PATH="-L/opt/intel/lib/intel64" -DCHEMSH_LD_LIBRARY_PATH:PATH="/opt/intel/lib/intel64" -DPLATFORM:STRING=ubuntu -DPYTHON_LIBRARY=/home/aleph/fd/chem1680/miniforge3/lib/libpython3.10.so -DPYTHON_INCLUDE_DIR=/home/aleph/fd/chem1680/miniforge3/include/python3.10/ -DPYTHONPATH= -DATEN_RECOMPILE:BOOL=OFF -DCASTEP_RECOMPILE:BOOL=OFF -DCHARM++_RECOMPILE:BOOL=OFF -DCP2K_RECOMPILE:BOOL=OFF -DDL_MONTE_RECOMPILE:BOOL=OFF -DDL_POLY_RECOMPILE:BOOL=OFF -DGA_RECOMPILE:BOOL=OFF -DGAMESS-UK_RECOMPILE:BOOL=OFF -DGULP_RECOMPILE:BOOL=OFF -DLSDALTON_RECOMPILE:BOOL=OFF -DNAMD_RECOMPILE:BOOL=OFF -DNWCHEM_RECOMPILE:BOOL=OFF -DRECOMPILE_WITHOUT_DOWNLOAD:BOOL=OFF -DGA= -DGA_RECONFIGURE=ON -DDL_FIELD= -DGULP:PATH= -DGAMESS-UK:PATH= -DFHIAIMS:PATH= -DMATH_HEADER_MACROS="" -DBLAS_DIR:PATH=/opt/intel/mkl/lib/intel64/ -DLAPACK_DIR:PATH=/opt/intel/mkl/lib/intel64/ -DFFTW_DIR:PATH=/opt/intel/oneapi/mkl/latest/interfaces/fftw3xf -DFFTW_INCLUDE_DIR:PATH=/opt/intel/oneapi/mkl/latest/include/fftw -DScaLAPACK_DIR:PATH=/opt/intel/mkl/lib/intel64/ -DMKL=/opt/intel/compilers_and_libraries_2019.1.144/linux/mkl/lib/intel64_lin -DMKL_FLAGS:STRING="" -DMKL_COMPILE_FLAGS:STRING="" -DMPI:BOOL=ON -DMPIEXEC_EXECUTABLE:FILEPATH=mpirun -DMPI_LIB_PATH:PATH="/opt/intel/oneapi/mpi/latest/lib;/opt/intel/oneapi/mpi/latest/lib/release" -DMPI_INCLUDE_PATH:PATH=/opt/intel/oneapi/mpi/latest/include --no-warn-unused-cli -Wno-dev .

Thanks,
Hafiz

Hi Hafiz,

Sorry that suggestion didn’t help.

  1. Are you installing on a local machine? Then you might need to source the Intel compilers before you run ChemShell. (On my machine I need to run source ~/intel/oneapi/setvars.sh to do this)
  2. Are you installing on a HPC cluster and having to load modules to get access to the intel compilers? If this is the case, you may need to specify the modules that need to be loaded to the ./setup script using the option --load-modules and specifying a list.
  3. What version of Intel oneAPI are you using? It might be easier to get the build process to work correctly with a newer version, personally I am using 2024.0.

Le me know how you get on.

All the best,
Tom

Hi Tom,

I have been compiling ChemShell on our HPC cluster, and it now seems to be working.

However, it has only passed a few tests with modules such as fragment and cluster, and with two QM packages, ORCA and NWChem. It has not passed any tests with MM packages. I am wondering if this is because we need to link ChemShell with an external MM package and giving this error during test.

Test directory: dl_poly
  - h2o_dimer.py M unsupported test: external code not found 0.74
  - h2o_dimer_opt.py M unsupported test: external code not found 0.90
Test directory: dl_find
  - c4h6_min_lbfgs_cartesians.py M unsupported test: external code not found 0.79
  - c4h6_min_cartesians_constraints.py M unsupported test: external code not found 0.85

Thanks,
Hafiz

Hi Hafiz,

Glad to hear you have a build passing the basic tests. ChemShell has two different modes for interacting with external codes, they can either be called via system commands or invoked as a directly-linked library if the source code is available.

If a directly linked library is not built when ChemShell is compiled, it will try and make a system command. So your setup must have both ORCA and NWChem (specifically orca and nwchem are in available in your system path). Do you have any MM codes installed that you expected ChemShell to be able to call?

If you want to add directly linked libraries, you will need to give them as additional commands to the setup script. In some cases, ChemShell will then automatically fetch the source code and build them, but some licences do not allow us to distribute the source code and you must supply your own copy.

To add some MM codes as linked libraries, you should be able to run ./setup with the extra options --dl_poly --gulp /path/to/gulp-6.2.tgz, where DL_POLY will be loaded automatically, but you will need to provide a copy of the GULP source code yourself. Please consult Installing ChemShell — Py-ChemShell 23.0.0 documentation for details on linking specific QM and MM codes.

Let me know if you have any further questions.

All the best,
Tom

Dear Tom,

Yes, you are absolutely right.

Other software packages are working fine, except for DL_POLY . Although its executable is available in the PATH, it does not seem to be functioning correctly.

( DLPOLY.Z -h
Usage: DLPOLY.Z -c CONTROL_FILENAME -o OUTPUT_FILENAME
Each of -c or -o options are optional
use -h to see this help
use --help to search help
STOP 0)
Test directory: dl_poly
  - h2o_dimer.py -------- FAILED --------- F system msg for write_line failure : Bad file descriptor 0.69
  - h2o_dimer_opt.py -------- FAILED --------- F   File "/home/aleph/fd/chem1680/miniforge3/lib/python3.10/_sitebuiltins.py", line 26, in __call__ 0.68
  - butanol.py -------- FAILED --------- F system msg for write_line failure : Bad file descriptor 0.66
  - butanol_opt.py -------- FAILED --------- F   File "/home/aleph/fd/chem1680/miniforge3/lib/python3.10/_sitebuiltins.py", line 26, in __call__ 0.77
  - water_atom_cutoff.py -------- FAILED --------- F system msg for write_line failure : Bad file descriptor 0.68

Thanks,
Hafiz

Hi Hafiz,

There does seem to be a more specific problem there, would you be able to post the contents of your chemsh-py/tests/dl_poly/h2o_dimer.log and chemsh-py/tests/dl_poly/h2o_dimer.err here? ChemShell should be trying to call DLPOLY.Z, but you seem to be getting an error about a bad file descriptor.

EDIT: Also it would be good to check the version of DL_POLY you are using, the manual states “DL_POLY v5 or later may be linked to ChemShell”, but it is possible this versioning requirement applies to standalone versions too, if this turns out to be the problem I will update the manual.

All the best,
Tom

Sure,

here is chemsh-py/tests/dl_poly/h2o_dimer.log

>>> Executing command:
 mpirun -n 1 /home/aleph/fd/chem1680/chemsh-py-23.0.1/bin/intel/chemsh.x -dbg 0 h2o_dimer.py


 ======================================================================
 Py-ChemShell 2023 (version 23.0.1)
 ----------------------------------------------------------------------
 Thu May 30 16:23:28 2024
 Compiler intel; Python 3.10.13; Numpy 1.26.4
 Debug level 0
 ----------------------------------------------------------------------
 Please cite Py-ChemShell as:
   Y. Lu, M.R. Farrow, P. Fayon, A.J. Logsdail, A.A. Sokol, C.R.A.
   Catlow, P. Sherwood, and T.W. Keal, J. Chem. Theory Comput. 2019,
   15, 1317-1328.
 ----------------------------------------------------------------------
 www.chemshell.org
 ======================================================================


 >>> Running single point calculation...

 +-------------------------------+
 |  ChemShell/DL_POLY Interface  |
 +-------------------------------+

 >>> Executing system call command for DL_POLY:
 DLPOLY.Z  > _dl_poly.out

 >>> chemsh.x ERROR: Failed running h2o_dimer.py

Traceback (most recent call last):
  File "h2o_dimer.py", line 14, in <module>
    sp.run()
  File "/home/aleph/fd/chem1680/chemsh-py-23.0.1/chemsh/dl_py2f/utils/miscutils.py", line 124, in wrapper
    result = proc(*args, **kwargs)
  File "/home/aleph/fd/chem1680/chemsh-py-23.0.1/chemsh/tasks/sp.py", line 85, in run
    self.theory.run(_gradients=self.gradients, **kwargs)
  File "/home/aleph/fd/chem1680/chemsh-py-23.0.1/chemsh/dl_py2f/utils/miscutils.py", line 124, in wrapper
    result = proc(*args, **kwargs)
  File "/home/aleph/fd/chem1680/chemsh-py-23.0.1/chemsh/interfaces/mm.py", line 147, in run
    ierror = run.run(self, cmdpath, stderr=self.logger, **kwargs)
  File "/home/aleph/fd/chem1680/chemsh-py-23.0.1/chemsh/dl_py2f/utils/miscutils.py", line 145, in wrapper
    result = proc(*args, **kwargs)
  File "/home/aleph/fd/chem1680/chemsh-py-23.0.1/chemsh/base/run.py", line 262, in run
    ierror = selectcases[type(cmdpath)](theory, cmdpath, options=options, **kwargs)
  File "/home/aleph/fd/chem1680/chemsh-py-23.0.1/chemsh/base/run.py", line 155, in runExec
    exit(ierror)
  File "/home/aleph/fd/chem1680/miniforge3/lib/python3.10/_sitebuiltins.py", line 26, in __call__
    raise SystemExit(code)
SystemExit: 1

 >>> Serial run failed. Exiting...

 Exit code: 112

and chemsh-py/tests/dl_poly/h2o_dimer.err

[cli_0]: write_line error; fd=9 buf=:cmd=init pmi_version=1 pmi_subversion=1

:

system msg for write_line failure : Bad file descriptor

[cli_0]: Unable to write to PMI_fd

[cli_0]: write_line error; fd=9 buf=:cmd=get_appnum

:

system msg for write_line failure : Bad file descriptor

Abort(1090575) on node 0 (rank 0 in comm 0): Fatal error in PMPI_Init: Other MPI error, error stack:

MPIR_Init_thread(143):

MPID_Init(1221)......:

MPIR_pmi_init(130)...: PMI_Get_appnum returned -1

[cli_0]: write_line error; fd=9 buf=:cmd=abort exitcode=1090575

:

system msg for write_line failure : Bad file descriptor

Attempting to use an MPI routine before initializing MPICH

0.69user 0.37system 0:01.31elapsed 81%CPU (0avgtext+0avgdata 74588maxresident)k

0inputs+56outputs (0major+27658minor)pagefaults 0swaps

Hi Hafiz,

I think that the issue here might be conflicting versions of MPI, did you compile ChemShell and DL_POLY with the same MPI versions?

All the best,
Tom

Yes, it was with same MPI version… Open MPI 5.0.1

Thanks,
Hafiz

Hi Hafiz,

The error message you shared references MPICH, so something involved with the run was compiled with MPICH rather than Open MPI. This will certainly cause a conflict. Either ChemShell or DL_POLY has linked to MPICH rather than Open MPI at some stage.

I wouldn’t expect you to see the same error if you add ./setup --dl_poly as an option to the build, as this should ensure that the same modules are used to compile both ChemShell and DL_POLY. Does this produce the same error for you?

I will do some further testing of DL_POLY tomorrow in any case, I haven’t tested a standalone build of DL_POLY recently.

All the best,
Tom

Hi Tom,

Yes, you’re right, it is an MPI conflict.

If I use ./setup --dl_poly , it gives the same error.

Although I am exporting the same version of MPI, Open MPI and Intel.

Thanks,
Hafiz

Hi Hafiz,

That’s frustrating, could you post me your chemsh-py/chemsh/interfaces/dl_poly/intel/src/CMakeCache.txt? We can have a look at what MPI variables were used to compile DL_POLY itself.

As an additional suggestion, is it possible to use ./setup --unload-modules in order to unload the MPICH install that is conflicting? Assuming that you have MPICH loaded in the default module environment.

All the best,
Tom