I get error when I run pyinstaller executable

Hello guys! I tried to make a game with the use of taichi. But when I run pyinstaller executable I get this error. I also have tried building it with nuitka, but It didn’t even make it to the end.

Python version - 3.9.7
Windows 11 64 bit

Traceback (most recent call last):
  File "main.py", line 12, in <module>
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "PyInstaller\loader\pyimod03_importers.py", line 495, in exec_module
  File "src\scripts\shader.py", line 7, in <module>
    ti.init(arch=ti.cpu)
  File "taichi\lang\__init__.py", line 678, in init
  File "taichi\lang\impl.py", line 288, in create_program
RuntimeError: [D:/a/taichi/taichi/taichi/llvm/llvm_context.cpp:module_from_bitcode_file@192] Bitcode file (C:\Users\faccc\AppData\Local\Temp\_MEI43962\taichi\_lib\runtime/runtime_x64.bc) not found.

Any help will be appreciated!

Hey @RoboMarchello, the error message looks like your python environment is corrupted, would you mind trying
pip uninstall taichi -y
pip uninstall taichi-nightly -y

and cd into where your python site-packages and manually delete the taichi folder in there.

Then pip install taichi should work I think. (the missing file in the error message above should have been shipped by the pip package)

2 个赞

Hi! Thank you for your help! I tried to do what you said, but it’s still doesn’t work. :thinking: I don’t know if it’s related, but I also tried sfc /scannow.
But it seems that we have new error

Traceback (most recent call last):
  File "C:\Users\faccc\AppData\Local\Temp\ON0C2A~1\main.py", line 12, in <module>
    from src.scripts.shader import RoundShader
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "C:\Users\faccc\AppData\Local\Temp\ON0C2A~1\src\scripts\shader.py", line 4, in <module src.scripts.shader>
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "C:\Users\faccc\AppData\Local\Temp\ON0C2A~1\taichi\__init__.py", line 1, in <module taichi>
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "C:\Users\faccc\AppData\Local\Temp\ON0C2A~1\taichi\_funcs.py", line 4, in <module taichi._funcs>
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "C:\Users\faccc\AppData\Local\Temp\ON0C2A~1\taichi\lang\__init__.py", line 37, in <module taichi.lang>
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "C:\Users\faccc\AppData\Local\Temp\ON0C2A~1\taichi\lang\kernel_impl.py", line 12, in <module taichi.lang.kernel_impl>
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "C:\Users\faccc\AppData\Local\Temp\ON0C2A~1\taichi\lang\ast\__init__.py", line 3, in <module taichi.lang.ast>
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "C:\Users\faccc\AppData\Local\Temp\ON0C2A~1\taichi\lang\ast\transform.py", line 1, in <module taichi.lang.ast.transform>
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "C:\Users\faccc\AppData\Local\Temp\ON0C2A~1\taichi\lang\ast\ast_transformer.py", line 7, in <module taichi.lang.ast.ast_transformer>
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "C:\Users\faccc\AppData\Local\Temp\ON0C2A~1\astor\__init__.py", line 24, in <module astor>
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\faccc\\AppData\\Local\\Temp\\ON0C2A~1\\astor\\VERSION'

Thanks again!

@RoboMarchello This suggests astor package is missing, could you try pip install astor and see if that fixes your problem?

3 个赞

Hey! Thanks for the reply. I installed astor==0.8.0 and now we have another error :grimacing:

Traceback (most recent call last):
  File "C:\Users\faccc\AppData\Local\Temp\ON9BF8~1\main.py", line 12, in <module>
    from src.scripts.shader import RoundShader
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "C:\Users\faccc\AppData\Local\Temp\ON9BF8~1\src\scripts\shader.py", line 7, in <module src.scripts.shader>
  File "C:\Users\faccc\AppData\Local\Temp\ON9BF8~1\taichi\lang\__init__.py", line 678, in init
  File "C:\Users\faccc\AppData\Local\Temp\ON9BF8~1\taichi\lang\impl.py", line 288, in create_program
RuntimeError: [D:/a/taichi/taichi/taichi/llvm/llvm_context.cpp:module_from_bitcode_file@192] Bitcode file (C:\Users\faccc\AppData\Local\Temp\onefile_84336_132895045865331105\taichi\_lib\runtime/runtime_x64.bc) not found

Thank you so much for your help!

@RoboMarchello this looks like a corrupted python environment which might have various sources hmmm. Would you mind try creating a new python environment from conda and then run pip install taichi there?

3 个赞

I’m so sorry. I have the same error message from the conda.