Trouble getting python-magic working

For a project I’m working on, I’m attempting to use the python-magic library. Whenever I try to import magic, I get the error ImportError: failed to find libmagic. Check your installation. From my attempts to fix this, I believe I’ve found the issue, which is that libmagic.so.1 is required, but not installed. I figure I can somehow install this with Nix, but I’m stuck with figuring out how and I’d appreciate some help troubleshooting. :slight_smile:

pip install libmagic doesn’t work? Try poetry add libmagic.

Poetry uses pip, though

1 Like

It worked for another person.

I believe Matt installed it just fine, it just requires a library that he doesn’t have.

2 Likes

@MattDESTROYER try adding the pkgs.python311Packages.magic package to the pkgs section of your nix file, and see if that works.

3 Likes

Yeah, I already tried that, that’s why I came here lol

2 Likes

Try adding pkgs.file (file depends on libmagic afaik).

3 Likes

That seems to have fixed it, thanks!

3 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.