# I unmerged python... ensuing problems....

## blunted

I wasn't able to use fetchmailconf after emergeing fetchmail so I added tcltk to USE as suggested in a post I read and unmerged then emerged again. That didn't solve the problem. I got an error saying my python probably didn't support tk so being retarded I unmerged python expecting the new USE variable tcltk to fix the possible python problem. Now emerge doesn't work. Help.

creep root # emerge

/usr/bin/env: python2.2: No such file or directory

 :Question: 

EDIT:  Moved from Other Things Gentoo.  Don't want this one to get pruned in case we turn that feature on.  Probably ought to make this a FAQ.   -- pjp

----------

## delta407

"emerge" and most of Portage is written in Python. Unmerging Python was a Bad Thing (TM).

----------

## delta407

You might be able to reinstall Python using this:

```
# cd

# tar xzf /usr/portage/distfiles/Python-2.2.1.tgz

# cd Python-2.2.1

# ./configure --with-fpectl --infodir=/usr/share/info/ --mandir=/usr/share/man

# make

# make install prefix=/usr

# rm /usr/bin/python 2>/dev/null

# ln -s /usr/bin/python2 /usr/bin/python
```

Hopefully this will be enough of Python to let you "emerge python" again.

----------

## blunted

Thank you kindly for your lightning fast response which solved my problem! Next time you're in Winnipeg you have a place to stay =P

----------

## daemonb

thank you very much, i had the same problem. Thats really sh*t. But that was really stupid of me to think there is no risk  :Sad: 

But now python is emerging  an I hope it will rule  :Smile: 

----------

## thing_from_space

I tried downgrading python to make another non-gentoo package work and really messed up emerge. I had thought about manually rebuilding it, but wasn't sure if it would work and decided against it. After searching frantically in the Gentoo forums I came across this topic. Maybe it should be made sticky.

<big sigh of relief>

 :Very Happy: 

----------

## Slayer_X

Hi, my portage system dont work, I guess Python is the problem

I reinstall manually Python and the problem persist.

I read the README.RESCUE and untar the correct file and the problema persist

When I make a 

```
emerge -p world
```

I got 

```

These are the packages that I would merge, in order.

Oops: 0000

CPU:    0

EIP:    0010:[<c015ffe8>]    Tainted: P

EFLAGS: 00010286

eax: 00000000   ebx: 00001000   ecx: ddef0000   edx: ddef52a0

esi: ddef5c00   edi: de3d8f40   ebp: ddfc9dc0   esp: dde55d98

ds: 0018   es: 0018   ss: 0018

Process install (pid: 1035, stackpage=dde55000)

Stack: ddfc9dc0 bf46999c dde55eb8 ddf11d9c 00000008 c2522dd4 ddef5c00 c0137ea2

       c0139776 ddef5c00 00000000 bf46999c 00000010 ddef5c00 00000000 00000246

       dde54000 00001000 00000010 c23c9600 00000054 00000008 ddf11d9c ddfc9dc0

Call Trace:    [<c0137ea2>] [<c0139776>] [<c01699be>] [<c0165063>] [<c0165aa4>]

  [<c015db6a>] [<c015db8c>] [<c016544b>] [<c015e0a4>] [<c015e032>] [<c015e043>]

  [<c015e12c>] [<c0160ad4>] [<c013f780>] [<c01412a7>] [<c0141496>] [<c013f754>]

  [<c0133dd3>] [<c010878f>]

Code: 8b 50 04 89 54 24 34 8b 48 08 89 4c 24 30 83 c4 14 8b 41 04

 <6>note: install[1035] exited with preempt_count 1

Calculating world dependencies   portage: aux_get(): (1) couldn't open cache entry for sys-apps/man-pages-1.54

(likely caused by syntax error or corruption in the sys-apps/man-pages-1.54 ebuild.)

```

some aditional info from my system

```
inferno root # uname -r

2.4.19-gentoo-r9

inferno root # gcc --version

gcc (GCC) 3.2 

```

Any help is welcome :)

----------

## yumbrad

I couldn't configure python, I was apparently missing g++ ... I did salvage the system though, by copying /usr/bin/python2.2 and the entire /usr/lib/python2.2 directory from a redhat8.0 system, then emerging python.  Now i'm going to try and figure out how to get rid of the cruft redhat had in /usr/lib/python2.2.

----------

## Isaiah

 *delta407 wrote:*   

> You might be able to reinstall Python using this:
> 
> ```
> # cd
> 
> ...

 

Don't know how mine got borked, but this worked for me with one minor alteration (2.2.2 instead of 2.2.1) - thanks delta407  :Wink: 

----------

## Clete2

Thanks for this post... I'm building now... I had built before without the configure options and such... Iwas trying to get python 2.3 working by unmerging python then building it manually... Stupid me  :Wink: 

----------

## Szplug

I foolishly did 'emerge unmerge python' thinking to re-emerge it, and here's what worked for me:

download & install python from www.python.org

Emerge seemed to want specifically, /usr/bin/python which wasn't there, so I just re-pointed it to the newly installed one,

  # cd /usr/bin

  # ln -s /usr/local/bin/python .

Then just read & follow the instructions from here:

/usr/portage/sys-apps/portage/files/README.RESCUE

----------

## paulbiz

I thought I had to re-emerge python, it was unable to run due to the wrong libstdc++.so.6 after GCC upgrade from 3.4.3 to 3.4.4. I couldn't recompile because g++ wouldn't run, either.

Finally, I realized the gcc 3.4.3 directories weren't on my disk anymore at all! I just copied the 3.4.3 directory from /usr/lib/<whatever>/3.4.3 on the Gentoo install liveCD into the same on my hard disk, ran ldconfig and immediately everything worked again (and I am immediately following it with revdep-rebuild  :Smile:  ).

----------

## bombcar

I wanted to remove the dependency that python had on X, so I changed my use flags but it put a little green * next to X when running emerge -pv python.

So I unmerged python.   :Embarassed:  Hopefully the stuff above will make it happy again.

----------

## eXess

worked for me too, although with modifications :

```
# cd

# tar xzf /usr/portage/distfiles/Python-2.4.2.tgz 

# cd Python-2.2.1

# ./configure --with-fpectl --infodir=/usr/share/info/ --mandir=/usr/share/man

# make

# make install prefix=/usr

# rm /usr/bin/python 2>/dev/null

# ln -s /usr/bin/python2.4 /usr/bin/python2

# ln -s /usr/bin/python2 /usr/bin/python

