Having trouble init Pytorch Live

I tried Live in the emulator and the physical device, however, they all stuck in the loading part. Does anyone have some suggestions? Thanks!

image

Hey @beann, sorry you’re seeing this issue. Can you share what kind of computer you are working on and share the output of npx torchlive-cli doctor?

I use mac book air with intel Core i5 with Big Sur 11.4
The output is

Homebrew
  📍 path: /usr/local/bin/brew
  ✅ version: 3.3.8

Python
  📍 path: /Users/j/opt/miniconda3/bin/python3
  🏁 min version: 3.7.5
  ✅ version: 3.8.1

Watchman
  📍 path: /usr/local/bin/watchman
  ✅ version: 4.9.0

Node.js
  📍 path: /usr/local/Cellar/node@16/16.13.1/bin/node
  🏁 min version: 12.15.0
  ✅ version: 16.13.1

React Native should not be installed locally
  ✅ package does not exist.

Yarn
  📍 path: /Users/j/.yarn/bin/yarn
  🏁 min version: 1.17.0-20190429.1820
  ✅ version: 1.22.17

Java Development Kit
  📍 path: /usr/local/opt/openjdk@8
  ✅ version: 1.8.0

Android SDK Manager
  📍 path: /Users/j/Library/Android/sdk/tools/bin/sdkmanager
  🏁 min version: 26.1.1
  ✅ version: 26.1.1

  Required Android Packages
    📦 ✅ emulator
    📦 ✅ platform-tools
    📦 ✅ platforms;android-29
    📦 ✅ system-images;android-29;google_apis;x86_64

  Installed Android Packages
    📦 build-tools;29.0.2 (29.0.2)
    📦 emulator (31.1.4)
    📦 patcher;v4 (1)
    📦 platform-tools (31.0.3)
    📦 platforms;android-29 (5)
    📦 platforms;android-30 (3)
    📦 system-images;android-29;google_apis;x86_64 (12)

Android AVD Manager
  📍 path: /Users/j/Library/Android/sdk/tools/bin/avdmanager

Android Emulator
  📍 path: /Users/j/Library/Android/sdk/emulator/emulator
  🏁 min version: 30.5.6
  ✅ version: 31.1.4

CocoaPods
  📍 path: /usr/local/bin/pod
  🏁 min version: 1.10.2
  ✅ version: 1.11.2

And the build process seems right

Installed‎ on‎ 1‎ device.

BUILD‎ SUCCESSFUL‎ in‎ 18s
132‎ actionable‎ tasks:‎ 2‎ executed,‎ 130‎ up-to-date
info‎ Connecting‎ to‎ the‎ development‎ server...
8081
info‎ Starting‎ the‎ app‎ on‎ "jvtg9xhqvo9py97x"...
Starting:‎ Intent‎ {‎ cmp=org.pytorch.live.example/.MainActivity‎ }
Done‎ in‎ 25.51s.

This looks like an issue loading the JS bundle from the Metro server. I’d check two things:

Is Metro running? Is it on port 8081? This is normally started by npx torchlive-cli run-android. You can also run yarn start in the project directory to run the Metro server without deploying the app.

If it’s still an issue on the physical device, you may need to ensure requests are forwarded correctly by running adb reverse tcp:8081 tcp:8081 like in this FAQ item: FAQ | Easy to use set of tools to create on-device ML demos on Android and iOS. Unlock the vast potential of AI innovations.

I think Metro is working fine,
image

And this even stuck in the emulator

image

Looks like this could be a React Native issue with one of the dependencies called watchman. This stack overflow has some things that might fix it.

Might be an issue where watchman doesn’t have the right permissions so either granting it permissions or uninstalling it and reinstalling it with brew could do the trick.

Let me know if any of these end up working!

I reinstalled the watchman, but it still not working.

Did you try any of the other solutions in that stack overflow post?

Hi @beann, it could be related the system user reaching the total number of inotify watches. Here are a few reports that seem to be related to what you are reporting:

(more links in follow-up post, can only post two links at a time)

More details on inotify on macOS and Linux: Everything about inotify in Linux and MacOS

Here is an example command how to increase the inotify number (you might need to change it depending on your OS):

echo 999999 | sudo tee -a /proc/sys/fs/inotify/max_user_watches && echo 999999 | sudo tee -a /proc/sys/fs/inotify/max_queued_events && echo 999999 | sudo tee -a /proc/sys/fs/inotify/max_user_instances && watchman shutdown-server && sudo sysctl -p

Follow up links: