# Ports constantly tries to rebuild/reinstall lang/python27



## Grell (May 18, 2011)

Hi, whenever I try to upgrade my ports using portupgrade (I use the *-Rra --batch* flags) it always tries to reinstall python27 resulting in failure with the message:


```
===>   python27-2.7.1_1 is already installed
      You may wish to ``make deinstall'' and install this port again
      by ``make reinstall'' to upgrade it properly.
      If you really wish to overwrite the old port of lang/python27
      without deleting it first, set the variable "FORCE_PKG_REGISTER"
      in your environment or the "make install" command line.
*** Error code 1
```

I was wondering if there was a way to fix this.  I have checked /usr/ports/UPDATING and was unable to find an entry in there.  Thanks ahead of time


----------



## jb_fvwm2 (May 18, 2011)

Cannot answer the post because your entire situation is not posted in more
context, so the below only applies to python26 > python27 to fix *that* issue in the meantime...  (maybe some typos in the below)
.........................................................
(assumes /yell/, /portmaster/, and your packages line 
(version-specific) in 
/usr/local/etc/.portmasterrc (if that latter file works, )
.........................................................
Cannot directly help, but I upgraded py26 > py27 somewhat this way (not exactly this way...)
** ROUGH DRAFT **

```
1... comment out the conflict line in python27 if it exists
2... /bin/rm -rf work if it exists
3... make build && yell
4... pkg_delete -f /var/db/pkg/python2-6 ( or its exact name) && yell
5... cd /var/db/pkg
6... ls -lac | grep py26 | tee -a /tmp/python26_redo.fil
6a... nitpicking, but the above will fail if one has for some reason
.....another file for some reason (not a port directory) there with
.....py26 included in the name... sometimes happens...
7... cd /tmp
8... cat python26_redo.fil | xargs -J % portmaster -d -B -P %
9... cd /usr/local/lib/python2.6/site-packages
10.. ls -lac | grep -v drw  # shows files to guess at what to rebuild as above
11.. ls -lac | grep drw # show dir's to guess at what to rebuild as above
12... when done rebuilding, pkg_which the remaining files (site-packages)
to guess if it is ok to /bin/rm -rf the /python2.6/ yet
13... cd /var/db/pkg
14... ls -lac | grep py   # a few ports may remain...
```
Actually, I did without knowing the above and it took longer, and I actually use  a pipe to prepare better so it takes shorter (from now on
anyways if included with the above procedure). 
Other all-at-once ways are probably more suitable if one has only a few python ports installed.  But many ports which list in +REQUIRED_BY in 
python still function with the new python27 without rebuild.


----------



## wblock@ (May 18, 2011)

Grell said:
			
		

> Hi, whenever I try to upgrade my ports using "portupgrade" (i use the -Rra --batch flags)



Pirate mode is not necessary.  -arR is equivalent to -a.  And -a can be a mistake, because it tries to do everything.  At least check /usr/ports/UPDATING to see if it will miss anything listed there.

I don't use --batch, because -c or -C lets you actually set the options you might need before it starts building.



> it always tries to reinstall python27 resulting in failure with the message:
> I was wondering if there was a way to fix this.  I have checked /usr/ports/UPDATING and was unable to find an entry in there.  Thanks ahead of time



Did you do both steps of 20110304?


----------

