We have some python unit tests that use testing.posgresql, however I cannot get them to work for me on my machine (Windows 10). I get the above error about initdb needing postgresql but not being able to find it in the same directory. I can confirm they are both in the bin directory of the PostgresSQL installation, and I get the same error when trying to run initdb directly while in that directory. The bin and lib directories for this installation are also both in my path, and I get the correct location when running which initdb
or which postgres
I've tried a handful of things including all solutions proposed in threads with similar issues but nothing worked, it works on macOS and our github workflow. I have PostgresSQL 14 installed and I am using cygwin (although the exact same error appears when run in windows cmd), any help is appreciated.
Output when running initdb from the bin directory of the Postgres installation:
$ ./initdb -D example
The system cannot find the path specified.
child process exited with exit code 1
initdb: error: The program "postgres" is needed by initdb but was not found in the
same directory as "C:/Program Files/PostgreSQL/14/bin/initdb.exe".
Check your installation.
But a simple ls shows postgres.exe is indeed there:
$ ls
clusterdb.exe icutu67.dll libiconv-2.dll libxslt.dll pg_dump.exe pg_restore.exe psql.exe wxmsw313u_core_vc_x64_custom.dll
createdb.exe icuuc67.dll libintl-9.dll oid2name.exe pg_dumpall.exe pg_rewind.exe reindexdb.exe wxmsw313ud_aui_vc_x64_custom.dll
createuser.exe initdb.exe liblz4.dll pg_amcheck.exe pg_isolation_regress.exe pg_test_fsync.exe stackbuilder.exe wxmsw313ud_html_vc_x64_custom.dll
dropdb.exe isolationtester.exe libpgtypes.dll pg_archivecleanup.exe pg_isready.exe pg_test_timing.exe vacuumdb.exe wxmsw313ud_xrc_vc_x64_custom.dll
dropuser.exe libcrypto-1_1-x64.dll libpq.dll pg_basebackup.exe pg_receivewal.exe pg_upgrade.exe vacuumlo.exe zic.exe
ecpg.exe libcurl.dll libpq_pipeline.exe pg_checksums.exe pg_recvlogical.exe pg_verifybackup.exe wxbase313u_vc_x64_custom.dll zlib1.dll
icudt67.dll libcurl.lib libssl-1_1-x64.dll pg_config.exe pg_regress.exe pg_waldump.exe wxbase313u_xml_vc_x64_custom.dll
icuin67.dll libecpg.dll libwinpthread-1.dll pg_controldata.exe pg_regress_ecpg.exe pgbench.exe wxbase313ud_net_vc_x64_custom.dll
icuio67.dll libecpg_compat.dll libxml2.dll pg_ctl.exe pg_resetwal.exe postgres.exe wxmsw313u_adv_vc_x64_custom.dll
I am unable to comment on your post: However I have been attempting to install PostgreSQL 14 on my server, which is already running PostgreSQL 12. I see the same error, related to 'radEA2DE.bat'. here is the relevant block of code from my installation log:
Called IsVistaOrNewer()...
'winmgmts' object initialized...
Version:10.
MajorVersion:10
Granting full access to Administrators on (D:\pgData14)
Executing batch file 'radEA2DE.bat'...
processed file: D:\pgData14
Successfully processed 1 files; Failed processing 0 files
Executing batch file 'radEA2DE.bat'...
initdb: error: The program "postgres" was found by "C:/Program Files/PostgreSQL/14/bin/initdb.exe"
but was not the same version as initdb.
Check your installation.
Called Die(Failed to initialise the database cluster with initdb)...
Failed to initialise the database cluster with initdb
Script stderr:
Program ended with an error exit code
Error running C:\WINDOWS\System32\cscript //NoLogo "C:\Program Files\PostgreSQL\14/installer/server/initcluster.vbs" "NT AUTHORITY\NetworkService" "postgres" "****" "C:\Users\USER\AppData\Local\Temp/postgresql_installer_3f464cf94c" "C:\Program Files\PostgreSQL\14" "D:\pgData14" 5433 "DEFAULT" 0: Program ended with an error exit code
Problem running post-install step. Installation may not complete correctly
The database cluster initialisation failed.
Setting variable whoami from C:\WINDOWS\System32\whoami
Script exit code: 0
I hope this helps with lending a clue.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.