DistanceDevelopment / distance-bugs

A place to keep bugs in Distance
http://distancesampling.org/Distance
1 stars 0 forks source link

CDS or MCDS analyses run but produce no output in results file, Distance 7.5 Release 1 #209

Closed LHMarshall closed 6 months ago

LHMarshall commented 2 years ago

The following was seen when trying to run the CDS/MCDS engine.

C:\PROGRA~2\Distance7\ec "C:\PROGRA~2\Distance7\MCDS.exe 0, C:\Users\Name
Surname\AppData\Local\Temp\dstD20B.tmp \options 2>C:\Users\Name
Surname\AppData\Local\Temp\dstD20A.tmp"
-- Start of Analyis Engine Log File --
-- End of Analyis Engine Log File --
No result.

A workaround is to change the location of the temporary directory.

First create a new temporary directory with no spaces in the path (e.g. 'c:\temp')

Instructions on how to switch to use this directory as the temporary directory can be found here:

https://stackhowto.com/how-to-change-temp-folder-location-in-windows-10/

lenthomas commented 2 years ago

I'm afraid there's more to the bug than this. The default install directory for Distance 7 is C:\Program Files (x86)\Distance 7 i.e., with a space between Distance and 7. This caused the first problem for the user it was calling C:\PROGRA~2\Distance 7\ec "C:\PROGRA~2\Distance 7\MCDS.exe 0, etc rather than what it used to call (and still does on my machine with Distance 7.5 C:\PROGRA~2\DISTAN~1\ec "C:\PROGRA~2\DISTAN~1\MCDS.exe 0, etc

See image below - on the left the user (who is running Win 10 just like me) and on the right mine.

image001

So it seems that translation of Windows long file names into the 7.3 format required by the command line caller is not working on some machines. So an early task will be to find a machine it does not work on so we can test any fixes!

lenthomas commented 2 years ago

Hence, the temporary workaround is: (1) Uninstall Distance 7.5. (2) Reinstall, choosing an installation folder name that does not have a space in it. (For example C:\X\Distance7) (3) Change the temporary directory name to one that does not have a space in it (For example C:\Temp) - see above for a link to instructions.

erex commented 2 years ago

My home machine falls in the category of a machine where Windows long file names into the 7.3 format required by the command line caller is not working. I stopped installing DistWin into the default location long ago and have advised users on the list for several years to do the same: image

erex commented 2 years ago

This has been on the books for some time. See also Distance bugs issue #185

lenthomas commented 2 years ago

Thanks for linking those in. I've done some poking around to refresh my memory. The short (8 letter max, 3 letter extension) path name is created from the long name in the D7Util FileHandling function ShortPathName where it calls the API function GetShortPathName, which is linked to GetShortPathNameA in kernel32:

Private Declare Function GetShortPathName Lib "kernel32" _
    Alias "GetShortPathNameA" (ByVal lpszLongPath As String, _
    ByVal lpszShortPath As String, ByVal cchBuffer As Long) As Long

I think the problem is that in modern Windows file systems there are cases where there is no 8.3 filename, and so it just returns the long name. I get this inference from gleaning various posts - e.g., this from a Microsoft board and this from StackOverflow. One way to test this theory is to compare the registry settings on my machine, where 8.3 seems to work, and on yours @erex where it doesn't.

To do this, open up a Windows Powershell Window in Admin mode (right click on the Start menu in bottom right of Windows screen, and choose the option Windows PowerShell (Admin) - I think Pro versions of Win10 have powershell installed, but perhaps home versions don't). At the powershell prompt, type fsutil 8dot3name query c:. (I choose c: because that's the volume I have DistWin installed on.) In response, I get the message that 8dot3 is enabled on c:

Screenshot 2022-09-08 160708

What do you get, @erex ?

Assuming this is the issue, I don't think we can ask people to turn on 8.3 on their machines and then re-do their file systems. So, we'll have to create some other programmatic workaround, or be stuck with giving clear advice about installing on directories without a space, and having a temp directory without a space.

lenthomas commented 2 years ago

As a test, I used Debug mode in DistWin 7.5 to create a command and data file, and then moved them to a directory with spaces in it C:\Users\len\AppData\Local\Temp\dir with space\. I edited the command file so it pointed to the correct directory for the data and output files:

