PyQt5 installation and build problems on Macbook M1

Connor Imes cimes at isi.edu
Fri Jul 29 12:59:23 BST 2022


Good morning,

I have Qt5 5.15.5_1 installed with homebrew on my Mac M1 laptop running macOS Monterey.  I’m not able to install PyQt5 using pip in a virtualenv (using the system’s Python 3.8.9).  It appears to hang, then after 1-2 hours is killed by the OS.  A verbose run shows it stuck querying for input to accept the GPL license: “This is the GPL version of PyQt 5.15.7 (licensed under the GNU General Public License) for Python 3.8.9 on darwin.”, followed by the input options, but it doesn’t appear to accept the keyboard input.  Is there a way to get past this?

I also tried building PyQt 5.15.7 from source as described in [1].  I first installed `pyqt-builder` 1.13.0.  Then the `sip-install` approach failed during build without enough info, so running `make` separately (from the `build` directory) then fails apparently trying to link with libpython3.8:


/Library/Developer/CommandLineTools/usr/bin/clang++ -stdlib=libc++ -headerpad_max_install_names  -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -mmacosx-version-min=10.13 -Wl,-rpath, at executable_path/../Frameworks -single_module -dynamiclib -o libpyqt5.dylib pluginloader.o moc_pluginloader.o  -F/opt/homebrew/Cellar/qt at 5/5.15.5_1/lib -L -lpython3.8 -framework QtDesigner -framework QtWidgets -framework QtGui -framework AppKit -framework Metal -framework QtXml -framework QtCore -framework DiskArbitration -framework IOKit -framework OpenGL -framework AGL

ld: warning: directory not found for option '-L-lpython3.8'

Undefined symbols for architecture arm64:

  "_PyDict_Next", referenced from:

      PyCustomWidgets::importPlugins(QString const&, QStringList const&) in pluginloader.o

  "_PyErr_Print", referenced from:

      PyCustomWidgets::importPlugins(QString const&, QStringList const&) in pluginloader.o

      PyCustomWidgets::getModuleAttr(char const*, char const*) in pluginloader.o

  "_PyEval_SaveThread", referenced from:

      PyCustomWidgets::PyCustomWidgets(QObject*) in pluginloader.o

  "_PyGILState_Ensure", referenced from:

      PyCustomWidgets::PyCustomWidgets(QObject*) in pluginloader.o

  "_PyGILState_Release", referenced from:

      PyCustomWidgets::PyCustomWidgets(QObject*) in pluginloader.o

  "_PyImport_ImportModule", referenced from:

      PyCustomWidgets::importPlugins(QString const&, QStringList const&) in pluginloader.o

      PyCustomWidgets::getModuleAttr(char const*, char const*) in pluginloader.o

  "_PyList_Append", referenced from:

      PyCustomWidgets::importPlugins(QString const&, QStringList const&) in pluginloader.o

  "_PyLong_AsVoidPtr", referenced from:

      PyCustomWidgets::importPlugins(QString const&, QStringList const&) in pluginloader.o

  "_PyModule_GetDict", referenced from:

      PyCustomWidgets::importPlugins(QString const&, QStringList const&) in pluginloader.o

  "_PyObject_CallFunctionObjArgs", referenced from:

      PyCustomWidgets::importPlugins(QString const&, QStringList const&) in pluginloader.o

  "_PyObject_CallObject", referenced from:

      PyCustomWidgets::importPlugins(QString const&, QStringList const&) in pluginloader.o

  "_PyObject_GetAttrString", referenced from:

      PyCustomWidgets::importPlugins(QString const&, QStringList const&) in pluginloader.o

      PyCustomWidgets::getModuleAttr(char const*, char const*) in pluginloader.o

  "_PyType_IsSubtype", referenced from:

      PyCustomWidgets::importPlugins(QString const&, QStringList const&) in pluginloader.o

  "_PyUnicode_FromKindAndData", referenced from:

      PyCustomWidgets::importPlugins(QString const&, QStringList const&) in pluginloader.o

  "_Py_Initialize", referenced from:

      PyCustomWidgets::PyCustomWidgets(QObject*) in pluginloader.o

  "_Py_IsInitialized", referenced from:

      PyCustomWidgets::PyCustomWidgets(QObject*) in pluginloader.o

  "__Py_Dealloc", referenced from:

      PyCustomWidgets::importPlugins(QString const&, QStringList const&) in pluginloader.o

      PyCustomWidgets::getModuleAttr(char const*, char const*) in pluginloader.o

ld: symbol(s) not found for architecture arm64

clang: error: linker command failed with exit code 1 (use -v to see invocation)

make[1]: *** [libpyqt5.dylib] Error 1

make: *** [sub-designer-make_first-ordered] Error 2

AFAICT the correct library path is not searched, e.g.:


$ find /Library/Developer -name "libpython3.8.dylib"

/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/config-3.8-darwin/libpython3.8.dylib

/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/libpython3.8.dylib

I’d of course prefer the `pip install` approach to building from source though.

[1] https://www.riverbankcomputing.com/static/Docs/PyQt5/installation.html

Thanks in advance,
-Connor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20220729/a2d72588/attachment.htm>


More information about the PyQt mailing list