title: pyinstaller FileNotFoundError: [Errno2] cannot file /tmp/_MEI****/include/ufc.h
body: <p>I am using pyinstaller (5.3) and python(3.10) to convert a sample .py file to an executable in linux. I have tested this package for several simple programs which does not involve the package 'dolfin'. However, even if I have a simple program which involves the dolfin module, the executable fails.</p>
  <p>Here is the findvec.py file</p>
  <pre><code>from dolfin import BoxMesh, Point
  mesh = BoxMesh(Point(0,0,0),Point(1,1,1),2,2,2)
  x = mesh.coordinates()[:,0]
  for i in range(len(x)):
      print('Pos',i+1,'Val = ',x[i])
  </code></pre>
  <p>When i use this command
  <code>pyinstaller --onefile findvec.py</code>, the executable is generated fine, however upon execution the following error pop out. Any ideas what these errors refer to, and how to possibly combat this issue?</p>
  <pre><code>Traceback (most recent call last):
    File &quot;findvec.py&quot;, line 2, in &lt;module&gt;
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 1027, in _find_and_load
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 1006, in _find_and_load_unlocked
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 688, in _load_unlocked
    File &quot;PyInstaller/loader/pyimod02_importers.py&quot;, line 493, in exec_module
    File &quot;fenics/__init__.py&quot;, line 7, in &lt;module&gt;
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 1027, in _find_and_load
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 1006, in _find_and_load_unlocked
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 688, in _load_unlocked
    File &quot;PyInstaller/loader/pyimod02_importers.py&quot;, line 493, in exec_module
    File &quot;dolfin/__init__.py&quot;, line 136, in &lt;module&gt;
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 1027, in _find_and_load
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 1006, in _find_and_load_unlocked
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 688, in _load_unlocked
    File &quot;PyInstaller/loader/pyimod02_importers.py&quot;, line 493, in exec_module
    File &quot;dolfin/parameter/__init__.py&quot;, line 11, in &lt;module&gt;
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 1027, in _find_and_load
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 1006, in _find_and_load_unlocked
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 688, in _load_unlocked
    File &quot;PyInstaller/loader/pyimod02_importers.py&quot;, line 493, in exec_module
    File &quot;ffc/__init__.py&quot;, line 24, in &lt;module&gt;
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 1027, in _find_and_load
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 1006, in _find_and_load_unlocked
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 688, in _load_unlocked
    File &quot;PyInstaller/loader/pyimod02_importers.py&quot;, line 493, in exec_module
    File &quot;ffc/compiler.py&quot;, line 129, in &lt;module&gt;
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 1027, in _find_and_load
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 1006, in _find_and_load_unlocked
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 688, in _load_unlocked
    File &quot;PyInstaller/loader/pyimod02_importers.py&quot;, line 493, in exec_module
    File &quot;ffc/codegeneration.py&quot;, line 40, in &lt;module&gt;
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 1027, in _find_and_load
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 1006, in _find_and_load_unlocked
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 688, in _load_unlocked
    File &quot;PyInstaller/loader/pyimod02_importers.py&quot;, line 493, in exec_module
    File &quot;ffc/uflacs/backends/ufc/generators.py&quot;, line 19, in &lt;module&gt;
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 1027, in _find_and_load
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 1006, in _find_and_load_unlocked
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 688, in _load_unlocked
    File &quot;PyInstaller/loader/pyimod02_importers.py&quot;, line 493, in exec_module
    File &quot;ffc/uflacs/backends/ufc/finite_element.py&quot;, line 29, in &lt;module&gt;
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 1027, in _find_and_load
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 1006, in _find_and_load_unlocked
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 688, in _load_unlocked
    File &quot;PyInstaller/loader/pyimod02_importers.py&quot;, line 493, in exec_module
    File &quot;ffc/uflacs/backends/ufc/generator.py&quot;, line 22, in &lt;module&gt;
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 1027, in _find_and_load
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 1006, in _find_and_load_unlocked
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 688, in _load_unlocked
    File &quot;PyInstaller/loader/pyimod02_importers.py&quot;, line 493, in exec_module
    File &quot;ffc/backends/ufc/__init__.py&quot;, line 172, in &lt;module&gt;
    File &quot;ffc/backends/ufc/__init__.py&quot;, line 165, in _compute_ufc_signature
  FileNotFoundError: [Errno 2] No such file or directory: '/tmp/_MEIsa44Nd/include/ufc.h'
  [153489] Failed to execute script 'findvec' due to unhandled exception!
  </code></pre>
  <p>I have seen quite a few answers related to this problem, however it refers to a keyword _MEIPASS which is temporarily created upon executing. In my case I can see a tmp file created with /tmp/MEI******/ where the asterisks represent randomly alphabets each time i execute it. I cannot possibly track what causes this issue, when I know for sure that the file 'ufc.h' was present during the generation of the distribution using pyinstaller initially.</p>