Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unable to install pyside with nix on osx sierra #25619

Closed
javier-martinez-palmer opened this issue May 8, 2017 · 15 comments
Closed

unable to install pyside with nix on osx sierra #25619

javier-martinez-palmer opened this issue May 8, 2017 · 15 comments
Labels
0.kind: bug 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md 6.topic: darwin Running or building packages on Darwin 6.topic: python

Comments

@javier-martinez-palmer
Copy link

javier-martinez-palmer commented May 8, 2017

Issue description

pyside is not compiling for pythin2.7

Steps to reproduce

I am new to nix, but got it working for imagemagick and other packages.
I got python, pip and wheel installed but if I try to install pyside using this command:
nix-env -i python2.7-pyside
I got a compiling error. I would expect all dependencies being downloaded and compiled.

The error looks like this:

1 warning generated.
4 warnings generated.
[  3%] Linking CXX shared library libpyside-python2.7.dylib
[  3%] Built target pyside
make: *** [Makefile:139: all] Error 2
builder for ‘/nix/store/8q7pafp19jzhaam07dj17rh5m5na12vc-python2.7-pyside-1.2.4.drv’ failed with exit code 2
error: build of ‘/nix/store/8q7pafp19jzhaam07dj17rh5m5na12vc-python2.7-pyside-1.2.4.drv’ failed

Nix looks awesome so far. Some help would be great, thanx in advance.

Technical details

  • System: osx sierra 10.12.4
  • Nix version: nix-env (Nix) 1.11.9
  • Nixpkgs version: 17.09pre107131.c882b967c1
  • Sandboxing enabled: /etc/nix/nix.conf: No such file or directory
@FRidh FRidh added 6.topic: python 0.kind: bug 6.topic: darwin Running or building packages on Darwin labels May 8, 2017
@FRidh
Copy link
Member

FRidh commented May 8, 2017

That error of course shouldn't happen. I'm not using Darwin so I can't help you much further here.

In any case, nix-env -i python2.7-pyside is not a supported workflow for Python on Nix. Please read the Python section in the Nixpkgs to find out how to install a Python environment.

@javier-martinez-palmer
Copy link
Author

javier-martinez-palmer commented May 8, 2017

Well, not sure if I did it right, most documentation seems to be outdated, but among other blogs and documentation I found this https://nixos.org/wiki/Python
Those are the packages I have installed when I run nix-env -q:

imagemagick-6.9.7-6
nix-1.11.9
nss-cacert-3.30
p7zip-16.02
python-2.7.13
qt-4.8.7

( qt-4.8.7 should not be needed, probably is detected as dependency already but I installed it just in case )
When I do nix-env -qaP | grep pyside I get this :

nixpkgs.pysideApiextractor                                     pyside-apiextractor-0.10.10
nixpkgs.pysideGeneratorrunner                                  pyside-generatorrunner-0.6.16
nixpkgs.python27Packages.pyside                                python2.7-pyside-1.2.4
nixpkgs.python27Packages.pysideShiboken                        python2.7-pyside-shiboken-1.2.4
nixpkgs.python27Packages.pysideTools                           python2.7-pyside-tools-0.2.15

but as said, if I do nix-env -i python2.7-pyside or nix-env -i python2.7-pyside-1.2.4 doesnt work...

@copumpkin
Copy link
Member

copumpkin commented May 9, 2017

Here's the actual error:

/private/var/folders/vv/17b_hycx691699h20v458fnh0000gn/T/nix-build-python2.7-pyside-1.2.4.drv-0/PySide-1.2.4/plugins/customwidget.h:27:10: fatal error: 'QtDesigner/QtDesigner' file not found
#include <QtDesigner/QtDesigner>
         ^~~~~~~~~~~~~~~~~~~~~~~

To me that suggests that on Darwin, Qt is supposed to produce a .framework, and perhaps our common Qt builder doesn't build that. Someone more Qt-focused might want to chime in. Perhaps @periklis, who knows both Qt and Darwin?

@javier-martinez-palmer
Copy link
Author

Installing pip, wheel, setuptools and qt and using pip to install pyside gives the same error. In case this helps anyone.

As a side note, I also had to fix some rights under the /nix folder. Suddenly I got no rights to write or remove some files ( nix-collect-garbage -d. and nix-env -i were failing because of that)

@periklis
Copy link
Contributor

periklis commented May 9, 2017

If you need the QtDesigner Headers then you should add qttools to your buildInputs. I patched a while ago the submodule qttools for qt-5/5.8 to work on darwin.

@javier-martinez-palmer
Copy link
Author

I don't need them. This is for pyside that is using qt-4.8.7.

@periklis
Copy link
Contributor