```

That is : Python 2.4.2 instead of 2.2.1 (that is not quite serious) and also linking to python2.4, not to python2 (I have made two symlinks, just in case someone would like to see both "python2" and "python" in the dir...) 

Anyway, after banging my head 666 times on the wall and writing "I am a stupid bastard" 3583 times with my own blood, I have promised not to unmerge Python ever again and praise the Lord that you are all so valuable helpers. delta407 : you've got a place to stay in Belgium too. Be warned! You could travel round the world with this !  :Wink: 

----------

## gasdia73

by the way, delta407 you have a place to stay in Italy too  :Wink: 

thanx alot

----------

## Joe1314

and Scotland - this should be made a sticky.

Thanks!

----------

## Thavian

*slaps self really hard*

Rightfully so stupidity was made painful as it should be in my case.

Thanks a ton!

Also add Seattle, Washington to your growing list.

----------

## wbrokow1

I stupidly removed python because I was following the gcc upgrade and made a mistake.

How can I fix this screw-up? emerge won't run now.

Thanks for any guidance

----------

## desultory

Merged the above post.

Another option which is now available would be to retrieve the package for the appropriate architecture from http://tinderbox.dev.gentoo.org/default-linux/, unpack it over the existing system (there will be error messages which can safely be ignored), emerge python and proceed with your prior task.

----------

## acoul

I had problems upgrading python to my system.  I followed this guide: 

```

emerge -C python

tar xzf /extra/download/Python-2.4.4.tar.bz2 

cd Python-2.4.4

./configure --with-fpectl --infodir=/usr/share/info/ --mandir=/usr/share/man

make

make install prefix=/usr

rm /usr/bin/python 2>/dev/null

ln -s /usr/bin/python2.4 /usr/bin/python2

ln -s /usr/bin/python2 /usr/bin/python 

```

and then issued:

```

emerge python

```

I still get the exact same error I had in the first place:

```

running build_scripts

creating build/scripts-2.4

copying and adjusting /extra/tmp/portage/dev-lang/python-2.4.4-r4/work/Python-2.4.4/Tools/scripts/pydoc -> build/scripts-2.4

copying and adjusting /extra/tmp/portage/dev-lang/python-2.4.4-r4/work/Python-2.4.4/Tools/scripts/idle -> build/scripts-2.4

copying and adjusting /extra/tmp/portage/dev-lang/python-2.4.4-r4/work/Python-2.4.4/Lib/smtpd.py -> build/scripts-2.4

changing mode of build/scripts-2.4/pydoc from 644 to 755

changing mode of build/scripts-2.4/idle from 644 to 755

changing mode of build/scripts-2.4/smtpd.py from 644 to 755

>>> Source compiled.

>>> Test phase [not enabled]: dev-lang/python-2.4.4-r4

>>> Install python-2.4.4-r4 into /extra/tmp/portage/dev-lang/python-2.4.4-r4/image/ category dev-lang

_tkinter _tkinter

Creating directory /usr/bin

Creating directory /usr/lib

/usr/bin/install -c python /extra/tmp/portage/dev-lang/python-2.4.4-r4/image//usr/bin/python2.4

