# Error while upgrading python25 -> 26



## nORKy (Jun 9, 2009)

I read /usr/ports/UPDATING
- portmaster -o  lang/python26 lang/python25 -> ok
- cd /usr/ports/lang/python && make upgrade-site-packages -> KO

upgrade-site-packages fails in /usr/ports/math/py-numeric -> /usr/local/include/python2.6/Python.h:168:17: error: pth.h: No such file or directory

What's happend ?

Thanks you


----------



## gedge (Jun 9, 2009)

have you got *portupgrade* installed?

I see you used *portmaster* in the first line, but did not use


```
make PORTUPGRADE_CMD=/usr/local/sbin/portmaster upgrade-site-packages
```

as instructed.  You maybe need to decide which you are using.


----------



## gedge (Jun 9, 2009)

Also, there is a bug - if you don't have *portupgrade* installed, then the *upgrade-site-packages* will fail (no *pkg_which*).

I used


```
make PORTUPGRADE_CMD=/usr/local/sbin/portmaster PKG_WHICH_CMD="-n 1 pkg_info -W | sed 's/.* was installed by package //'" upgrade-site-packages
```

but it take an *hour longer*!


----------



## jb_fvwm2 (Jun 9, 2009)

I typically do not use either portupgrade nor portmaster for
those wholesale upgrades (the computer can not be on that long)
so have to do it manually.
The procedure is easy at first (py25 >> py26) then
gets tedious 

```
#cd /var/db/pkg
# ls -lac | hgrep py25-a
```
but can be done a few per day. (a, b on Monday, c,d, on Tuesday, )

```
#cd /usr/ports/devel/py-[something/
#/bin/rm -rf work
#pkg_delete -f /var/db/pkg/py25-[something] && make install && yell
```

I doubt anyone knows of a speedier more reliable way if one only
can upgrade a few hours at a time.  If not, someday someone
may devise one and include it along with the major 2 methods
in UPDATING.
...........
I found quite a few ports which depended upon python which
had to be reinstalled, whose versions were not bumped.
in /python2.5/site-packages/
...
one can pkg_which  each subdir THEN the
remaining files with the wildcard "pkg_which * " (below)
.........
reinstalling as necc; 
,.,,,,
in site-packages/ (once the subdir's have been cleaned out
) one can do the same for files within the subdir
/python2.5/site-packages#  pkg_which *
may show something like
...................
?
?
gnome-menus
?
tel
?
libproxy
?
...................
so you would have a few rebuilds only remaining.
...
thereupon one can /bin/rm -rf site-packages (python2.5) 
if no rebuilds remain within it.


----------



## itetcu@ (Jun 10, 2009)

The support for portmaster as described in UPDATING wasn't really working.
We're currently testing this patch (all OK so far):
http://people.freebsd.org/~wxs/python26-portmaster.diff

It replaces the use of pkg_which with pkg_info which is run in paralled for the nuber of CPUs/cores you have.

If you want to use it, apply it to lang/python/Makefile
then
cd /usr/ports/lang/python && make upgrade-site-packages -DUSE_PORTMASTER

You can use PORTUPGRADE_ARGS if you need any other custom args passed to portmaster
(for example I'm usingPORTUPGRADE_ARGS=-dv)

Please drop me, wxs@ or miwi@ a mail with your succes/failure storry.


----------



## itetcu@ (Jun 10, 2009)

nORKy said:
			
		

> I read /usr/ports/UPDATING
> - portmaster -o  lang/python26 lang/python25 -> ok
> - cd /usr/ports/lang/python && make upgrade-site-packages -> KO
> 
> ...


math/py-numeric builds fine on QAT.

The code failing for you is:

```
#ifdef HAVE_PTH
/* GNU pth user-space thread support */
#include <pth.h>
#endif
```

That pth.h is /usr/local/include/pth/pth.h installed by pth-2.0.7.

Do you have pth port installed?

The code that brings pth in is:

```
.if !defined(WITHOUT_THREADS)
.if defined(WITH_PTH)
CONFIGURE_ARGS+=        --with-pth
EXTRA_PATCHES+=         ${PATCHDIR}/extra-patch-configure-pth
LIB_DEPENDS+=           pth:${PORTSDIR}/devel/pth
_PTH_CPPFLAGS=          "-I${LOCALBASE}/include/pth"
_PTH_LDFLAGS=           "-L${LOCALBASE}/lib/pth"
CONFIGURE_ENV+=         CPPFLAGS="${_PTH_CPPFLAGS} ${CPPFLAGS}"
CONFIGURE_ENV+=         LDFLAGS="${_PTH_LDFLAGS} ${LDFLAGS}"
```

Do you have custom CFLAGS or LDFLAGS?

Please also post the output of make showconfig for python26.


----------



## nORKy (Jun 10, 2009)

```
# make showconfig
===> The following configuration options are available for python26-2.6.2:
     THREADS=on "Enable thread support"
     HUGE_STACK_SIZE=off "Use a larger thread stack"
     SEM=off "Use POSIX semaphores (experimental)"
     PTH=on "Use GNU Pth for threading/multiprocessing"
     UCS4=on "Use UCS4 for unicode support"
     PYMALLOC=on "Use python's internal malloc"
     IPV6=on "Enable IPv6 support"
     FPECTL=off "Enable floating point exception handling"
===> Use 'make config' to modify these settings
```

I have no custom CDLAGS or LDFLAGS and pth is installed


----------



## itetcu@ (Jun 10, 2009)

Thanks for the bug report.

Reproduced. Python misses to pass -I${LOCALBASE}/include/pth (and L${LOCALBASE}/lib/pth I think) down the line.

python built WITH_PTH and py-numeric with extra CFLAGS+=-I${LOCALBASE}/include/pth:
http://t64.tecnik93.com//logs/8-STABLE-amd64/py26-numeric-24.2_3.log

python built WITH_PTH and pristine py-numeric:
http://t64.tecnik93.com//errors/7-STABLE-amd64/py26-numeric-24.2_3.log

I'm trying to figure out a fix.


----------



## nORKy (Jun 10, 2009)

I turn pth off and now, there is no error


----------



## jb_fvwm2 (Jun 11, 2009)

```
# cd /usr/local/bin
# file a* | hgrep python
```
(something similar in /usr/local/libraries/)
may find even more "2.5" after the 2.6 upgrade
if one wants to be really thorough....
(as an addendum to my post above)...
(one would repeat each letter of the alphabet, or

```
file *
```
if to include binaries starting with uppercase or numerals...


----------



## itetcu@ (Jun 11, 2009)

FYI, the patch I was talking about has been committed and UPDATING intructions updated.


----------



## zilfrid (Jul 17, 2009)

*I try this ...*

ln -s /usr/local/include/pth/pth.h /usr/local/include/python2.6/
ln -s /usr/local/include/pth/pthread.h/usr/local/include/python2.6/


----------

