duckling icon indicating copy to clipboard operation
duckling copied to clipboard

Running Duckling on Windows

Open allardy opened this issue 5 years ago • 11 comments

Hello guys,

I'm having a hard time getting Duckling to run properly on Windows and I hope you can point me in the right direction.

Starting from the master branch, I've done some minor modifications, based on answers I encountered in other issues about windows 10 in this repo:

  1. Replace regex-pcre with regex-pcre-builtin (setting up pcre on windows isn't an easy task)
  2. Changed the path of the timezone folder in ExampleMain.hs from /usr/share/zoneinfo to zoneinfo/ (and copied the folder with olson TZ to my windows machine)
  3. Changed the import of System.FilePath in TimeZone.hs for System.FilePath.Posix (otherwise, it returns timezones like America\\Los_Angeles)

These changes were tried on a friend's OSX laptop and the app still ran just fine, so I guess it's something windows-related.

Everything compiles perfectly. Using curl to call the service returns effectively quack!. However, any call to /parse will yield an Empty reply from server.

While debugging manually, the issue arose when the line parsedResult = parse... is called in ExampleMain.hs.

Following the instructions in the readme, I ran the example query with Duckling.Debug

*Duckling.Debug> debug (makeLocale EN $ Just US) "in two minutes" [This Time]
*** Exception: user error (Text.Regex.PCRE.String died: (2,"invalid UTF-8 string"))

I've tried setting LANG=C.UTF-8 when building, and when running it, to no avail. Is there anything else I could check out ?

Thanks!

(On a side note, would it be feasible to save the output of loadTimeZoneSeries in a single file, which could be optional for users without Olson files? Copying 1700 files of 1k is a bit overkill, since the output of that call is simply a hash map of 13kb)

allardy avatar Mar 18 '19 01:03 allardy

I finally got it working! The issue was the code page setting of cmd.exe. For future windows users, simply type CHCP 65001 in the console, then start Duckling.

Everything is working fine, even timezones!

If someone is willing to help and tell me how to save the result of loadTimeZoneSeries to a file, and load it instead of parsing the Olson folders, I would really appreciate that! I lack the Haskell skills to do that.

Thank you

allardy avatar Mar 18 '19 20:03 allardy

Hey @allardy I followed all the steps one by one but i got this error : duckling-example-exe.EXE: zoneinfo/: getDirectoryContents:findFirstFile: does not exist (Le chemin d’accès spécifié est introuvable.) Ps : I am a windows user . Any suggestion please ?

Dejlaaa avatar Apr 01 '19 10:04 Dejlaaa

@Dejlaaa The missing step is to copy the content of the zoneinfo folder (the olson files) from a linux machine. The folder zoneinfo should be in the same folder as the executable

I've made the changes and included the zipped zoneinfo files on a forked repo, if you want them: https://github.com/botpress/duckling/pull/1/files

allardy avatar Apr 04 '19 13:04 allardy

It works using the docker image thanks :)

Dejlaaa avatar Apr 05 '19 09:04 Dejlaaa

@allardy how can I integrate the duckling in my bot ??

Dejlaaa avatar Apr 16 '19 11:04 Dejlaaa

So chcp 65001 will work when using stack runghc but does not work when you use stack install and then start an exe file (in this case duckling-example-exe.exe). Is there anyother way ?

justinphan3110 avatar Jun 05 '19 04:06 justinphan3110

Hi, I am encountering this error while trying to stack build. Kindly help image

discreterandomvariable avatar Sep 25 '19 12:09 discreterandomvariable

Hi, I am encountering this error while trying to stack build. Kindly help image

I have downloaded and added timezone folder to exe folder image

discreterandomvariable avatar Sep 25 '19 12:09 discreterandomvariable

I am adding below the detailed steps which i followed on windows 10 for Duckling, so that it is helpful for anyone who faces this problem in the future:

  1. https://github.com/facebook/duckling download and store code in a folder from here
  2. https://github.com/botpress/duckling/pull/1/files -> do changes in files mentioned in this link
  3. https://github.com/facebook/duckling/issues/412 -> do steps mentioned in this else "stack exec duckling-example-exe" will give error
  4. in command window go to the folder where downloaded this code
  5. run CHCP 65001 in command prompt
  6. follow the steps in the readme of https://github.com/facebook/duckling

ishaneuralsift avatar Aug 08 '20 10:08 ishaneuralsift

@ishaneuralsift or someone else, do you want to add some instructions to the README?

chessai avatar Apr 16 '21 18:04 chessai

I finally got it working! The issue was the code page setting of cmd.exe. For future windows users, simply type CHCP 65001 in the console, then start Duckling.

Everything is working fine, even timezones!

If someone is willing to help and tell me how to save the result of loadTimeZoneSeries to a file, and load it instead of parsing the Olson folders, I would really appreciate that! I lack the Haskell skills to do that.

Thank you

thanks man! couldnt sleep last night bcos of the issue you saved my day !!

SensysDev avatar Jun 19 '21 09:06 SensysDev