But pyside needs qt and specifically qtdesigner from qttools. I am not sure if we even build qttools for 4.8.7

@javier-martinez-palmer
Copy link
Author

Yeah well I don't mind having the designer or other tools, but there is nothing I specifically need. With or without attools I don't mind.
That being said, if you need them for compiling pyside or qt you should solve that dependency...
In fact those may be gathered already (probably not the right version?)interesting test this, but sorry I cannot test right now

@javier-martinez-palmer
Copy link
Author

should be simple to fix this just the same for 4.8.7 right?

@periklis
Copy link
Contributor

Oh boy, i don't understand a word of the last two comments. However, let me explain it again. In order to compile the package pyside you need qtdesigner, which i suspect that we would do not provide for qt 4.8.7 for darwin right now. What's next?
Please try to build qt-4.8.7 with nix-build on darwin and check if we you get qtdesigner.

Imho the only qt version in nixpkgs providing the qttools/qtdesigner stuff is qt5/5.8.

@javier-martinez-palmer
Copy link
Author

I think we understand each other very well.
I assume as well pttools are not working in qt-4.8.7.
The problem is I don't have the time to test this for you.

@Enzime
Copy link
Member

Enzime commented Jul 10, 2018

Pretty sure the tools are being built, as Qt Designer can be found at ${qt4}/bin/Designer.app/Contents/MacOS/Designer and successfully runs.

After changing makeFlags in pkgs/development/python-modules/pyside/default.nix to
makeFlags = [ "QT_PLUGIN_PATH=${pysideShiboken}/lib/generatorrunner" "VERBOSE=1" ];

I get the following log which includes the commands that make is running:

https://gist.github.com/Enzime/d24cc4910e0ddf02cba1fc43078b0e27

Of note is line 625, which has the command for compiling plugins/customwidgets.cpp the file where it fails to find <QtDesigner/QtDesigner>.

On this line you can find a clearly invalid path -iframework /nix/store/nd412ggfppsh7zwdml221psjkzznvycf-qt-4.8.7/include/nix/store/nd412ggfppsh7zwdml221psjkzznvycf-qt-4.8.7/lib.

After adding cmakeFlags = [ "-DALTERNATIVE_QT_INCLUDE_DIR=${qt4}/lib/QtCore.framework" ]; to the pyside/default.nix, this leads to it correctly(?) generating -iframework /nix/store/nd412ggfppsh7zwdml221psjkzznvycf-qt-4.8.7/lib meaning that it now successfully finds <QtDesigner/QtDesigner> however the compilation fails later...

https://gist.github.com/Enzime/5a1e844358970533b8e11e1fbca1fc37

@Enzime
Copy link
Member

Enzime commented Jul 11, 2018

After noticing shiboken looking in the wrong directory for headers e.g. /nix/store/nd412ggfppsh7zwdml221psjkzznvycf-qt-4.8.7/lib/QtCore.framework/QtCore.framework/Headers/qglobal.h (line 516 in the previous log) I realized this was related to setting the ALTERNATIVE_QT_INCLUDE_DIR to ${qt4}/lib/QtCore.framework instead of just ${qt4}/lib.

After changing cmakeFlags I realized this now leads to the library being included as a system include dir instead of a framework include dir (-isystem as opposed to iframework) due to the Qt4 CMake Macros, so I had to add "-DCMAKE_CXX_FLAGS=-F${qt4}/lib" to cmakeFlags to get it to read the dir as a framework dir, effectively rendering the -isystem /nix/store/nd412ggfppsh7zwdml221psjkzznvycf-qt-4.8.7/lib generated by cmake useless.

This allows me to successfully compile pyside as well as syncplay.

However, whenever I attempt to run syncplay this leads to a segfault, potentially related to #31865 :/

https://gist.github.com/Enzime/ab6b6fd25581e87f062bfcf31146cb45

If anyone has another way of verifying that my instructions lead to a valid pyside compilation, I'd be happy to test.

@stale
Copy link

stale bot commented Jun 4, 2020

Thank you for your contributions.

This has been automatically marked as stale because it has had no activity for 180 days.

If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.

Here are suggestions that might help resolve this more quickly:

  1. Search for maintainers and people that previously touched the related code and @ mention them in a comment.
  2. Ask on the NixOS Discourse.
  3. Ask on the #nixos channel on irc.freenode.net.

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 4, 2020
@SebTM
Copy link
Contributor

SebTM commented Oct 4, 2023

Pyside 2/6 got packaged, gonna close this for now.

@SebTM SebTM closed this as completed Oct 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md 6.topic: darwin Running or building packages on Darwin 6.topic: python
Projects
None yet
Development

No branches or pull requests

6 participants