Skip to content
This repository has been archived by the owner on Feb 29, 2024. It is now read-only.

mac sierra run program crash #71

Closed
aaronshan opened this issue Mar 17, 2017 · 7 comments
Closed

mac sierra run program crash #71

aaronshan opened this issue Mar 17, 2017 · 7 comments

Comments

@aaronshan
Copy link
Contributor

I installed requirments software:

brew install libxml2
brew install pyqt5
pip3 install lxml

My pyqt5 verson is 5.8.1

And when I run command:

make qt5py3

It's fine.

But when I run command:

python3 labelImg.py

the program crash. error info as below:

2017-03-17 11:08:33.287 Python[20334:13481395] *** Assertion failure in -[NSBitmapImageRep initWithCGImage:], /Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1504.81.100/AppKit.subproj/NSBitmapImageRep.m:1296
2017-03-17 11:08:33.317 Python[20334:13481395] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: cgImage != NULL'
*** First throw call stack:
(
	0   CoreFoundation                      0x00007fff98916e7b __exceptionPreprocess + 171
	1   libobjc.A.dylib                     0x00007fffad500cad objc_exception_throw + 48
	2   CoreFoundation                      0x00007fff9891bb82 +[NSException raise:format:arguments:] + 98
	3   Foundation                          0x00007fff9a365d50 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 195
	4   AppKit                              0x00007fff9650c112 -[NSBitmapImageRep initWithCGImage:] + 149
	5   QtGui                               0x000000010e93c79c _Z21qt_mac_create_nsimageRK5QIconi + 748
	6   libqcocoa.dylib                     0x000000011262cb00 qt_plugin_instance + 151216
	7   libqcocoa.dylib                     0x0000000112629db7 qt_plugin_instance + 139623
	8   QtWidgets                           0x000000010fa2fa14 _ZN5QMenu11actionEventEP12QActionEvent + 1380
	9   QtWidgets                           0x000000010f8ec53b _ZN7QWidget5eventEP6QEvent + 299
	10  QtWidgets                           0x000000010fa2d5d7 _ZN5QMenu5eventEP6QEvent + 1175
	11  QtWidgets                           0x000000010f8abd3d _ZN19QApplicationPrivate13notify_helperEP7QObjectP6QEvent + 301
	12  QtWidgets                           0x000000010f8ad0e1 _ZN12QApplication6notifyEP7QObjectP6QEvent + 369
	13  QtWidgets.so                        0x000000010f396222 _ZN15sipQApplication6notifyEP7QObjectP6QEvent + 114
	14  QtCore                              0x000000010ed46a34 _ZN16QCoreApplication15notifyInternal2EP7QObjectP6QEvent + 164
	15  QtWidgets                           0x000000010f8e060f _ZN7QWidget12insertActionEP7QActionS1_ + 367
	16  QtWidgets.so                        0x000000010f4aec42 _ZL20meth_QMenu_addActionP7_objectS0_S0_ + 146
	17  Python                              0x000000010dc81447 _PyCFunction_FastCallDict + 461
	18  Python                              0x000000010dce8959 call_function + 562
	19  Python                              0x000000010dce5d10 _PyEval_EvalFrameDefault + 26835
	20  Python                              0x000000010dce9aa3 _PyFunction_FastCall + 121
	21  Python                              0x000000010dce8933 call_function + 524
	22  Python                              0x000000010dce5d10 _PyEval_EvalFrameDefault + 26835
	23  Python                              0x000000010dce9136 _PyEval_EvalCodeWithName + 1910
	24  Python                              0x000000010dce99f9 _PyFunction_FastCallDict + 477
	25  Python                              0x000000010dc483dd _PyObject_FastCallDict + 218
	26  Python                              0x000000010dc484fc _PyObject_Call_Prepend + 149
	27  Python                              0x000000010dc48244 PyObject_Call + 101
	28  Python                              0x000000010dc948d8 slot_tp_init + 57
	29  Python                              0x000000010dc91868 type_call + 184
	30  Python                              0x000000010dc483a6 _PyObject_FastCallDict + 163
	31  Python                              0x000000010dce8800 call_function + 217
	32  Python                              0x000000010dce5d10 _PyEval_EvalFrameDefault + 26835
	33  Python                              0x000000010dce9136 _PyEval_EvalCodeWithName + 1910
	34  Python                              0x000000010dce980f fast_function + 241
	35  Python                              0x000000010dce8933 call_function + 524
	36  Python                              0x000000010dce5d10 _PyEval_EvalFrameDefault + 26835
	37  Python                              0x000000010dce9aa3 _PyFunction_FastCall + 121
	38  Python                              0x000000010dce8933 call_function + 524
	39  Python                              0x000000010dce5d10 _PyEval_EvalFrameDefault + 26835
	40  Python                              0x000000010dce9136 _PyEval_EvalCodeWithName + 1910
	41  Python                              0x000000010dcdf394 PyEval_EvalCode + 100
	42  Python                              0x000000010dd0856b run_mod + 58
	43  Python                              0x000000010dd08842 PyRun_FileExFlags + 178
	44  Python                              0x000000010dd07f69 PyRun_SimpleFileExFlags + 668
	45  Python                              0x000000010dd1be57 Py_Main + 3387
	46  Python                              0x000000010dc3ae19 Python + 7705
	47  libdyld.dylib                       0x00007fffadde4255 start + 1
	48  ???                                 0x0000000000000002 0x0 + 2
)
libc++abi.dylib: terminating with uncaught exception of type NSException

