2

I am trying to write my first plugin following the tutorial at http://www.qgistutorials.com/en/docs/building_a_python_plugin.html.

Woking on a Mac running sierra.

The problem is that home brew will install only pyqt5 which, so far as I can tell, only works with python 3. At any rate it insists on installing python 3 and then dies trying to install sip but there are no obvious errors in the install log.

I then tried installing pyqt from https://doc.bccnsoft.com/docs/PyQt4/installation.html but again I failed to get sip installed. The page admits that "installation for mac os can be complex". I managed to build without problems but running make install tried to install sip in the same directory as python and mac os gave the error "Operation not permitted". Same thing happens if you try and add any file to that directory. Yes, I was using sudo ;) It isn't a straight forward permission problem.

Update: The fundamental problem is that the python2.7 configure magic does not know about Mac OS SIP (System Integrity Protection) which prevents files in certain directories from being modified even by root.

I have spent a morning hacking the make files produced by various python configure scripts and managed to get sip (not to be confused with SIP, above) installed and to get the pyQT4 Core to find the include files but when I try to make pyQT I get the C compiler complaining about unknown type name which indicates that something is still wrong with the headers.

At this point I give up. I suspect that the python 2.7 development environment on Mac OS after El Capitan is seriously broken.

I'd be delighted if someone proves me wrong but I suspect the chances of anyone claiming the bonus are near zero.

  • I have got this working recently, but it was fiddly and I have forgotten how! I know I installed the QT environment from their installer qt.io/download. I'll try to remember what else I did... – Alex Leith Mar 14 '17 at 11:50
  • 1
    Just send me he .bash_history and I'll figure it out ; ) – Russell Fulton Mar 16 '17 at 4:01
1

I don't think it'll help, but below is my bash history where I was trying to work it out.

I think in the end I installed QT Creator, and didn't need pyqt4. You don't need to use make any more, from memory, the UI files are fine how they are. (It's probably time to update the plugin building docs!)

brew install pyqt
brew install pyqt5
make
pyrcc5
make
ls
pyrcc4
brew install pyqt4
brew install PyQt --with-python3
pip3 install pyqt5
brew install pyqt --with-python3
brew install pyqt
pb_tool compile
pip install pb_tool
pip3 install pb_tool
pb_tool compile
pyuic4 
brew install pyqt4
python --version
python pb_tool
pb_tool
pip3 uninstall pb_tool
pip --version
pip2.7
pip2.7 install pb_tool
pb_tool
pb_tool compile
brew install pyqt
brew test pyqt4
brew cleanup
brew update
bash ~/Downloads/Miniconda3-latest-MacOSX-x86_64.sh 
conda
/Users/alex/miniconda3/bin/conda install pyqt4
/Users/alex/miniconda3/bin/conda install pyqt
pyuic5 -o icsm_qgis_transformer_dialog.py icsm_qgis_transformer_base.ui
pyuic5 -o icsm_qgis_transformer_dialog.py 
icsm_qgis_transformer_dialog_base.ui 
  • 1
    I have not had a chance to go through this but I will endeavour to replicated it with a clean set of instructions to post here. I hope you picked up the bounty as I was away over the weekend and it looks like it expired. – Russell Fulton Mar 19 '17 at 19:47
  • Yeah, I'm getting to the point where I need a clean slate Mac again! Lots of different things installed on here... but be aware that I don't think I got pyqt4 installed... – Alex Leith Mar 19 '17 at 21:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.