if test -f libpython2.4.so; then \

                if test ".so" = .dll; then \

                        /usr/bin/install -c -m 555 libpython2.4.so /extra/tmp/portage/dev-lang/python-2.4.4-r4/image//usr/bin; \

                else \

                        /usr/bin/install -c -m 555 libpython2.4.so /extra/tmp/portage/dev-lang/python-2.4.4-r4/image//usr/lib/libpython2.4.so.1.0; \

                        if test libpython2.4.so != libpython2.4.so.1.0; then \

                                (cd /extra/tmp/portage/dev-lang/python-2.4.4-r4/image//usr/lib; ln -sf libpython2.4.so.1.0 libpython2.4.so); \

                        fi \

                fi; \

        else    true; \

        fi

Creating directory /usr/lib/python2.4

Creating directory /usr/lib/python2.4/lib-old

Creating directory /usr/lib/python2.4/lib-tk

Creating directory /usr/lib/python2.4/site-packages

Creating directory /usr/lib/python2.4/test

Creating directory /usr/lib/python2.4/test/output

Creating directory /usr/lib/python2.4/test/decimaltestdata

.

.

.

Compiling /extra/tmp/portage/dev-lang/python-2.4.4-r4/image//usr/lib/python2.4/xml/sax/handler.py ...

Compiling /extra/tmp/portage/dev-lang/python-2.4.4-r4/image//usr/lib/python2.4/xml/sax/saxutils.py ...

Compiling /extra/tmp/portage/dev-lang/python-2.4.4-r4/image//usr/lib/python2.4/xml/sax/xmlreader.py ...

Compiling /extra/tmp/portage/dev-lang/python-2.4.4-r4/image//usr/lib/python2.4/xmllib.py ...

Compiling /extra/tmp/portage/dev-lang/python-2.4.4-r4/image//usr/lib/python2.4/xmlrpclib.py ...

Compiling /extra/tmp/portage/dev-lang/python-2.4.4-r4/image//usr/lib/python2.4/zipfile.py ...

make: *** [libinstall] Error 1

 *

 * ERROR: dev-lang/python-2.4.4-r4 failed.

 * Call stack:

 *   ebuild.sh, line 1654:   Called dyn_install

 *   ebuild.sh, line 1089:   Called qa_call 'src_install'

 *   ebuild.sh, line 44:   Called src_install

 *   python-2.4.4-r4.ebuild, line 174:   Called die

 *

 * (no error message)

 * If you need support, post the topmost build error, and the call stack if relevant.

 * A complete build log is located at '/extra/tmp/portage/dev-lang/python-2.4.4-r4/temp/build.log'.

 *

 * Messages for package dev-lang/python-2.4.4-r4:

 *

 * ERROR: dev-lang/python-2.4.4-r4 failed.

 * Call stack:

 *   ebuild.sh, line 1654:   Called dyn_install

 *   ebuild.sh, line 1089:   Called qa_call 'src_install'

 *   ebuild.sh, line 44:   Called src_install

 *   python-2.4.4-r4.ebuild, line 174:   Called die

 *

 * (no error message)

 * If you need support, post the topmost build error, and the call stack if relevant.

 * A complete build log is located at '/extra/tmp/portage/dev-lang/python-2.4.4-r4/temp/build.log'.

```

emerge --info:

```

Portage 2.1.3.9 (default-linux/x86/2007.0/desktop, gcc-4.1.2, glibc-2.5-r4, 2.6.22-gentoo-r6 i686)

=================================================================

System uname: 2.6.22-gentoo-r6 i686 AMD Athlon(tm) XP 2400+

Timestamp of tree: Wed, 19 Sep 2007 05:30:01 +0000

app-shells/bash:     3.2_p17

dev-java/java-config: 1.3.7, 2.0.33-r1

dev-python/pycrypto: 2.0.1-r6

sys-apps/baselayout: 1.12.9-r2

sys-apps/sandbox:    1.2.17

sys-devel/autoconf:  2.13, 2.61-r1

sys-devel/automake:  1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10

sys-devel/binutils:  2.17-r1

sys-devel/gcc-config: 1.3.16

sys-devel/libtool:   1.5.24

virtual/os-headers:  2.6.21

ACCEPT_KEYWORDS="x86"

CBUILD="i686-pc-linux-gnu"

CFLAGS="-march=athlon-xp -pipe -O2 -mmmx -m3dnow -msse -mfpmath=sse -ftracer -fomit-frame-pointer -Wdisabled-optimization -fprefetch-loop-arrays"

CHOST="i686-pc-linux-gnu"

CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/lib/mozilla/defaults/pref /usr/share/X11/xkb /usr/share/config"

CONFIG_PROTECT_MASK="/etc/env.d /etc/env.d/java/ /etc/gconf /etc/revdep-rebuild /etc/terminfo"

CXXFLAGS="-march=athlon-xp -pipe -O2 -mmmx -m3dnow -msse -mfpmath=sse -ftracer -fomit-frame-pointer -Wdisabled-optimization -fprefetch-loop-arrays"

DISTDIR="/usr/portage/distfiles"

FEATURES="distlocks metadata-transfer sandbox sfperms strict unmerge-orphans userfetch"

GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/linux/distributions/gentoo"

LINGUAS="en el"

MAKEOPTS="-j2"

PKGDIR="/usr/portage/packages"

PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --filter=H_**/files/digest-*"

PORTAGE_TMPDIR="/var/tmp"

PORTDIR="/usr/portage"

PORTDIR_OVERLAY="/usr/local/portage"

SYNC="rsync://rsync.gentoo.org/gentoo-portage"

USE="X acl acpi alsa arts berkdb bitmap-fonts cairo cdr cli cracklib crypt cups dbus dri dvd dvdr dvdread eds emboss encode esd evo fam firefox fortran gdbm gif gnome gpm gstreamer gtk hal iconv ipv6 isdnlog jpeg kde kerberos ldap mad midi mikmod mp3 mpeg mudflap ncurses nls nptl nptlonly ogg opengl openmp oss pam pcre pdf perl png pppd python qt3 qt3support qt4 quicktime readline reflection sdl session spell spl ssl svg tcpd tiff truetype truetype-fonts type1-fonts unicode vorbis win32codecs x86 xml xorg xv zlib" ALSA_CARDS="emu10k1" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route share shm softvol" ELIBC="glibc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en el" USERLAND="GNU" VIDEO_CARDS="nvidia"

Unset:  CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, LDFLAGS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

```

----------

## BServiss

I'm having the same problem with Python. It had to start with that expat madness  :Twisted Evil: 

I would give you an emerge --info but it's borked too.

The long and short of it - I followed the instructions here, issuing Make -i to get around the libinstall error, and python is giving this response: 

```
'import site' failed; use -v for traceback

Python 2.4.4 (#2, Sep 19 2007, 18:36:06)

[GCC 4.1.2 (Gentoo 4.1.2 p1.0.1)] on linux2

Type "help", "copyright", "credits" or "license" for more information.

>>>  
```

I've also tried the binary packages with the same result.

Before I reinstall the whole stupid, bloody mess, can someone help?

----------

## BServiss

Whew - Somehow $PYTHONHOME got changed to the python site packages directory! Fixing this lets me emerge again.

But Python still bombs at zipfile.py - or what's directly after it. Any hints here? Any at all?

Another post suggests that updating something else (they weren't specific) fixes the Python issue.

----------

## acoul

this is an old problem that shows every now and then ... I am trying all different sort of things but so far I have no success ...

http://www.mail-archive.com/gentoo-embedded@lists.gentoo.org/msg01386.html

----------

## acoul

I was able to solve my problem:

```

export REAL_CHOST="i686-pc-linux-gnu"

gcc-config i686-pc-linux-gnu-3.4.6

source /etc/profile

emerge python

gcc-config i686-pc-linux-gnu-4.1.2

source /etc/profile

emerge python

```

System is quite happy now, everything looks good !!

----------

## BServiss

Python was the problem - it quit at compiling zipfile.py - or what was after it:

```

Listing /usr/local/lib/python2.4/plat-linux2 ...

Compiling /usr/local/lib/python2.4/plat-linux2/CDROM.py ...

Compiling /usr/local/lib/python2.4/plat-linux2/DLFCN.py ...

Compiling /usr/local/lib/python2.4/plat-linux2/IN.py ...

Compiling /usr/local/lib/python2.4/plat-linux2/TYPES.py ...

Listing /usr/local/lib/python2.4/lib-tk ...

Compiling /usr/local/lib/python2.4/lib-tk/Canvas.py ...

Compiling /usr/local/lib/python2.4/lib-tk/Dialog.py ...

Compiling /usr/local/lib/python2.4/lib-tk/FileDialog.py ...

Compiling /usr/local/lib/python2.4/lib-tk/FixTk.py ...

Compiling /usr/local/lib/python2.4/lib-tk/ScrolledText.py ...

Compiling /usr/local/lib/python2.4/lib-tk/SimpleDialog.py ...

Compiling /usr/local/lib/python2.4/lib-tk/Tix.py ...

Compiling /usr/local/lib/python2.4/lib-tk/Tkconstants.py ...

Compiling /usr/local/lib/python2.4/lib-tk/Tkdnd.py ...

Compiling /usr/local/lib/python2.4/lib-tk/Tkinter.py ...

Compiling /usr/local/lib/python2.4/lib-tk/tkColorChooser.py ...

Compiling /usr/local/lib/python2.4/lib-tk/tkCommonDialog.py ...

Compiling /usr/local/lib/python2.4/lib-tk/tkFileDialog.py ...

Compiling /usr/local/lib/python2.4/lib-tk/tkFont.py ...

Compiling /usr/local/lib/python2.4/lib-tk/tkMessageBox.py ...

Compiling /usr/local/lib/python2.4/lib-tk/tkSimpleDialog.py ...

Compiling /usr/local/lib/python2.4/lib-tk/turtle.py ...

Listing /usr/local/lib/python2.4/lib-dynload ...

Listing /usr/local/lib/python2.4/site-packages ...

Compiling /usr/local/lib/python2.4/site-packages/ez_setup.py ...           [ ok ]

```

The only thing I can suggest is to keep updating and revdep'ing till you can get python to compile.

----------

## acoul

if you install the binary and you still have problems compiling, then one thing you should look are  the values of the make.conf that should be set correctly.

Edit: in my case the problem was a wrong LANGUAGE setting.  The wrong setting is the one with the comment bellow:

```

#LINGUAS="en_US el_GR"

LINGUAS="en el"

```

this script might also help.Last edited by acoul on Tue Dec 04, 2007 7:43 am; edited 2 times in total

----------

## BServiss

Another issue that I stumbled upon was a java breakage. Java-config stopped after missing an import - outputformatter which was not rebuilt with all the other fun I was having with python.

The instructions  here fixed that problem.

----------

## sab

I love u all....Gentoo rocks.

Had the same problem and now solved.

----------

## kelargo

your instructions on bandaging python back to life for emerge to work properly helped me out!

----------

## panyo

Perhaps the right answer to this would be helpful at the start of the thread, as in this thread:

https://forums.gentoo.org/viewtopic-t-443022-highlight-pam+blocking+shadow.html

And both perhaps should be reflected in the GCC upgrade guide,  which may be what brought

many of us here? I am currently working on my first full system upgrade on my powerbook

because I finally had to upgrade to modular X, which I knew would break my system- and it did. 

Now, preparing to emerging world to fix X, I am doing this upgrade, which I knew would break 

my system--and it did. This is how it was long ago, and I have been reluctant to do full system 

upgrades since. But now the answers are all pretty neat and easy, and seem would not be bad 

to add to the pitfalls sections of the upgrade guides.

----------

## trossachs

Thanks so VERY MUCH delta407, it worked for me!   :Very Happy: 

----------

## zoltix

Sorry but I have litle issue could please help me  ?

[code]

bash: /usr/bin/emerge: /usr/bin/python: bad interpreter: Permission denied

[\code]

----------

## desultory

If the python interpreter is actually nonfunctional, as opposed to some mishap with configuration or selection, try the following.

Download the package from the tinderbox repository which matches the architecture of the system. Place that file in $PKGDIR on that system. Then unpack that package directly under /, tar xvjf $PKGDIR/python-2.4.4-r6.tbz2 should do it, though $PKGDIR will likely need to be manually expanded as it is not typically present in the environment. Next ln -s /usr/bin/python2.4 /usr/bin/python. Finally, emerge -K dev-lang/python.

----------

## zoltix

perfect thank a lot ..........;

----------

## Wyatt

Idiot here, uninstalled python to resolve a blocking issue (sigh).  I've gotten a python copy running but portage is giving me garbage about pysqlite (like so):

```
====================================

Error: Failed to import module 'cache.sqlite.database'

  File "/usr/lib/portage/pym/portage.py", line 1654, in load_best_module

    mod = load_mod(best_mod)

  File "/usr/lib/portage/pym/portage.py", line 156, in load_mod

    mod = __import__(modname)

  File "/usr/lib/portage/pym/cache/sqlite.py", line 14, in ?

    from pysqlite2 import dbapi2 as db_module

No module named pysqlite2

====================================
```

So I installed it on my laptop and copied it over, and the message changed but the end result didn't:

```
====================================

Error: Failed to import module 'cache.sqlite.database'

  File "/usr/lib/portage/pym/portage.py", line 1654, in load_best_module

    mod = load_mod(best_mod)

  File "/usr/lib/portage/pym/portage.py", line 156, in load_mod

    mod = __import__(modname)

  File "/usr/lib/portage/pym/cache/sqlite.py", line 14, in ?

    from pysqlite2 import dbapi2 as db_module

  File "/usr/lib/python2.4/site-packages/pysqlite2/dbapi2.py", line 27, in ?

    from pysqlite2._sqlite import *

/usr/lib/python2.4/site-packages/pysqlite2/_sqlite.so: undefined symbol: sqlite3_enable_shared_cache

====================================
```

So what would be the best idea in this case?  The portage package from tinderbox and the latest snapshot?  I'm trying to avoid breaking things any more than I already have, so I thought I'd ask for advice (please) before I do anything more.

----------

## Tmor

```
# cd 

# tar xzf /usr/portage/distfiles/Python-2.4.2.tgz 

# cd Python-2.2.1 

# ./configure --with-fpectl --infodir=/usr/share/info/ --mandir=/usr/share/man 

# make 

# make install prefix=/usr 

# rm /usr/bin/python 2>/dev/null 

# ln -s /usr/bin/python2.4 /usr/bin/python2 

# ln -s /usr/bin/python2 /usr/bin/python 
```

Another successful fix of Python.

There should be a "special" USE FLAG for Python to not let you unmerge it.  I to, thought, oh, unmerge the blocking issue and remerge.  Fortunately it only took about 2 hours to find the solution.

----------

## desultory

 *Wyatt wrote:*   

> So what would be the best idea in this case?  The portage package from tinderbox and the latest snapshot?

 Barring a local archive of compiled packages (which could be used in the same fashion), that should be (at least close to) the fastest and easiest way to fix it.

----------

## Lord_DragonFly

@Tmor: i believe there is something like this already.

Portage is part of the system profile, which means that portage will complain if you ask to remove it but (since you are root and therefore god) will let you unmerge it anyway.

Running `emerge -aC` or `emerge -pC` are recommended.

```
dragonfly@Hikari ~ $ emerge -pC python

>>> These are the packages that would be unmerged:

!!! 'dev-lang/python' is part of your system profile.

!!! Unmerging it may be damaging to your system.

 dev-lang/python

    selected: 2.5.1-r5 

   protected: none 

     omitted: none 

>>> 'Selected' packages are slated for removal.

>>> 'Protected' and 'omitted' packages will not be removed.

```

[edit] fixed typo

----------

## desultory

 *Lord_DragonFly wrote:*   

> Running `emerge -aC` or `emerge -pC` are recommended.

 It is safer to use -c (--clean) or -P (--prune) instead of -C (--unmerge), as unlike -C they would not remove all versions. In addition -C does not take dependencies into account, while -P and --depclean do, though --depclean should also be used with -p (--pretend) or -a (--ask).

----------

## vectox

 *desultory wrote:*   

> If the python interpreter is actually nonfunctional, as opposed to some mishap with configuration or selection, try the following.
> 
> Download the package from the tinderbox repository which matches the architecture of the system. Place that file in $PKGDIR on that system. Then unpack that package directly under /, tar xvjf $PKGDIR/python-2.4.4-r6.tbz2 should do it, though $PKGDIR will likely need to be manually expanded as it is not typically present in the environment. Next ln -s /usr/bin/python2.4 /usr/bin/python. Finally, emerge -K dev-lang/python.

 

Ahhh...this one saved the day...the manual compiles reminded me of the good ol Slackware days....and the errors/dependancies that ensued.

----------

## mmoufid

I did this when I first started using Gentoo.  :Embarassed:   Perhaps Portage should warn when a user attempts to --unmerge Python?  :Wink: 

----------

## mslinn

Here is how I recovered Python v2.5.  Instructions have changed slightly from the original posting:

```
cd

bzip2 -d< /usr/portage/distfiles/Python-2.5.2.tar.bz2 |tar -xf -

cd Python-2.5.2

sudo ./configure --with-fpectl --infodir=/usr/share/info/ --mandir=/usr/share/man 

sudo make

sudo make install prefix=/usr

sudo emerge =dev-lang/python-2.5.2-r1

sudo python-updater
```

----------

## cfgauss

 *delta407 wrote:*   

> You might be able to reinstall Python using this:
> 
> ```
> # cd
> 
> ...

 

This worked for me with small changes for a newer Python version and a .bz2 rather than .tgz file.

This post should be enshrined somewhere as a FAQ. Also the list of what never to unemerge should be right along side it. (I once unemerged coreutils as well!)

----------

## Phylroy

Shot myself in the foot..  Python was blocking  the new python packages...

[blocks B     ] <dev-lang/python-2.3.6-r2 (is blocking app-admin/python-updater-0.5, app-admin/python-updater-0.2)

So I did what I usually do in this situation...emerge -C the offending package and then remerge it..

However I forgot that emergey depends on python....crap...Now I have a chicken or the egg problem...

Any solutions for this?

----------

## desultory

There known solutions, some faster than others.

Merged the above post.

----------

## lanjelot

The only solution that worked for me was 

http://gentoo-wiki.com/HOWTO_Restoring_Removed_Key_System_Packages

But i had unmerged both sys-libs/db and dev-lang/python, and all slots of them!

----------

## hansmaa

 *desultory wrote:*   

> If the python interpreter is actually nonfunctional, as opposed to some mishap with configuration or selection, try the following.
> 
> Download the package from the tinderbox repository which matches the architecture of the system. Place that file in $PKGDIR on that system. Then unpack that package directly under /, tar xvjf $PKGDIR/python-2.4.4-r6.tbz2 should do it, though $PKGDIR will likely need to be manually expanded as it is not typically present in the environment. Next ln -s /usr/bin/python2.4 /usr/bin/python. Finally, emerge -K dev-lang/python.

 

Thanks.

This worked. Was quite sure I'd broken my server when I found this thread   :Smile: 

----------

## tommytumult

 *desultory wrote:*   

> If the python interpreter is actually nonfunctional, as opposed to some mishap with configuration or selection, try the following.
> 
> Download the package from the tinderbox repository which matches the architecture of the system. Place that file in $PKGDIR on that system. Then unpack that package directly under /, tar xvjf $PKGDIR/python-2.4.4-r6.tbz2 should do it, though $PKGDIR will likely need to be manually expanded as it is not typically present in the environment. Next ln -s /usr/bin/python2.4 /usr/bin/python. Finally, emerge -K dev-lang/python.

 

You, sir, are a lifesaver. I know better than to emerge -C python, something in me said "Don't do it. Search the forums on the blocker" but I did it anyway and thought I was dead where I stood after it completed. Thank you.

----------

## monsm

 *tommytumult wrote:*   

>  *desultory wrote:*   If the python interpreter is actually nonfunctional, as opposed to some mishap with configuration or selection, try the following.
> 
> Download the package from the tinderbox repository which matches the architecture of the system. Place that file in $PKGDIR on that system. Then unpack that package directly under /, tar xvjf $PKGDIR/python-2.4.4-r6.tbz2 should do it, though $PKGDIR will likely need to be manually expanded as it is not typically present in the environment. Next ln -s /usr/bin/python2.4 /usr/bin/python. Finally, emerge -K dev-lang/python. 
> 
> You, sir, are a lifesaver. I know better than to emerge -C python, something in me said "Don't do it. Search the forums on the blocker" but I did it anyway and thought I was dead where I stood after it completed. Thank you.

 

 :Very Happy:  Good its not just me doing these clever things...

This tinderbox version of recovering seem better than what I did.  I found the old Python package in the distfiles directory and then unpacked and run .configure, make and make install myself.  Then I run emerge python and got a second copy of the same version of Python 2.5 on my system.  I couldn't get Compiz-Fusion to run again with fusion-icon.  To recover from this new problem, I then emerged Python 2.4 (emerge python-2.4* or something like that).  After having  2.4 I then unmerged 2.5 and deleted everything I could find from the other 2.5 version I had installed manually.  After that it all worked again after re-emegring pygtk and fusion-icon.  Puh!  I am still too scared to emerge the new Python 2.5 (I have masked it in package.mask).

Mons

----------

## devsk

I wonder why portage just doesn't let you unmerge python and itself from the command line? That would sound like a fair plan in this case and help end-users. A program should not allow the users to shoot themselves in the foot. When we release products at our company, we tend to account for all users irrespective of their intelligence level and make sure that the end users don't shoot themselves in the foot in any way. In this case, its seems rather obvious. Is it really hard to just not allow unmerging of python and portage from command line? How about an extra warning with explicit text (different from "this is part of your system profile" crap) stating that this will be the end of your gentoo dreams and you won't be able to install anything, not even portage itself?

----------

## Tortue

Thanks a lot delta407, you saved not only my day, but also my month!

You also have a place to stay in the Ottawa area!

----------

## mgillespie

My trusty Gentoo server is busted.  I did a emerge -Upd world, and there were some blocks.  In the past, I just umerged what was blocking them, and it carried on and sorted things out.

This time not so, firstly I had major problems with libcom_err.so.1, which got removed gy e2fsprogs, which broke wget., I finally sorted that mess out, by pulling the box out, installing a CD drive (it's a headless, CD-less, keyboard less server), booting usin  a livecd and copying the missing stuff over so it could boot again.

Now all I have to do, is fix the missing Python.  Anyone got any advice? (aside from move to much less painful apt-get and Ubuntu).

----------

## Zepp

manually grab the python source tar ball, extract, compile, and install it. then hopefully you can run emerge again and can remerge python and run python-updater.

----------

## NathanZachary

You should still have web access, it is just that wget and portage are broken.  So, you can just go to any of the local mirrors close to you:

http://www.gentoo.org/main/en/mirrors.xml

and go the distfiles folder.  Get python and manually copy it into your /usr/portage/distfiles folder.  However, as Portage itself uses Python, you will most likely have to do as Zepp suggested, and manually install python.  Then once python is installed, you can do a system update via emerge -avuDN world, and run the updater script and revdep-rebuild.

----------

## tarpman

A Python compiled from scratch won't necessarily work with portage, as Gentoo applies a number of patches and fixes to it.  A better approach would be to grab a binary package from here.  You can simply unpack it at / to get portage working temporarily, and then rebuild python locally once it's up.

----------

## desultory

 *mgillespie wrote:*   

> My trusty Gentoo server is busted.  I did a emerge -Upd world, and there were some blocks.  In the past, I just umerged what was blocking them, and it carried on and sorted things out.

 The 2.2 series introduces to portage the ability to automatically resolve the most common cases of such problems.

 *mgillespie wrote:*   

> This time not so, firstly I had major problems with libcom_err.so.1, which got removed gy e2fsprogs, which broke wget., I finally sorted that mess out, by pulling the box out, installing a CD drive (it's a headless, CD-less, keyboard less server), booting usin  a livecd and copying the missing stuff over so it could boot again.

 When you encounter blocks involving packages which are known to be vital, or just appear to be so, use the --fetchonly (-f) or --fetch-all-uri (-F) options to emerge  to retrieve all of the necessary files before proceeding with removing any packages.

 *mgillespie wrote:*   

> Now all I have to do, is fix the missing Python.  Anyone got any advice?

 With the tendency to stick to things comes the concern of what to stick to, without it comes the concern of where to fall from. As for more pertinent advice, I posted it some time ago.

 *mgillespie wrote:*   

> (aside from move to much less painful apt-get and Ubuntu).

 They break too, and they can be more difficult to fix without simply reverting everything.

Merged the above four posts.

----------

## BadSquishy

I made the same rookie mistake, saw a blocking package and ran "emerge -C python".  I saw that it was removing more than one slot and thought "that probably isn't right" but didn't hit CTRL+C immediately like I should have.  

tarpman's post just above is what saved my bacon.  Though now I am thinking it will be hard for me to determine if I'm leaving a bunch of extra files on my system.  

I unpacked the python-2.4.4-r13.tbz2 tarball in the / directory after checking that it wasn't going to overwrite anything unexpected.  After that I emerged dev-lang/python which installed python-2.5.  At this point I knew I had python-2.4 on my system but portage didn't know about it ("equery l python" only showed 2.5 installed) so I emerged python-2.4.4-r14.  Now I am going to run python-updater to make everything work with python-2.5, check to see if there are any packages depending on python 2.4 with equery, and if not I will unmerge python-2.4.  Then I will manually check the file system to see if any of the files that were originally in the tarball are left.  

Damn - python-updater won't work because some of my packages are so out of date they are now masked in the portage tree.  I have to run emerge -avuDN world first (did I mention I updated to a new profile at the request of portage just before I made my big mistake?).  So know I have to wait for it to update 49 packages before I can run python-updater (I could have just updated the packages that python-updater cared about, but hey, why not take unnecessary chances?).  I'm still leaving fixed on the end of this post because emerge IS working.  

Another method that is slightly different than tarpman's post is the post desultory has referred to several times in this thread.  It may be a little cleaner, but I don't really know.

----------

## desultory

 *BadSquishy wrote:*   

> Another method that is slightly different than tarpman's post is the post desultory has referred to several times in this thread.  It may be a little cleaner, but I don't really know.

 It helps keep the orphan population down while keeping the package manager aware of the installed version during the maximum feasible portion of the process, in short it is cleaner.

----------

## mgillespie

 *tarpman wrote:*   

> A Python compiled from scratch won't necessarily work with portage, as Gentoo applies a number of patches and fixes to it.  A better approach would be to grab a binary package from here.  You can simply unpack it at / to get portage working temporarily, and then rebuild python locally once it's up.

 

Does not work for me, I get "illegal instruction", after downloading to the / and doing tar -xvjf pythonxxx.tbz2

I wonder if these were compiled with i686 or i386???  I have Via Eden chipset, which does not have CMOV instruction...

Compiling from source has worked, off to emerge the proper python now... then sort out e2fsprogs proper, and then back the original updating before it all went pear shaped...

----------

## Minthos

Doesen't work for me either: after unzipping the binary package into / and updating the symlink, I can run emerge but with several errors:

The unzipping gives me this, but otherwise seems to work fine:

```
bzip2: (stdin): trailing garbage after EOF ignored
```

First I try # emerge -K dev-lang/python and get this:

```

Calculating dependencies /

emerge: there are no ebuilds to satisfy "dev-lang/python".

```

Then I emerge python without the -K and during emerge I get lots of these:

```

Could not find platform independent libraries <prefix>

Could not find platform dependent libraries <exec_prefix>

Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]

'import site' failed; use -v for traceback

Traceback (most recent call last):

  File "/usr/lib64/portage/bin/filter-bash-environment.py", line 6, in <module>

    import os, re, sys

ImportError: No module named os

```

Then when trying emerge -K dev-lang/python again, I now get this:

```

Calculating dependencies /

!!! All ebuilds that could satisfy "dev-lang/python" have been masked.

!!! One of the following masked packages is required to complete your request:

- dev-lang/python-2.5.2-r7 (masked by: invalid: SLOT is undefined)

For more information, see MASKED PACKAGES section in the emerge man page or 

refer to the Gentoo Handbook.
```

So python itself works, but it can't find any libraries:

```

$ python

Could not find platform independent libraries <prefix>

Could not find platform dependent libraries <exec_prefix>

Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]

'import site' failed; use -v for traceback

Python 2.6 (r26:66714, Nov 26 2008, 13:48:24) 

[GCC 4.1.2 20070214 (  (gdc 0.24, using dmd 1.020)) (Gentoo 4.1.2 p1.0.2)] on linux2

Type "help", "copyright", "credits" or "license" for more information.

>>> help

Traceback (most recent call last):

  File "<stdin>", line 1, in <module>

NameError: name 'help' is not defined

>>> 

```

----------

## desultory

 *Minthos wrote:*   

> The unzipping gives me this, but otherwise seems to work fine:
> 
> ```
> bzip2: (stdin): trailing garbage after EOF ignored
> ```
> ...

 As previously mentioned, that is expected and harmless.

 *Minthos wrote:*   

> First I try # emerge -K dev-lang/python and get this:
> 
> ```
> 
> Calculating dependencies /
> ...

 According to that there were no python packages present in PKGDIR, rectify that and try again.

----------

## Minthos

```
rm -r /usr/local/bin/python*
```

This fixed everything.

edit: Well, except pygtk, which is still hosed and won't reinstall properly. Will return with update on that later..

----------

## Minthos

So I ran python-updater and emerged "manually" i.e. by typing emerge -av <package> some of the packages it choked on - which was a bit weird btw: python-updater whined about masked packages and whatnot, but when I told emerge to get them, there were no complaints.

I also manually removed python 2.4 at some point (unintentionally removing 2.5 too, but I fixed that by re-extracting the tarball I used earlier). This caused python-updater to become a bit confused, so I gave it the -o 2.4 option. A while later, libpng failed to emerge. I tried emerge --resume --skipfirst, and got a similar error on the next package. I tried the next package after that too, for good measure, but same error.

I may have tried to reemerge some already installed packages, but I don't remember the specifics. The point is, I reemerge portage, and this is what happens:

```

 # emerge -av portage

These are the packages that would be merged, in order:

Calculating dependencies... done!

[ebuild   R   ] sys-apps/portage-2.1.4.5  USE="-build -doc -epydoc (-selinux)" LINGUAS="-pl" 0 kB 

Total: 1 package (1 reinstall), Size of downloads: 0 kB

Would you like to merge these packages? [Yes/No] yes

>>> Verifying ebuild Manifests...

>>> Emerging (1 of 1) sys-apps/portage-2.1.4.5 to /

 * portage-2.1.4.tar.bz2 RMD160 SHA1 SHA256 size ;-) ...                                           [ ok ]

 * portage-2.1.4.5.patch.bz2 RMD160 SHA1 SHA256 size ;-) ...                                       [ ok ]

 * checking ebuild checksums ;-) ...                                                               [ ok ]

 * checking auxfile checksums ;-) ...                                                              [ ok ]

 * checking miscfile checksums ;-) ...                                                             [ ok ]

 * checking portage-2.1.4.tar.bz2 ;-) ...                                                          [ ok ]

 * checking portage-2.1.4.5.patch.bz2 ;-) ...                                                      [ ok ]

libsandbox:  Can't resolve fopen: (null)

>>> Unpacking source...

>>> Unpacking portage-2.1.4.tar.bz2 to /var/tmp/portage/sys-apps/portage-2.1.4.5/work

>>> Unpacking portage-2.1.4.5.patch.bz2 to /var/tmp/portage/sys-apps/portage-2.1.4.5/work

 * Applying portage-2.1.4.5.patch ...                                                              [ ok ]

 * Setting portage.VERSION to 2.1.4.5 ...                                                          [ ok ]

>>> Source unpacked.

>>> Compiling source in /var/tmp/portage/sys-apps/portage-2.1.4.5/work/portage-2.1.4 ...

>>> Source compiled.

>>> Test phase [not enabled]: sys-apps/portage-2.1.4.5

libsandbox:  Can't resolve open: (null)

libsandbox:  Can't resolve fopen64: (null)

>>> Install portage-2.1.4.5 into /var/tmp/portage/sys-apps/portage-2.1.4.5/image/ category sys-apps

>>> Completed installing portage-2.1.4.5 into /var/tmp/portage/sys-apps/portage-2.1.4.5/image/

!!! WARNING: Expected SLOT='0', got ''

* checking 0 files for package collisions

>>> Merging sys-apps/portage-2.1.4.5 to /

>>> Safely unmerging already-installed instance...

No package files given... Grabbing a set.

<<<          obj /usr/share/man/man5/portage.5.bz2

<<<          obj /usr/share/man/man5/make.conf.5.bz2

<<<          obj /usr/share/man/man5/ebuild.5.bz2

<<<          obj /usr/share/man/man5/color.map.5.bz2

<<<          obj /usr/share/man/man1/repoman.1.bz2

<<<          obj /usr/share/man/man1/quickpkg.1.bz2

<<<          obj /usr/share/man/man1/etc-update.1.bz2

<<<          obj /usr/share/man/man1/env-update.1.bz2

<<<          obj /usr/share/man/man1/emerge.1.bz2

<<<          obj /usr/share/man/man1/emaint.1.bz2

<<<          obj /usr/share/man/man1/ebuild.1.bz2

<<<          obj /usr/share/man/man1/dispatch-conf.1.bz2

<<<          obj /usr/share/doc/portage-2.1.4.5/RELEASE-NOTES.bz2

<<<          obj /usr/share/doc/portage-2.1.4.5/NEWS.bz2

<<<          obj /usr/share/doc/portage-2.1.4.5/ChangeLog.bz2

<<<          sym /usr/sbin/update-etc

<<<          sym /usr/sbin/update-env

