3

I have tried to install pyside together with python3 on osx mountain lion. I have been trying both

brew install pyside

But then it only works in python2.

I have also tried using the buildscripts from the pyside github rep. Making the changes needed

./build_and_install

fails however, with

Linking CXX shared library libpyside.cpython-33m.dylib
[  4%] Built target pyside
[  4%] Running generator for QtCore...
/bin/sh: /Users/einar/devel/pkg/pyside-sandbox-python3/bin/SHIBOKEN_GENERATOR-NOTFOUND: No such file or directory
make[2]: *** [PySide/QtCore/PySide/QtCore/qabstracteventdispatcher_wrapper.cpp] Error 127
make[1]: *** [PySide/QtCore/CMakeFiles/QtCore.dir/all] Error 2
make: *** [all] Error 2

I don't know what to do now. I found this page pyside forum suggesting that I only have to symlink some stuff to get it working in python3 after doing brew install pyside but /usr/local/Cellar/pyside/1.1.2/lib only has files named 2.7 something.

Has anyone managed to get pyside working with python3 on osx or know of some guide on how to do it? My google-fu is failing me.

evading
  • 3,032
  • 6
  • 37
  • 57
  • Did you ever get this sorted? I [feel your pain](http://stackoverflow.com/questions/15159722/pip-install-pyside-fails-qtcore-framework-check-os-x "pip install PySide fails QtCore Framework check (OS X)"), though I'm having separate issues (not using homebrew, QtCore link problems, etc.). – Chris Krycho Mar 01 '13 at 19:57
  • @ChrisKrycho No, not yet, but there are people working on it I think https://github.com/mxcl/homebrew/issues/16439 – evading Mar 04 '13 at 11:38
  • that's good to know. I've been thinking about trying homebrew for a while, but things like this have kept me away so far. – Chris Krycho Mar 04 '13 at 13:13
  • @ChrisKrycho it's pretty good for many other things. And you can allways choose what you want to manage with it, and do the rest manually. – evading Mar 05 '13 at 09:38

3 Answers3

5

This has been fixed in Homebrew (see wiki). Installing Pyside with

brew install pyside --with-python3

will install it for both Python 2 and Python 3. For this to work, you may have to uninstall shiboken and pyside first if they were already installed for Python 2.

Loïc Séguin-C.
  • 1,806
  • 2
  • 13
  • 14
  • N.b. This is broken again as of early 2014. The homebrew recipe no longer supports the `--with-python3` option, though I am hoping someone will add in back in sooner rather than later (possibly I will be able to do it sometime in the next month). – Chris Krycho Mar 10 '14 at 17:59
  • Further update: as of [this pull request](https://github.com/Homebrew/homebrew/pull/27504) (which should be in the release shortly), this works again. I didn't do it, but I'm very grateful to the fellow who did. – Chris Krycho Mar 21 '14 at 13:10
2

Maybe in this case not use homebrew, and do a

pip3 install pyside

? Assuming you have brewed python3.

Edit: Does not work. That is probably the reason a homebrew formula exists for it..

lutzh
  • 4,917
  • 1
  • 18
  • 21
  • 1
    Even if you _haven't_ brewed python3, this is generally the way to go. The Homebrew docs explain that you should use `pip` for Python packages whenever possible, not `brew`. And this is _more_ true for non-Homebrew Python than for Homebrew Python. Unfortunately, there are a few packages that don't build cleanly with `pip`—and, for obvious reasons, those are generally the ones that `brew` has packages for in the first place. – abarnert Mar 19 '13 at 22:16
1

It is worth mentioning you can use homebrew with some small modifications

  1. brew edit pyside
  2. Modify which_python to return simply "python3.3" (or whatever version you are using)
  3. Add the CMAKE flag -DUSE_PYTHON3=1
  4. Save and Exit
  5. brew edit shiboken
  6. Modify python_prefix to be python3.3-config --prefix
  7. Modify python_version to be python3.3-config --libs
  8. Modify which_python to return "python3.3"
  9. brew uninstall pyside shiboken
  10. brew install pyside
  11. python3 -c "from PySide.QtGui import *"
  12. Bask in Glory.

Note! This may cause conflicts if pyside is installed for python2 as well. There is active development on this issue for both pyside and pyqt. See https://github.com/mxcl/homebrew/pull/18588

diedthreetimes
  • 4,086
  • 26
  • 38