0

I am having significant trouble installing some Python libraries/dependencies for a project I have to work on, specifically with libmagic. I have tried to install libmagic several ways with no success - installing it through my code editor terminal, installing it through terminal with pip, installing it via Homebrew (including removing Python and existing items and re-installing everything with homebrew).

I consistently receive the following error:

ImportError('failed to find libmagic. Check your installation')

to which I tried to install libmagic with pip. However, I can find a libmagic folder/file after this, but I continue receiving errors, such as a ModuleNotFoundError when I try to run import magic. I tried various pip install commands with no luck.

I then tried to uninstall everything Python and libmagic related, and reinstall it these Homebrew instructions), and I continued to get errors. I also tried installing it using Python libmagic for Apple Silicon, and it did not work.

Finally, with the help of a colleague, he used the terminal to determine that there was an architecture error, very similar to this incompatibility error listed in How to solve libmagic.dylib - incompatible architecture error?. I tried following some of the suggestions such as arch -arm64 brew install python, or arch -arm64 brew install libmagic, which had no success.

Does anyone have any idea what I can do here? It is more or less the last dependency I need to install and it's causing so many issues. I will happily uninstall everything again and start from zero if there is a clear way of having this work. Maybe there is a step I need to do, similar to the arm64 brew python install to help facilitate it installing properly.

10
  • This seems to mix a lot of issues, it's also rather difficult to provide ideas as "continue to get errors", "similar to this error" etc. don't give any details about what actually might be wrong. Please add the actual commands run, and the full error output you get by copy/paste the text from Terminal and format as code.
    – nohillside
    Commented Apr 16 at 14:35
  • Are you using the Intel version of Homebrew (in /usr/local/bin) or the ARM version (in /opt/homebrew/bin)? How did you install Python, and pip?
    – nohillside
    Commented Apr 16 at 14:37
  • In response to your first question, unfortunately this happened about three weeks ago and I sort of gave up at the time and have closed the terminal windows I was using, so I do not have the exact errors anymore which is why I linked to other stack overflow problems with had similar errors - as I was looking at these to try to solve my problem initially. In response to your second question, this is my output from terminal: % which brew /usr/local/bin/brew
    – sparticat
    Commented Apr 16 at 15:22
  • Did this arm version come out later? I was using the usr/local/bin version of homebrew since the first week of getting my M1 a couple of years ago and did not run into any issues with using it until now.
    – sparticat
    Commented Apr 16 at 15:23
  • 1
    ARM Homebrew will install the correct version if it is available, even without arch -arm64.
    – nohillside
    Commented Apr 17 at 8:42

0

You must log in to answer this question.

Browse other questions tagged .