#1264

Issues running modal examples on windows - flux kontext

Openaidivasopened 1y ago

Hi - ive run modal examples for a while and no issues at all. Pulled your latest release and running into issues with all builds

Heres the flux kontext one - ive tried setting utf8 on windows but same issue Building image im-EobGo4CgzytwRFgWvV1B5B Terminating task due to error: error unescaping string: UnrecognizedEscape: unrecognized escape sequence Runner failed with exit code: -1 Stopping app - uncaught exception raised locally: RemoteError('Image build for im-EobGo4CgzytwRFgWvV1B5B failed. See build logs for more details.').

AI is suggesting theres an issue with the quotes in the image_image.py. Ive tried running redoing the script but still same issue.

Im guessing its the emojis - tried a few script rewrites with the AI overlords but same issues .

Running on lastest modal version on windows 10

Thanks

Building image im-EobGo4CgzytwRFgWvV1B5B -- Jul 06  12:49:00.599 | Terminating task due to error: error unescaping string: UnrecognizedEscape: unrecognized escape sequence Jul 06  12:49:00.753 | Runner failed with exit code: -1 Jul 06  12:49:00.845 | Stopping app - uncaught exception raised locally: RemoteError('Image build for im-EobGo4CgzytwRFgWvV1B5B failed. See build logs for more details.').

PS theres a typo in your 60 second chatterbox command - change test to TEXT

git clone https://github.com/modal-labs/modal-examples cd modal-examples modal serve 06_gpu_and_ml/**test-to-audio**/chatterbox_tts.py

Activity

8
aidivas1y ago

closing as er deployed on linux instead!

Dragoy1y ago

I also encountered this problem. Is there any solution to enable native Windows support? So that I don't have to use WSL?

aidivas1y ago

Hey i think if modal remove the emojis in the code it mayvwork on windows. Was using modal on windows vs code no issues before they added emojis. Also strip out any other random spaces and characters.

Ps modal can you add back web endpoints on deployment?? Its a lot of code rewriting and resting to add them in your latest examples thx

skfrost191y ago

i have added gradio UI in the flux kontext, take a look https://github.com/skfrost19/modal-recipes/blob/master/flux_kontext_gradio.py

Dragoy1y ago

i have added gradio UI in the flux kontext, take a look https://github.com/skfrost19/modal-recipes/blob/master/flux_kontext_gradio.py

It's some kind of mystery, I keep getting this error when I try to run it on Windows

Dragoy1y ago

upd. only works in WSL

skfrost191y ago

Yup, tried everything but never worked on windows...

victor-numair10mo ago

To fix this error in Windows 11, I did the following. I recommend updating the documentation at https://modal.com/docs/examples/image_to_image for the community


Problem: Using Path as dictionary key in volumes

Building image im-...
Terminating task due to error: error unescaping string: UnrecognizedEscape: unrecognized escape sequence  
Runner failed with exit code: -1
Stopping app - uncaught exception raised locally: RemoteError('Image build for im-... failed. See build logs for more details.').
╭─ Error ────────────────────────────────────────────────────────────────────────────────────────────────╮
│ Image build for im-... failed. See build logs for more details.

The main issue was here:

❌ PROBLEMATIC (caused escape sequence error)

CACHE_DIR = Path("/cache") volumes = {CACHE_DIR: cache_volume} # Path as dictionary key

Why this caused an error:

  1. Modal serializes the image definition (including volumes) to send to the server.
  2. When serializing a Path as a dictionary key, Modal converts it to a string.
  3. On Windows, Path("/cache") can generate strings with backslashes or characters that Modal's parser interprets as invalid escape sequences.
  4. This generated: error unescaping string: UnrecognizedEscape: unrecognized escape sequence

Solution:

✅ CORRECT

CACHE_DIR = "/cache" # Simple string volumes = {CACHE_DIR: cache_volume} # String as key