1

I tried to install the pyqt5 package für python 3.9 on Mac. Since it didn't work via pip3 I installed it via Homebrew

% brew install pyqt5

and it seemed to work since the terminal says, if I try

pip3 install pyqt5

the requirements are already satisfied. Yet, if I start PyCharm to to write and test my program it can't find the libraries etc. What do I have to do?

1 Answer 1

1

I just tried to brew install pyqt5 on my Mac. brew then installed a new Python 3.9 interpreter (this is viewed as a dependency of pyqt5).

I suspect the same has happened on your system: brew has installed a whole new Python interpreter, and now when you type pip3 at the command line, you're finding the version of pip installed by brew, which is telling you that pyqt5 has been installed.

However, each Python installation on your system as its own set of packages. Your new Python interpreter has pyqt5 installed, but your original Python interpreter still doesn't.

I suspect that PyCharm is configured to use your default (original) Python interpreter, which doesn't have pyqt5 installed.

Try executing the following at your command prompt (terminal): which pip3. If you're shown a path /usr/local/Cellar/... then this confirms that when you type pip3 at the command line you're actually referring to the version of pip corresponding to a Python interpreter installed by brew.

OK, so what to do going forward?

Two options:

  1. Work with this new Python installation. Then, you'll need to install all of the packages in your previous version of Python again (e.g. just because you had Numpy installed on your original Python installation doesn't mean you'll have it installed by default for your new Python interpreter). Further, you'll have to configure Pycharm to use this Python installation. I don't know the exact steps for this, but go to the Preferences tab and look for something along the lines of 'Python Interpreter' underneath 'Project Settings'.

  2. Remove the new Python installation, figure out what's up with pip, install your desired package.

I'd go with 2). It can get messy to have multiple different versions of Python on your system, unless they're managed by an environment manager such as conda.

To that end, what went wrong when you first tried to install pyqt5?

Sign up to request clarification or add additional context in comments.

1 Comment

after using which pip3. it says /usr/local/bin/pip3. Is that correct? Now to answer your question, if I try to install PyQt5 I get a very long error, bur short version is: ERROR: Command errored out with exit status 1: command: /Library/Frameworks/Python.framework/Versions/3.9/bin/python3.9 /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip/_vendor/pep517/... ... AttributeError: module 'sipbuild.api' has no attribute 'prepare_metadata_for_build_wheel'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.