pokepetter / ursina

A game engine powered by python and panda3d.
https://pokepetter.github.io/ursina/
MIT License
2.23k stars 326 forks source link

Ursina can't compile to .exe file #218

Closed LeeFuuChang closed 3 years ago

LeeFuuChang commented 3 years ago

Is it impossible to compile Ursina python file to .exe? here's the code I use to test compiling Ursina program to .exe type file

from ursina import *
app = Ursina()
app.run()

and the code to generate .exe file

pyinstaller --onefile -w ss.py

the Terminal shows that the compiling process was completed successfully

1

but the .exe file that came out can't be executed properly

image

and then I tried to bring up the console here's the Error Traceback image

sam-the-programmer commented 3 years ago

I have been able to convert it to a .exe file. A good way is by running

pip install auto-py-to-exe

then, find the .exe file for auto-py-to-exe in the Scripts folder in Python's Appdata folder. Then, follow the instructions as on Urisna's docs (or as below).

For Windows, but should be the same for linux, apple, etc. Once opened the exe for auto py to exe, you'll see the UI. Then, choose your file, icon, etc. Finally, click add folders and add the ursina and ursina-dist-info folders from the site-packages folder where python packages are stored. Then click the button to create your .exe in the output folder you specified. You'll find the .exe in the dist folder.


The thing you missed was adding the ursina and ursina-dist-info folders from site packages. What auto-py-to-exe does is create the pyinstaller command, but makes it easier for you by providing you with a UI.

LeeFuuChang commented 3 years ago

I have been able to convert it to a .exe file. A good way is by running

pip install auto-py-to-exe

then, find the .exe file for auto-py-to-exe in the Scripts folder in Python's Appdata folder. Then, follow the instructions as on Urisna's docs (or as below).

For Windows, but should be the same for linux, apple, etc. Once opened the exe for auto py to exe, you'll see the UI. Then, choose your file, icon, etc. Finally, click add folders and add the ursina and ursina-dist-info folders from the site-packages folder where python packages are stored. Then click the button to create your .exe in the output folder you specified. You'll find the .exe in the dist folder.

The thing you missed was adding the ursina and ursina-dist-info folders from site packages. What auto-py-to-exe does is create the pyinstaller command, but makes it easier for you by providing you with a UI.

It still doesn't work after I added ursina and ursina-dist-info in to compiling image here's how I add the folder and I even tried to add the whole site-packages folder in to compiling and it still doesn't work

gaxln commented 3 years ago

try adding

panda3d-1.10.6.dist-info,
panda3d,
panda3d_tools,
ursina-3.1.0.dist-info,
ursina,

download panda3d if you don't have the files

pip install panda3d

and use one directory, if you want use one file you need put only your assets in the same directory of the exe like this 2021-06-29-152433_1366x768_scrot

PD: Sorry for my english, i speak spanish

PratangsuRakshit commented 3 years ago

It worked for me atleast

ghost commented 3 years ago

where i can find folders like panda3d or panda dist info

sam-the-programmer commented 3 years ago

Open the windows start menu and search %appdata%. It should open a directory called AppData/Roaming. Go out of roaming into appdata, the parent directory.

Then, go to Local/Programs/Python/Python39/Lib/site-packages.

The folders should be there.

FinnBoiG commented 3 years ago

it mainly works but it keeps on giving errors like these, how do i fix it? image

sam-the-programmer commented 3 years ago

Have you tried pip install ursina again?

FinnBoiG commented 3 years ago

yeah i have

pokepetter commented 3 years ago

Try this to get rid of the error: Go under "Advanced" to "–paths" and add folder "YOUR_PYTHON_FOLDER/Lib/site-packages/panda3d"

DragonlordNewb commented 1 year ago

it isn't working for me either, it's saying that i'm not providing a graphics pipe

kowshik1234 commented 1 year ago

Worked like a charm, thanks !