# How to compile pytorch in an executable?

**URL:** <https://discuss.pytorch.org/t/how-to-compile-pytorch-in-an-executable/89192>\
**Category:** deployment\
**Created:** [July 14, 2020, 4:35pm UTC](https://discuss.pytorch.org/t/how-to-compile-pytorch-in-an-executable/89192 "2020-07-14T16:35:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![blackonyyx](https://discuss.pytorch.org/letter_avatar_proxy/v4/letter/b/a4c791/32.png) [@blackonyyx](https://discuss.pytorch.org/u/blackonyyx)\
**Post date:** [July 14, 2020, 4:35pm UTC](https://discuss.pytorch.org/t/how-to-compile-pytorch-in-an-executable/89192/1 "2020-07-14T16:35:45Z")

</div>

Hi, Im trying to compile a game using a pytorch model for part of the game. I want it in an executable format. For some context, I am doing this using cx\_freeze on windows

But im getting a compilation error as shown in the image below. (Sorry, was unable to extract the text efficiently)

 ![photo_2020-07-15_00-22-46](https://discuss.pytorch.org/uploads/default/original/3X/a/2/a24298e958c4b56cd70536ca97a6afdaf8a464f1.jpeg)  
I dug around the errors a bit, and saw that the issue was related to how \_VF is importing torch from within torch itself? I am unsure how to amend this though.

Any suggestions as to how I can troubleshoot this? The only thing i need the model to be able to do in compilation after training the weights before all this is to feedforward an image/stack of images and come to a predicted action.

Any advise or suggestion is much appreciated! Thanks!

---

<div class="post-metadata">

**Author:** ![fingertap](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/fingertap/32/37330_2.png) [@fingertap](https://discuss.pytorch.org/u/fingertap)\
**Post date:** [April 20, 2021, 6:44am UTC](https://discuss.pytorch.org/t/how-to-compile-pytorch-in-an-executable/89192/2 "2021-04-20T06:44:56Z")

</div>

Same problem here.

Cannot freeze torch application appropriately, due to the import issue of ‘\_VF’
