title: Pyinstaller doesnt package cv2 in jetson
body: <p>I have a software which I packaged in x86 processors using pyinstaller and it packages all libraries including cv2, however, when I try to package the same software in Jetson TX2, it doesn't package cv2 and throws error on executing the binary file:</p>
  <pre><code>OpenCV loader: missing configuration file: ['config.py']
  </code></pre>
  <p>The reason is cv2 comes preinstalled in TX2 at a different location (<code>/usr/lib/python3.6/dist-packages</code>). However, rest of the libraries which we self-installed are in (<code>/home/mnauf/.local/lib/python3.6/site-packages</code>) and maybe this is why pyinstaller fails to package it.</p>
  <p>The pyinstaller tries to find cv2 at <code>/home/mnauf/.local/lib/python3.6/site-packages</code> and doesn't find there and correspondingly doesn't package, however cv2 imports fine if you do it with python. The reason why cv2 works fine with python is that I suppose python first tries to find a library in <code>/home/mnauf/.local/lib/python3.6/site-packages</code> and if unsuccessful, finds in <code>/usr/lib/python3.6/dist-packages</code>.</p>
  <p>To solve the packaging problem, I tried the following methodologies and the errors discussed below all come when executing the binary file and don't come at the time of packaging:</p>
  <ol>
  <li>Copying cv2 from <code>/usr/lib/python3.6/dist-packages</code> to <code>/home/mnauf/.local/lib/python3.6/site-packages</code>. It gives:</li>
  </ol>
  <p><code>ImportError: ERROR: recursion is detected during loading of &quot;cv2&quot; binary extensions. Check OpenCV installation.</code></p>
  <ol start="2">
  <li><p>I try to copy cv2 directory from <code>/usr/lib/python3.6/dist-packages</code> to <code>dist/main</code> folder created by pyinstaller after packaging but I get the same Import error.</p>
  </li>
  <li><p>Adding the cv2 directory path as a data file in <code>main.spec</code> also only copies the folder to <code>dist/main</code> and hence gives the same Import error.</p>
  </li>
  <li><p>Adding the <code>cv2.cpython-36m-aarch64-linux-gnu.so</code> path only as a data file in main.spec gives <code>Opencv loader</code> error.</p>
  </li>
  <li><p>Adding the cv2 directory as a binary file path in main.spec gives the <code>Import error</code>.</p>
  </li>
  <li><p>Adding the <code>cv2.cpython-36m-aarch64-linux-gnu.so</code> path only as a binary file in main.spec gives the <code>Opencv loader</code> error.</p>
  </li>
  </ol>
  <p>Please help me with packing cv2. Thanks</p>