-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] FileNotFoundError jaraco/text/Lorem ipsum.txt when importing pkg_resources #3072
Comments
Hi @thinhha thank you very much for opening the issue. I just double checked the If I build setuptools locally with I also double checked in setuptools' own configuration file, and this file is being included in the Line 16 in 763cf01
which, according to this table, indicates that they should be included in the distribution. Any chance this problem is being caused by the tool you are using to build a zip executable? (e.g. if there is a problem in Can you reproduce this issue, without using |
This is linked to the issue that Bazel does not play nicely with spaces in file names. I've just been bitten with this whilst using a Poetry rule from Bazel, with no way to pin the I've confirmed that renaming the file to use an underscore allows Bazel to symlink it into the runfiles just fine. |
Thank you very much for the investigation @edward-watson-oxb ! Would you (or any other member of the community) be interested in providing a PR with the name change to https://github.com/jaraco/jaraco.text? (As a temporary workaround for the bazel limitation) I think that if the reasons are well explained, the upstream project has good chances of accepting it... Otherwise I am afraid that the fix will have to come from the bazel side... |
Actually, I'll be unlikely to accept a change to rename the file without spaces. Setuptools itself has files that have spaces in the name. See #134. Can you look into how it is that bazel is able to build setuptools<60.7 without the issue? |
One thing that makes this issue particularly problemmatic is that the behavior is invoked on import, and it's behavior that Setuptools doesn't even need. I'm slightly tempted to move the functionality to another library entirely. It just feels like a whole lot of overhead to create an entirely new project to host functionality to be shared by pkg_resources and setuptools. |
I may consider patching jaraco.text when it's vendored to eliminate the file or rename it. |
I looked into making that property lazy-loaded, but that only led me to a deficiency in doctests. I'd probably have just inlined those two lines of text, except Python linters are hostile to long lines (hobgoblins of our collective minds), and I want to cleanly present the content (without introducing intervening characters to accommodate Python). |
As far as I can tell, the manifest file is only used on Windows. If Bazel is running on a Linux host, there is no attempt for the file to loaded. In some cases of Bazel rules, they ignore these files entirely. And in others, I would imagine they have to just manually patch packages when they are downloaded - but I have no public examples of this. Edit: Or vendor those packages into their own repo and commit changes there, of course! |
pypa/setuptools#3072 is resolved.
* chore(deps): update dependency setuptools to v60.7.1 * chore: remove link to issue pypa/setuptools#3072 is resolved. Co-authored-by: Anthonios Partheniou <partheniou@google.com> Co-authored-by: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com>
@jaraco would you be willing to reopen this? This is breaking our usage of a package that depends on |
How or where did you rename the file as a hotfix @edward-watson-oxb? |
I can't remember exactly the path but it was within the Bazel directory after it downloaded the dependency. It wasn't really long-term solution, it was just a test to check that this was the fix required/that would solve the issue. It would be somewhere under a location like: If you can't fix it by bumping setuptools to a version where the filename was fixed, or pinning to a previous version, then you could probably try and apply a patch to the dependency using Bazel to make this more permanent. |
Re-opening as #4457 re-introduced the offending behavior. |
Indeed. By applying the workaround in #3077, it masked the flaw in Bazel and left developers there complacent to the concern. Now that Setuptools no longer maintains patched copies of dependencies, it's no longer feasible for the vendored copies to be altered to address downstream issues. Instead, the best recommendation would be for affected environments (Bazel) to patch the offending project (jaraco.text) directly (either vendored or unvendored, and preferably the latter), or even better, implement support for valid filenames. See #4487. |
setuptools version
setuptools==60.7.0
Python version
3.9
OS
Debian 11
Additional environment information
No response
Description
FileNotFoundError when importing
pkg_resources
Expected behavior
Pinning setuptools==60.6.0 in requirements.txt works fine. This issue started with setuptools==60.7.0.
How to Reproduce
Using Bazel and rules_python, build a zip executable using:
Output
The text was updated successfully, but these errors were encountered: