# devel/py-qt5 wont build for python 3.5



## yggdrasil (May 7, 2016)

Yet another port not building for me 
`make PYTHON_VERSION=3.5` in devel/py-qt5 fails with 
	
	



```
Error: This version of PyQt5 requires sip 4.16.6 or later.
```
 even though it is installed as py35-sip-4.17,1. Even a complete purge of /usr/ports and a subsequent `portsnap fetch extract` didn't help. Currently trying in a jail.

So my usual question: anyone else having this problem?


----------



## yggdrasil (May 7, 2016)

Update:
The initial problem was solved by the fact that the updated sip version was installed as sip-3.5, while /usr/loca/bin/sip remained at too low a version. A symlink later and that was resolved.
After that, pyqt could still not be build, because one of its dependencies supports only Python 3.4. Of course this is not checked before, so I had to wait for quite some time before the build failed, and even then it is burried in pages of output...
Now I tried to switch to Python 3.4, hopefully this should at least work. But no, the build fails with tons of errors from devel/py-qt5-demo like this one:

```
pkg-static: Unable to access file /usr/ports/misc/py-qt5-demo/work/stage/usr/local/share/examples/py-qt5/xmlpatterns/schema/ui_schema.pyo: No such file or directory
```
Which is true, there is no such pyo file, only the corresponding py file.


----------



## yggdrasil (May 8, 2016)

Sorry for triple-posting, but has anyone succeeded in building QT5 with some form of python3? I'm down to using a Ubuntu VM, which makes the experience almost depressingly easy by comparison


----------



## eriknstr (Jul 26, 2016)

Thanks to your post, I was able to install PyQt5 with Python 3.4.

Originally, I wanted PyQt5 for Python 3.5 (actually, most of all I wanted PySide2 for Python 3.5, but when installing that from source failed, I decided to turn my attention to PyQt5 for now), but when even with a symlink that didn't work, I used


```
pkg info py35-\*
```
to figure out which packages had been installed during the failed install and removed these.

Subsequently, I removed the packages in question. I think it was only py35-sip and py35-qt-core, but I don't remember for sure, so compare the output of the above given pkg info command for yourself. (And remember that said command lists all Python 3.5 packages, so don't remove all of them -- just remove the ones relating to PyQt5.) Anyway, in your case, I think you already have done this, I just mention it for the sake of others coming to this thread.


```
sudo pkg remove py35-sip
sudo pkg remove py35-qt5-core
```
For me, this removal step worked ok because I only had a couple of py35-packages since before, so I was able to tell which were from before and which were related to the attempted install of PyQt5.

Next, I removed the first symlink I had made to sip-3.5 and I cleaned all ports


```
rm /usr/local/bin/sip
find /usr/ports -name work | xargs dirname | xargs -I{} sh -c 'cd {} && make clean'
```
then I began build and install using Python 3.4


```
cd /usr/ports/devel/py-qt5
sudo make PYTHON_VERSION=3.4 install
```
and when it got to where it couldn't find sip, I made a symlink and continued


```
ln -s sip-3.4 /usr/local/bin/sip
sudo make PYTHON_VERSION=3.4 install
```
and when it failed at the py-qt5-demo stage as it did for you, I changed the config options of py-qt5 to not include demo, since I don't care about the demos anyway


```
sudo make config
```
the forth checkbox of the config says "demo", with description "PyQt demo and examples". Go down to it using arrows and press space once to remove the cross in the checkbox, then press enter to accept.

With that taken care of, I continued the installation


```
sudo make PYTHON_VERSION=3.4 install
```
And now I have PyQt5 with Python 3.4.

In the end, I think the port should be fixed so that it will have the demos even when using Python 3.4, and also that it should be possible to install it with Python 3.5. Until then, this is the way to get it as good as we can as end-users.


----------



## SirDice (Jul 27, 2016)

The correct way to deviate from the default is by setting DEFAULT_VERSIONS in /etc/make.conf:

```
DEFAULT_VERSIONS+= python=3.4
```
See /usr/ports/Mk/bsd.default-versions.mk.

And this: `rm -rf /usr/ports/*/*/work` is faster than `find /usr/ports -name work | xargs dirname | xargs -I{} sh -c 'cd {} && make clean'` and does exactly the same thing.


----------