Screenshot 2022-09-08 161627

Then, using a command prompt, I ran the kind of command that DistWin uses, except without the "ec" stuff, and enclosing both the program name and command file name in quotes. It ran fine (returned 2 for warnings, but that's fine, it was the Ducknest first analysis which returns warnings).

Screenshot 2022-09-08 161749

So, I think we have a solution if we need to change the way that DistWin calls mcds.exe. Happy to discuss more @LHMarshall when we see what @erex finds re 8.3 on his machine. We'd want to test on a few localities etc before rolling out.

erex commented 2 years ago

Some faff involved in getting my machine to let me have Powershell in admin mode (some Cntl-Shift-Enter involved. Eventually learned that 8.3 is disabled on my c: drive (and all other drives on my machine)

image

Is a simpler fix to merely change the default installation directory of the installer? I understand the intention to place the executable into the "Program Files (x86)" directory. However, would it violate propriety to have the default directory be "C:/DistanceProgram"? Would that not solve both problems?

lenthomas commented 2 years ago

Thanks @erex. Yes, changing the default directory for install is certainly an option, but doesn't help in the case where users have a multi-word username with a space between, as was the case for the user that contacted me recently. The solution for them (in addition to installing the program in a directory with no space) is to change their TEMP folder. But it'd be nice to have a solution where people don't have to do these things. I think we can do this by putting quotes around the calls to MCDS and to the command file - but we won't then be able to call the ec program. I'll need to dig back and see why I thought that was useful in the first place (I have a memory that it's to catch any FORTRAN crash output, but I'll double-check.)

lenthomas commented 2 years ago

For my records: relevant post about EC.exe: https://community.intel.com/t5/Intel-Fortran-Compiler/EC-EXE/td-p/842975

lenthomas commented 2 years ago

OK, my current suggestion is as follows:

I'm happy to look into all this and implement. I'll wait to get a current version of the development VM before doing so.

lenthomas commented 2 years ago

One thing to discuss and agree on will be whether to implement in a Release 2 of DistWin 7.5 or in DistWin 7.6, because this affects how we go about changing the default for UseEC.

shrutarshipaul commented 1 year ago

The following was seen when trying to run the CDS/MCDS engine.

C:\PROGRA~2\Distance7\ec "C:\PROGRA~2\Distance7\MCDS.exe 0, C:\Users\Name
Surname\AppData\Local\Temp\dstD20B.tmp \options 2>C:\Users\Name
Surname\AppData\Local\Temp\dstD20A.tmp"
-- Start of Analyis Engine Log File --
-- End of Analyis Engine Log File --
No result.

A workaround is to change the location of the temporary directory.

First create a new temporary directory with no spaces in the path (e.g. 'c:\temp')

Instructions on how to switch to use this directory as the temporary directory can be found here:

https://stackhowto.com/how-to-change-temp-folder-location-in-windows-10/

I tried this but did not work. Screenshot 2023-09-18 113416

lenthomas commented 1 year ago

@shrutarshipaul , can you please try this:

shrutarshipaul commented 1 year ago

@shrutarshipaul , can you please try this:

  • Choose Tools | Preferences, and under the General tab, un-check the box “Store results in compressed format in project databases”.
  • Re-run the analysis. Let us know if anything is different. Thanks!

Thank you for replying. I tried your suggestion. It did not work.

erex commented 1 year ago

strutarshipaul

You've sent a screenshot of the Log window after altering the temp directory, showing Analysis engine 'OK'. Can you also send a screenshot of the Results window? Is the Results window empty after unchecking the compressed format tickbox?

shrutarshipaul commented 1 year ago

strutarshipaul

You've sent a screenshot of the Log window after altering the temp directory, showing Analysis engine 'OK'. Can you also send a screenshot of the Results window? Is the Results window empty after unchecking the compressed format tickbox?

It is empty both times. I have attached screenshots

Screenshot new Screenshot new

erex commented 1 year ago

Thanks for the screenshots. I'm afraid I don't have a solution to your issue. Can you provide further information regarding your operating system (I'm guessing it is Windows 10, but need to check to be sure) and the version of Distance you are using (I presume Distance 7.5, but want to check). I'm looking for any clue that might indicate the source of the problem. Have you used Distance previously on this computer or another computer?

shrutarshipaul commented 1 year ago

Thanks for the screenshots. I'm afraid I don't have a solution to your issue. Can you provide further information regarding your operating system (I'm guessing it is Windows 10, but need to check to be sure) and the version of Distance you are using (I presume Distance 7.5, but want to check). I'm looking for any clue that might indicate the source of the problem. Have you used Distance previously on this computer or another computer?

I am using windows 11 and Distance 7.5

No I have not used Distance in this computer. I have used 7.3 some time back in another computer

erex commented 1 year ago

Thanks for the added details. I also am using Distance 7.5 on a Windows 11 computer; this is what appears at the start of the Log window when running an example analysis:

Initializing 
Making Data File 
Making Data Selection Queries 
Making Input File 
Engine started with the following command:
 E:\distance7\Distance7\ec "E:\distance7\Distance7\MCDS.exe 0, C:\Users\erexs\AppData\Local\Temp\dstAC51.tmp \options 2>C:\Users\erexs\AppData\Local\Temp\dstAC50.tmp" 
-- Start of Analyis Engine Log File -- 
 This is mcds.exe version 7.4.0     
 Options;                 

This appears to mean your machine is not calling MCDS.exe because the analysis engine log file is empty. This gets us slightly further forward, but we still haven't identified the problem

Have you tried to run one of the sample projects that are supplied with the Distance software? Just navigate to the Sample Projects folder and open and run one of the basic analyses, such as ducknest. I'm struggling to get to the bottom of this.

shrutarshipaul commented 1 year ago

Thanks for the added details. I also am using Distance 7.5 on a Windows 11 computer; this is what appears at the start of the Log window when running an example analysis:

Initializing 
Making Data File 
Making Data Selection Queries 
Making Input File 
Engine started with the following command:
 E:\distance7\Distance7\ec "E:\distance7\Distance7\MCDS.exe 0, C:\Users\erexs\AppData\Local\Temp\dstAC51.tmp \options 2>C:\Users\erexs\AppData\Local\Temp\dstAC50.tmp" 
-- Start of Analyis Engine Log File -- 
 This is mcds.exe version 7.4.0     
 Options;                 

This appears to mean your machine is not calling MCDS.exe because the analysis engine log file is empty. This gets us slightly further forward, but we still haven't identified the problem

Have you tried to run one of the sample projects that are supplied with the Distance software? Just navigate to the Sample Projects folder and open and run one of the basic analyses, such as ducknest. I'm struggling to get to the bottom of this.

I tried. Actually none of the sample datasets are working for me. All are giving blank results.

erex commented 1 year ago

OK, thanks for that. Your answer eliminates one other possibility, that is that something was wrong with the Distance for Windows project you had created. We are learning more about what is not the problem; we as yet don't know what is the problem.

On Wed, 20 Sept 2023 at 14:01, shrutarshipaul @.***> wrote:

Thanks for the added details. I also am using Distance 7.5 on a Windows 11 computer; this is what appears at the start of the Log window when running an example analysis:

Initializing Making Data File Making Data Selection Queries Making Input File Engine started with the following command: E:\distance7\Distance7\ec "E:\distance7\Distance7\MCDS.exe 0, C:\Users\erexs\AppData\Local\Temp\dstAC51.tmp \options 2>C:\Users\erexs\AppData\Local\Temp\dstAC50.tmp" -- Start of Analyis Engine Log File -- This is mcds.exe version 7.4.0 Options;

This appears to mean your machine is not calling MCDS.exe because the analysis engine log file is empty. This gets us slightly further forward, but we still haven't identified the problem

Have you tried to run one of the sample projects that are supplied with the Distance software? Just navigate to the Sample Projects folder and open and run one of the basic analyses, such as ducknest. I'm struggling to get to the bottom of this.

I tried. Actually none of the sample datasets are working for me. All are giving blank results.

— Reply to this email directly, view it on GitHub https://github.com/DistanceDevelopment/distance-bugs/issues/209#issuecomment-1727682828, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACQX6GQ54OOWJFNCZFWTETX3LSKFANCNFSM6AAAAAAQGT5AUI . You are receiving this because you were mentioned.Message ID: @.***>

-- Eric Rexstad 20 West Braes Crescent Crail Fife KY10 3SY

shrutarshipaul commented 1 year ago

OK, thanks for that. Your answer eliminates one other possibility, that is that something was wrong with the Distance for Windows project you had created. We are learning more about what is not the problem; we as yet don't know what is the problem. On Wed, 20 Sept 2023 at 14:01, shrutarshipaul @.> wrote: Thanks for the added details. I also am using Distance 7.5 on a Windows 11 computer; this is what appears at the start of the Log window when running an example analysis: Initializing Making Data File Making Data Selection Queries Making Input File Engine started with the following command: E:\distance7\Distance7\ec "E:\distance7\Distance7\MCDS.exe 0, C:\Users\erexs\AppData\Local\Temp\dstAC51.tmp \options 2>C:\Users\erexs\AppData\Local\Temp\dstAC50.tmp" -- Start of Analyis Engine Log File -- This is mcds.exe version 7.4.0 Options; This appears to mean your machine is not calling MCDS.exe because the analysis engine log file is empty. This gets us slightly further forward, but we still haven't identified the problem Have you tried to run one of the sample projects that are supplied with the Distance software? Just navigate to the Sample Projects folder and open and run one of the basic analyses, such as ducknest. I'm struggling to get to the bottom of this. I tried. Actually none of the sample datasets are working for me. All are giving blank results. — Reply to this email directly, view it on GitHub <#209 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACQX6GQ54OOWJFNCZFWTETX3LSKFANCNFSM6AAAAAAQGT5AUI . You are receiving this because you were mentioned.Message ID: @.> -- Eric Rexstad 20 West Braes Crescent Crail Fife KY10 3SY

Just an update. I carefully ran the sample datasets again. The dolphin dataset gave results. I think MCDS.exe (ducknest, Duikerdaytime) is creating problem but not Rcmd.exe. I attached a screenshot of dolphin dataset log new screenshot

lenthomas commented 1 year ago

Hi @shrutarshipaul,

I have two further suggestions:

  1. In Distance for Windows, under menu item Tools | Preferences, look on the Analysis/Simulation tab, and un-tick the option "Capture command line output from CDS and MCDS engines in WinNT". image Then try running an analysis again (one that uses MCDS.exe).

  2. I wonder if it's something to do with your regional settings. Look in Windws Settings, under "Time & Language" , "Language & region". What does it say in the places I have circled below: image

Thanks!

lenthomas commented 1 year ago

Hi @shrutarshipaul, I woder if you had any sucess with the above suggestions? Cheers, Len

shrutarshipaul commented 1 year ago

Hi @shrutarshipaul, I woder if you had any sucess with the above suggestions? Cheers, Len

Hi, Unticking the Capture command line output from CDS and MCDS engines in WinNT solved the problem finally. Now everything is running smoothly. Thank you so much. Really appreciate your efforts. If possible, can you elaborate what happens when you untick this option?

Thank you again.

lenthomas commented 1 year ago

Thanks @shrutarshipaul, that's really useful to know. When you untick that option, the way DistWin calls the mcds.exe program changes - instead of wrapping the call inside a call to another program called ec, it simply calls it directly. Back in the day, the wrapper program ec was needed so that DistWin could harvest the return status of mcds.exe when it had completed - particuarly if there was a crash in mcds.exe. But I'm not convinced it's necessary any more, and it seems to cause more problems than it solves in recent versions of the Windows OS. I intend to make some changes here in a future release of DistWin, after I've done more testing, and the information you provided is really useful in this. Also, I'm glad things are running smoothly for you now :) Len

erex commented 1 year ago

I had no idea that the WinNT checkbox could be the answer to this problem.

lenthomas commented 6 months ago

I have implemented a fix to this problem.
The checkbox is now renamed to "Capture FORTRAN output if CDS and MCDS engine crashes" and is unchecked by default. When unchecked, analyses can now run even if the Distance or Temp directories have space in them -- but any output from MCDS.exe when it crashes is not recorded (MCDS.exe crashing is a very rare thing, however). When checked, analyses can also run if these directories have spaces, but it requires the 8dot3 file naming to be enabled (which it is in Win10 and Win11 in my experience - but clearly not in everyone's experience). I have updated the documentation.