Thanks for your reply!

@aaronshan
Copy link
Contributor Author

aaronshan commented Mar 17, 2017

I had already resolved this error.

it caused by qt bug. https://bugreports.qt.io/browse/QTBUG-58344

Now, I installed pyqt5.7, it works fine.

  1. change current directory to brew repo:
cd "$(brew --repo)"
  1. change to homebrew-core's formula dir:
cd Library/Taps/homebrew/homebrew-core/Formula/
  1. reset and checkout pyqt5.rb file to pyqt 5.7 version (latest version is pyqt 5.8, it has bug.)
git reset 233b493d3b7fe4fe7e2882765507693517f9817a pyqt5.rb
git checkout pyqt5.rb
  1. install pyqt5.7
brew install pyqt5.rb
  1. reset and checkout to latest version (pyqt 5.8)
git reset HEAD pyqt5.rb
git checkout pyqt5.rb

@dqhieu
Copy link

dqhieu commented May 16, 2017

Error on step 4. Pls help!
screen shot 2017-05-16 at 10 34 18 pm

@XiomarG
Copy link

XiomarG commented May 18, 2017

I think it would be worthy to add some more input here as this is the solution to a popular question.

If you installed pyqt5@5.7.1 and still get the old error, you probably have pyqt@5.8.2. Do brew uninstall pyqt to make sure you only have pyqt5@5.7.1 in your system.

@dqhieu
Copy link

dqhieu commented May 18, 2017

I have not installed pyqt5@5.7.1 before

@aaronshan
Copy link
Contributor Author

@dqhieu Did you already installed pyqt5?

@XiomarG
Copy link

XiomarG commented May 19, 2017

@aaronshan I am not very familiar with brew structure but as you can see in my comment, it seems recently when you install pyqt5, there won't be any pyqt5.rb but only pyqt.rb. And that pyqt is version 5.8.2. Did pyqt5 change the way it's installed?

@santhoshdc1590
Copy link

santhoshdc1590 commented Feb 13, 2018

installing Qt5 through pip3 inside virtual environment worked just fine for me
This link was useful How can I install PyQt5 on Mac?

First Error I got

Traceback (most recent call last): File "labelImg.py", line 24, in <module> from PyQt4.QtGui import *

I uninstalled Qt5 using brew uninstall pyqt

I just use pip3 install PyQt5

Then ran
make qt5py3
python labelImg.py

Then got error
from lxml import etree ModuleNotFoundError: No module named 'lxml'

So installed pip3 install lxml

It worked Awesome!!!!!!!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants