Do the dist-info folders inside one dir (made with Pyinstaller) have any purpose?

Question:

I built an one-dir app with pyinstaller but I found that there are some folder with some module files like License, Metadata, Installer etc. The folders are named as module-version.dist-info

will there be any issue if I remove those folders from the one-dir?

pyinstaller folders

Asked By: Akascape

||

Answers:

You should not remove any of them.

While your program may run and function fine without a few of them, you are likely violating some of the OSS licenses you have agreed to if you remove any of them. Also all of the files serve some purpose otherwise the package maintainers would not have included them in their package.

Removing them is unlikely to make much of an impact on size, and every file you remove increases your chances of breaking something.

Answered By: Alexander

I do when running pushing dependencies into limited resources but it depends on the package. Some packages can’t be imported on linux without the dist-info folders. I learned that the hard way.
One thing you could do is use:

pip install -r requirements.txt -t ./packages --no-compile

This won’t compile source files to bytecode

or

pip install -r requirements.txt -t ./packages --no-deps

This won’t install dependencies but in cases where they are needed, you’ll need to do some more work on your requirements.txt file. You’ll have to check the missing dependencies for the package and add them to the requirements.txt file.

Of course you can use both flags at the same time.

You can also clean up /pycache/ and /tests/ folders if any exist after the install.

I’m curious if you found better ways for this.

Answered By: user21479344
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.