0

I am trying to make my python file as an executable using Pyinstaller. After the process of conversion has finished, in my dist folder, when I click on "myApplication.exe" I get the following error: FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\user\\Desktop\\Application\\dist\\myApplication\\smart_open\\VERSION' [17416] Failed to execute script myApplication

I've already searched for answers to this but none of them have the specific error as mine which is the folder smart_open\VERSION as I have no idea what that's supposed to be.

EDIT

The smart_open folder does not even exists in my myApplication folder

8
  • Is VERSION a text file with the version number in it? Commented Aug 13, 2019 at 17:34
  • I do not even have the smart_open folder in the first place to have VERSION, not sure what is happening Commented Aug 13, 2019 at 17:37
  • 1
    Do your application use the pip package smart_open? Commented Aug 13, 2019 at 17:39
  • The package is in the Lib\site-packages folder, however my application is not importing it, unless some other library has it as a dependancy? not sure. Commented Aug 13, 2019 at 17:43
  • Maybe this answer can help you, it is about hidden import. Is there a version file in the Lib\site-packages\smart_open? Commented Aug 13, 2019 at 17:45

2 Answers 2

2

Instead of using the original version of "smart_open" use this fork of the library: https://github.com/rs-trevor/smart_open

The pull request is here: https://github.com/RaRe-Technologies/smart_open/pull/344

It essentially converts the strange (extension-less) "VERSION" file into "version.py" so pyinstaller picks it up correctly

I encountered the same issue posted it within the smart_open github: https://github.com/RaRe-Technologies/smart_open/issues/345

Sign up to request clarification or add additional context in comments.

Comments

1

I think you have to add the VERSION file of smart_open in the spec file. More information in the documentation.

Edit

In this case, datas line should be:

datas=[ ('c:\\python360564\\lib\\site-packages\\smart_open\\VERSION', 'smart_open\\VERSION' )], 

The first part is the initial path of the file and the second the destination path (get from the error message).

2 Comments

I tried the technique (several different ways) you mentioned above @ndclt but it wasn't working for me. I essentially did this in the ".spec" file datas=[ ('c:\\python360564\\lib\\site-packages\\smart_open\\VERSION', '.' )], and the error still occurred.
I think the . of the second expression in the tuple should be replaced. I edited my answer with a try.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.