marcelotduarte / cx_Freeze

cx_Freeze creates standalone executables from Python scripts, with the same performance, is cross-platform and should work on any platform that Python itself works on.
https://marcelotduarte.github.io/cx_Freeze/
Other
1.36k stars 220 forks source link

cx_freeze not working in windows with application having long path (>260 chars) #1786

Closed rishky-msft closed 6 months ago

rishky-msft commented 1 year ago

Describe the bug I am running into an issue with a script I've built into an executable using cx_freeze. The script works fine when run as a Python script, but when run as a cx_freeze application, it fails when it encounters a file whose path is longer than 260 characters. Error it throws is ModuleNotFoundException.

I understand this is limiation of windows of not supporting long paths longer than 260 characters. Do we have anything similiar to pyInstaller in cx_freeze to support longPaths? https://github.com/pyinstaller/pyinstaller/pull/5424

To Reproduce Steps to reproduce the behavior (a setup.py or a minimal code sample will be good)

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Additional context Add any other context about the problem here.

marcelotduarte commented 1 year ago

Our manifest has longPathAware enabled. Are you using manifest option?

rishky-msft commented 1 year ago

@marcelotduarte ,

Is there any documentation for how to create the cx_freeze manifest? Can we auto generate it also for the project?

marcelotduarte commented 1 year ago

The default manifest used is https://github.com/marcelotduarte/cx_Freeze/blob/main/source/bases/manifest.txt that is the same of used by python itself. You can use a different manifest using the manifest option (https://cx-freeze.readthedocs.io/en/latest/setup_script.html#cmdoption-arg-manifest). The documentation is on Microsoft. The is a start: https://learn.microsoft.com/en-us/windows/win32/sbscs/manifests

marcelotduarte commented 1 year ago

Returning to the initial question, if you have an issue that is not in the manifest, we have to discover the origin. Do you have a way to play it with a simple app?

marcelotduarte commented 1 year ago

I think the aswer is here: https://stackoverflow.com/a/71603209/13913627

marcelotduarte commented 1 year ago

@rishky-msft The answer at SO solves this issue?

rishky-msft commented 1 year ago

Yeah seems like user has to change the windows registry setting to enable long path. I cant find any alternative to avoid changing this setting manually.

Thanks it worked


From: Marcelo Duarte @.> Sent: Sunday, February 26, 2023 10:11:34 AM To: marcelotduarte/cx_Freeze @.> Cc: Rishabh Kumar @.>; Mention @.> Subject: Re: [marcelotduarte/cx_Freeze] cx_freeze not working in windows with application having long path (>260 chars) (Issue #1786)

@rishky-msfthttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Frishky-msft&data=05%7C01%7Crishabhkumar%40microsoft.com%7C22c7beac833c4007309b08db17b3bd9a%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C638129833011970537%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=I45bzbYLIA7DHpGWOGSiQxmarkSYFr8SUt%2FI9Sawo80%3D&reserved=0 The answer at SO solves this issue?

— Reply to this email directly, view it on GitHubhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fmarcelotduarte%2Fcx_Freeze%2Fissues%2F1786%23issuecomment-1445267412&data=05%7C01%7Crishabhkumar%40microsoft.com%7C22c7beac833c4007309b08db17b3bd9a%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C638129833011970537%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=vKgM0o66G%2FU%2BCtZ08OA0GFxCdwsdNvfCgKqc2hzj%2F7E%3D&reserved=0, or unsubscribehttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAYOCBBFL5THJYGNMBVIANSLWZLNH5ANCNFSM6AAAAAAVBYD54E&data=05%7C01%7Crishabhkumar%40microsoft.com%7C22c7beac833c4007309b08db17b3bd9a%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C638129833011970537%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=t8zBtnZykQ7U1oIGz1Mob9zEgEU358EGNtzDVE1%2Bf2Y%3D&reserved=0. You are receiving this because you were mentioned.Message ID: @.***>

marcelotduarte commented 6 months ago

https://cx-freeze.readthedocs.io/en/latest/faq.html#removing-the-max-path-limitation