<<<          sym /usr/sbin/regenworld

<<<          sym /usr/sbin/quickpkg

<<<          sym /usr/sbin/fixpackages

<<<          sym /usr/sbin/etc-update

<<<          sym /usr/sbin/env-update

<<<          sym /usr/sbin/emerge-webrsync

<<<          sym /usr/sbin/emaint

<<<          sym /usr/sbin/dispatch-conf

<<<          sym /usr/sbin/archive-conf

<<<          obj /usr/lib64/portage/pym/xpak.py

<<<          obj /usr/lib64/portage/pym/portage_versions.py

<<<          obj /usr/lib64/portage/pym/portage_util.py

<<<          obj /usr/lib64/portage/pym/portage_update.py

<<<          obj /usr/lib64/portage/pym/portage_selinux.py

<<<          obj /usr/lib64/portage/pym/portage_manifest.py

<<<          obj /usr/lib64/portage/pym/portage_mail.py

<<<          obj /usr/lib64/portage/pym/portage_locks.py

<<<          obj /usr/lib64/portage/pym/portage_localization.py

<<<          obj /usr/lib64/portage/pym/portage_gpg.py

<<<          obj /usr/lib64/portage/pym/portage_exec.py

<<<          obj /usr/lib64/portage/pym/portage_exception.py

