thread icon indicating copy to clipboard operation
thread copied to clipboard

importlib.metadata.PackageNotFoundError Nuitka

Open abdubanna opened this issue 2 years ago • 14 comments

Bug report

Your issue may already be reported! Please check out our active issues before creating one.

Expected Behavior

It should work with Nuitka just fine

Current Behavior

I get importlib.metadata.PackageNotFoundError: No package metadata was found for thread

Is this a regression?

Possible Solution

They say it might be the metadata thing

Steps to Reproduce (for bugs)

  1. Nuitka issues 1793 2. 3. 4.

Context

I'm trying to include thread in my nuitka build because it has things I want, but cannot because of this

Your Environment

  • Version used: 2.0.4
  • Python version:3.11
  • Link to your project: still working on it
  • Operating System and version (desktop or mobile):Windows 10

abdubanna avatar Jul 13 '24 13:07 abdubanna

@Abdullah-Albanna Hey, thanks for raising this. I'll have a look into it.

If you could provide a step by step to reproduce this, it would also help :>

caffeine-addictt avatar Jul 13 '24 14:07 caffeine-addictt

@caffeine-addictt If you just use the thread module normally

and compile it with nuitka (any version would trigger this), you would get this error once upon opening the newly compiled binary.

now I do know that it is fixable to just use an older version of python (3.6 and below), I haven't tested it yet though.

Pretty sure is because of metadata.distribution and metadata_distribution!.

I'd love this getting fixed, I think thread is awesome

abdubanna avatar Jul 13 '24 14:07 abdubanna

@Abdullah-Albanna Thanks.

Perhaps it's a windows thing? I tested compiling and running on archlinux on python3.11 and python3.13. No issues.

caffeine-addictt avatar Jul 13 '24 14:07 caffeine-addictt

@caffeine-addictt might, I'll try on arch and mac right now

abdubanna avatar Jul 13 '24 14:07 abdubanna

@Abdullah-Albanna

If its still non-reproducible, I'm willing to revert back to manually incrementing the version numbers.

(I seriously need to create an auto increment script 🤣)

caffeine-addictt avatar Jul 13 '24 14:07 caffeine-addictt

@Abdullah-Albanna

It's also compiling and running perfectly fine on python3.11 on my windows machine.

Are you using nuitka latest version?

caffeine-addictt avatar Jul 13 '24 15:07 caffeine-addictt

@caffeine-addictt

Okay, my other machines are acting weird, couldn't compile on it :(

anyway, I found out that it works if compiled without the --standalone

compile yours like so, nuitka --standalone py_file.py

you'd see that error

abdubanna avatar Jul 13 '24 15:07 abdubanna

@Abdullah-Albanna

Ah, I see. I can reproduce it now.

caffeine-addictt avatar Jul 13 '24 15:07 caffeine-addictt

@caffeine-addictt

Yeah, you should try with an older version of python and work you way from there to see what's wrong with it

abdubanna avatar Jul 13 '24 15:07 abdubanna

@Abdullah-Albanna

If its still non-reproducible, I'm willing to revert back to manually incrementing the version numbers.

(I seriously need to create an auto increment script 🤣)

Think I'll go with this. Tested it out with v2.0.1, the last version before I had importlib resolve the version number, and it compiles with the standalone flag

caffeine-addictt avatar Jul 13 '24 16:07 caffeine-addictt

@caffeine-addictt

Great, that works.

abdubanna avatar Jul 13 '24 16:07 abdubanna

@Abdullah-Albanna

I'll be including the patch in v2.0.5 (#143). Feel free to reopen this issue if the issue still persists :>

Again, thanks for your contribution〜

caffeine-addictt avatar Jul 13 '24 17:07 caffeine-addictt

@Abdullah-Albanna

Merged https://github.com/python-thread/thread/commit/4608b55a8cc84fe526585a6f7eae21f49c6718d3.

And it's up on PyPI now.

pip install thread==2.0.5

caffeine-addictt avatar Jul 13 '24 17:07 caffeine-addictt

@caffeine-addictt

That's awesome, loving it 😁

abdubanna avatar Jul 13 '24 17:07 abdubanna