Having trouble init Pytorch Live

beann: <p>I tried Live in the emulator and the physical device, however, they all stuck in the loading part. Does anyone have some suggestions? Thanks!</p>
<p><img src="https://discuss.pytorch.org/uploads/default/original/3X/3/a/3a34f0c6cda4b9af429b21f30e5aa8b36a9d4cc0.png" alt="image" data-base62-sha1="8iV7j2nbRmIhM8FqGrGPNKSxKfe" width="366" height="317"></p>

clarksandholtz: <p>Hey <a class="mention" href="/u/beann">@beann</a>, sorry you’re seeing this issue. Can you share what kind of computer you are working on and share the output of <code>npx torchlive-cli doctor</code>?</p>

beann: <p>I use mac book air with intel Core i5 with Big Sur 11.4<br>
The output is</p>
<pre><code class="lang-auto">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
</code></pre>
<p>And the build process seems right</p>
<pre><code class="lang-auto">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.
</code></pre>

chrisklaiber: <p>This looks like an issue loading the JS bundle from the Metro server. I’d check two things:</p>
<p>Is Metro running? Is it on port 8081? This is normally started by <code>npx torchlive-cli run-android</code>. You can also run <code>yarn start</code> in the project directory to run the Metro server without deploying the app.</p>
<p>If it’s still an issue on the physical device, you may need to ensure requests are forwarded correctly by running <code>adb reverse tcp:8081 tcp:8081</code> like in this FAQ item: <a href="https://pytorch.org/live/docs/tutorials/faq/#q-what-to-do-when-the-device-shows-the-error-unable-to-load-script-from-assets-indexandroidbundle" class="inline-onebox" rel="noopener nofollow ugc">FAQ | Easy to use set of tools to create on-device ML demos on Android and iOS. Unlock the vast potential of AI innovations.</a></p>

beann: <p>I think Metro is working fine,<br>
<img src="https://discuss.pytorch.org/uploads/default/original/3X/c/4/c4d13977970b411e2ca06784245fddac88461a0d.png" alt="image" data-base62-sha1="s57Qqs5clAr2IoDRSj5iaB9IdfD" width="437" height="291"></p>
<p>And this even stuck in the emulator</p>
<p><img src="https://discuss.pytorch.org/uploads/default/original/3X/4/2/428351447f0419c93d56abb2be22ee3ade2b7c88.png" alt="image" data-base62-sha1="9uoRhv7c4cjBWnOyAWucnTW7c4o" width="403" height="500"></p>

clarksandholtz: <p>Looks like this could be a React Native issue with one of the dependencies called <code>watchman</code>. <a href="https://stackoverflow.com/questions/51622967/emulator-stuck-at-loading-from-10-0-2-28081-what-is-issue" rel="noopener nofollow ugc">This stack overflow</a> has some things that might fix it.</p>
<p>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.</p>
<p>Let me know if any of these end up working!</p>

beann: <p>I reinstalled the watchman, but it still not working.</p>

clarksandholtz: <p>Did you try any of the other solutions in that stack overflow post?</p>

raedle: <p>Hi <a class="mention" href="/u/beann">@beann</a>, 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:</p>
<ul>
<li>Watchman GitHub issue:  <a href="https://github.com/facebook/watchman/issues/163#issuecomment-164569466" class="inline-onebox" rel="noopener nofollow ugc">The user limit on the total number of inotify watches was reached · Issue #163 · facebook/watchman · GitHub</a>
</li>
</ul>
<p>(more links in follow-up post, can only post two links at a time)</p>
<p>More details on inotify on macOS and Linux: <a href="https://transang.me/everything-about-inotify-in-linux-and-macos/" class="inline-onebox" rel="noopener nofollow ugc">Everything about inotify in Linux and MacOS</a></p>
<p>Here is an example command how to increase the inotify number (you might need to change it depending on your OS):</p>
<pre><code class="lang-auto">echo 999999 | sudo tee -a /proc/sys/fs/inotify/max_user_watches &amp;&amp; echo 999999 | sudo tee -a /proc/sys/fs/inotify/max_queued_events &amp;&amp; echo 999999 | sudo tee -a /proc/sys/fs/inotify/max_user_instances &amp;&amp; watchman shutdown-server &amp;&amp; sudo sysctl -p
</code></pre>

raedle: <p>Follow up links:</p>
<ul>
<li>Stack Overflow: <a href="https://stackoverflow.com/a/62061280" class="inline-onebox" rel="noopener nofollow ugc">android - React Native: Emulator stuck on "loading from localhost:8081.." - Stack Overflow</a>
</li>
<li>Blog post: <a href="https://reactnativeforyou.com/android-emulator-stuck-at-loading-from-10-0-2-28081-react-native-issue-fix/" rel="noopener nofollow ugc">https://reactnativeforyou.com/android-emulator-stuck-at-loading-from-10-0-2-28081-react-native-issue-fix/</a>
</li>
</ul>