<<<          obj /usr/lib64/portage/pym/portage_dep.py

<<<          obj /usr/lib64/portage/pym/portage_debug.py

<<<          obj /usr/lib64/portage/pym/portage_data.py

<<<          obj /usr/lib64/portage/pym/portage_const.py

<<<          obj /usr/lib64/portage/pym/portage_checksum.py

<<<          obj /usr/lib64/portage/pym/portage.py

<<<          obj /usr/lib64/portage/pym/output.py

<<<          obj /usr/lib64/portage/pym/getbinpkg.py

<<<          obj /usr/lib64/portage/pym/emergehelp.py

<<<          obj /usr/lib64/portage/pym/elog_modules/mod_syslog.py

<<<          obj /usr/lib64/portage/pym/elog_modules/mod_save_summary.py

<<<          obj /usr/lib64/portage/pym/elog_modules/mod_save.py

<<<          obj /usr/lib64/portage/pym/elog_modules/mod_mail_summary.py

<<<          obj /usr/lib64/portage/pym/elog_modules/mod_mail.py

<<<          obj /usr/lib64/portage/pym/elog_modules/mod_echo.py

<<<          obj /usr/lib64/portage/pym/elog_modules/mod_custom.py

<<<          obj /usr/lib64/portage/pym/elog_modules/__init__.py

<<<          obj /usr/lib64/portage/pym/eclass_cache.py

<<<          obj /usr/lib64/portage/pym/dispatch_conf.py

<<<          obj /usr/lib64/portage/pym/cvstree.py

<<<          obj /usr/lib64/portage/pym/cache/volatile.py

<<<          obj /usr/lib64/portage/pym/cache/util.py

<<<          obj /usr/lib64/portage/pym/cache/template.py

<<<          obj /usr/lib64/portage/pym/cache/sqlite.py

<<<          obj /usr/lib64/portage/pym/cache/sql_template.py

<<<          obj /usr/lib64/portage/pym/cache/metadata_overlay.py

<<<          obj /usr/lib64/portage/pym/cache/metadata.py

<<<          obj /usr/lib64/portage/pym/cache/mappings.py

<<<          obj /usr/lib64/portage/pym/cache/fs_template.py

<<<          obj /usr/lib64/portage/pym/cache/flat_list.py

<<<          obj /usr/lib64/portage/pym/cache/flat_hash.py

<<<          obj /usr/lib64/portage/pym/cache/cache_errors.py

<<<          obj /usr/lib64/portage/pym/cache/anydbm.py

<<<          obj /usr/lib64/portage/pym/cache/__init__.py

<<<          obj /usr/lib64/portage/bin/xpak

<<<          obj /usr/lib64/portage/bin/tbz2tool

<<<          obj /usr/lib64/portage/bin/repoman

<<<          obj /usr/lib64/portage/bin/regenworld

<<<          obj /usr/lib64/portage/bin/quickpkg

<<<          obj /usr/lib64/portage/bin/prepstrip

<<<          obj /usr/lib64/portage/bin/prepman

<<<          obj /usr/lib64/portage/bin/preplib

<<<          obj /usr/lib64/portage/bin/prepinfo

<<<          obj /usr/lib64/portage/bin/prepallstrip

<<<          obj /usr/lib64/portage/bin/prepallman

<<<          obj /usr/lib64/portage/bin/prepallinfo

<<<          obj /usr/lib64/portage/bin/prepalldocs

<<<          obj /usr/lib64/portage/bin/prepall

<<<          obj /usr/lib64/portage/bin/portageq

<<<          obj /usr/lib64/portage/bin/portage_gpg_update.sh

<<<          obj /usr/lib64/portage/bin/pkgname

<<<          obj /usr/lib64/portage/bin/newsbin

<<<          obj /usr/lib64/portage/bin/newman

<<<          obj /usr/lib64/portage/bin/newlib.so

<<<          obj /usr/lib64/portage/bin/newlib.a

<<<          obj /usr/lib64/portage/bin/newins

<<<          obj /usr/lib64/portage/bin/newinitd

<<<          obj /usr/lib64/portage/bin/newexe

<<<          obj /usr/lib64/portage/bin/newenvd

<<<          obj /usr/lib64/portage/bin/newdoc

<<<          obj /usr/lib64/portage/bin/newconfd

<<<          obj /usr/lib64/portage/bin/newbin

<<<          obj /usr/lib64/portage/bin/misc-functions.sh

<<<          obj /usr/lib64/portage/bin/md5check.sh

<<<          obj /usr/lib64/portage/bin/md5check.py

<<<          obj /usr/lib64/portage/bin/isolated-functions.sh

<<<          obj /usr/lib64/portage/bin/fperms

<<<          obj /usr/lib64/portage/bin/fowners

<<<          obj /usr/lib64/portage/bin/fixpackages

<<<          obj /usr/lib64/portage/bin/fixdbentries

<<<          obj /usr/lib64/portage/bin/fix-db.py

<<<          obj /usr/lib64/portage/bin/find-requires

<<<          obj /usr/lib64/portage/bin/filter-bash-environment.py

<<<          obj /usr/lib64/portage/bin/etc-update

<<<          obj /usr/lib64/portage/bin/env-update.sh

<<<          obj /usr/lib64/portage/bin/env-update

<<<          obj /usr/lib64/portage/bin/emerge-webrsync

<<<          obj /usr/lib64/portage/bin/emerge

<<<          obj /usr/lib64/portage/bin/emake

<<<          obj /usr/lib64/portage/bin/emaint

<<<          obj /usr/lib64/portage/bin/ecompressdir

<<<          obj /usr/lib64/portage/bin/ecompress

<<<          obj /usr/lib64/portage/bin/ebuild.sh

<<<          obj /usr/lib64/portage/bin/ebuild

<<<          obj /usr/lib64/portage/bin/dosym

<<<          obj /usr/lib64/portage/bin/dosed

<<<          obj /usr/lib64/portage/bin/dosbin

<<<          sym /usr/lib64/portage/bin/donewins

<<<          obj /usr/lib64/portage/bin/domo

<<<          obj /usr/lib64/portage/bin/doman

<<<          obj /usr/lib64/portage/bin/dolib.so

<<<          obj /usr/lib64/portage/bin/dolib.a

<<<          obj /usr/lib64/portage/bin/dolib

<<<          obj /usr/lib64/portage/bin/doins

<<<          obj /usr/lib64/portage/bin/doinitd

<<<          obj /usr/lib64/portage/bin/doinfo

<<<          obj /usr/lib64/portage/bin/dohtml

<<<          obj /usr/lib64/portage/bin/dohard

<<<          obj /usr/lib64/portage/bin/doexe

<<<          obj /usr/lib64/portage/bin/doenvd

<<<          obj /usr/lib64/portage/bin/dodoc

<<<          obj /usr/lib64/portage/bin/dodir

<<<          obj /usr/lib64/portage/bin/doconfd

<<<          obj /usr/lib64/portage/bin/dobin

<<<          obj /usr/lib64/portage/bin/dispatch-conf

<<<          obj /usr/lib64/portage/bin/clean_locks

<<<          obj /usr/lib64/portage/bin/chkcontents

<<<          obj /usr/lib64/portage/bin/check-implicit-pointer-usage.py

<<<          obj /usr/lib64/portage/bin/archive-conf

<<<          sym /usr/bin/xpak

<<<          sym /usr/bin/tbz2tool

<<<          sym /usr/bin/repoman

<<<          sym /usr/bin/portageq

<<<          sym /usr/bin/emerge

<<<          sym /usr/bin/ebuild

<<<          obj /etc/portage/.keep_sys-apps_portage-0

<<<          obj /etc/make.globals

--- !mtime   obj /etc/make.conf.example

<<<          obj /etc/logrotate.d/elog-save-summary

<<<          obj /etc/etc-update.conf

<<<          obj /etc/env.d/05portage.envd

<<<          obj /etc/dispatch-conf.conf

--- !empty   dir /usr/share/man/man5

--- !empty   dir /usr/share/man/man1

--- !empty   dir /usr/share/man

<<<          dir /usr/share/doc/portage-2.1.4.5

--- !empty   dir /usr/share/doc

--- !empty   dir /usr/share

--- !empty   dir /usr/sbin

--- !empty   dir /usr/lib64/portage/pym/elog_modules

--- !empty   dir /usr/lib64/portage/pym/cache

--- !empty   dir /usr/lib64/portage/pym

--- !empty   dir /usr/lib64/portage/bin

--- !empty   dir /usr/lib64/portage

--- !empty   dir /usr/lib64

--- !empty   dir /usr/bin

--- !empty   dir /usr

--- !empty   dir /etc/portage

--- !empty   dir /etc/logrotate.d

--- !empty   dir /etc/env.d

--- !empty   dir /etc

>>> Original instance of package unmerged safely.

>>> sys-apps/portage-2.1.4.5 merged.

>>> No packages selected for removal by clean

>>> Auto-cleaning packages...

>>> No outdated packages were found on your system.

 * Regenerating GNU info directory index...

 * IMPORTANT: 15 config files in '/etc' need updating.

 * See the CONFIGURATION FILES section of the emerge

 * man page to learn how to update config files.

```

Looks pretty innocent, except for a few warnings/errors that fly past:

```

libsandbox:  Can't resolve open: (null)

libsandbox:  Can't resolve fopen64: (null)

!!! WARNING: Expected SLOT='0', got ''

```

No biggie, portage completes successfully, and lo and behold: portage is unmerged.

```
 # python-updater 

/usr/sbin/python-updater: line 156: /usr/bin/portageq: No such file or directory

 # emerge

bash: /usr/bin/emerge: No such file or directory

```

Removing sandbox from FEATURES and running the portage rescue script again got me back on track. Will post more updates later..

----------

## Minthos

Yep, stuff seems to work now, including pygtk. python-updater completed successfully. I've had to reemerge some packages, but there have been no problems beyond that.

----------

## esbenandreasen

I were lucky - had another version installed.

```

/usr/bin % cd /usr/bin

/usr/bin % ls -l | grep python                                            

lrwxrwxrwx  1 root   root          9 Mar  6 19:19 python -> python2.5

lrwxrwxrwx  1 root   root         17 Mar  6 19:19 python-config -> python-config-2.5

-rwxr-xr-x  1 root   root       1.4K Mar  6 19:19 python-config-2.4

lrwxrwxrwx  1 root   root          9 Mar  6 19:19 python2 -> python2.5

-rwxr-xr-x  1 root   root       5.3K Mar  6 19:19 python2.4

```

All I had to do was to relink:

```

/usr/bin % rm python2

/usr/bin % rm python

/usr/bin % rm python-config

/usr/bin % ln -s /usr/bin/python2 /usr/bin/python-2.4

/usr/bin % ln -s /usr/bin/python /usr/bin/python-2.4

/usr/bin % ln -s /usr/bin/python-config-2.4 /usr/bin/python-config

```

----------

## xvan

A quick and dirty way to restore python, that worked for me was to download the stage1 from mirrors. and make a 

tar xvjkpf stage1*.tar.bz2

with the k option doesn't allow to overwrite anything, so at least it shouldn't be lethal.

It also installed other files, but i think its because I used a different stage version.

Now  I have some digest issues when emerging python, but a portage resync should solve them.

----------

## desultory

You could save time and bandwidth while avoiding leaving orphans around the system.

----------

## ahu

 *delta407 wrote:*   

> You might be able to reinstall Python using this:
> 
> ```
> # cd
> 
> ...

 

delta407, you're my hero of the day! 

After killing my python installation (dev-lang/python-2.6.5-r2) I could recover it with your instructions.

Thanks a lot

Alex

----------

