Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Portage & Programming
  • Search

Problem with python and emerge: 'No module named os'

Problems with emerge or ebuilds? Have a basic programming question about C, PHP, Perl, BASH or something else?
Post Reply
Advanced search
49 posts
  • 1
  • 2
  • Next
Author
Message
zgredek
Apprentice
Apprentice
Posts: 186
Joined: Wed Jun 15, 2005 8:59 pm

Problem with python and emerge: 'No module named os'

  • Quote

Post by zgredek » Thu Dec 24, 2009 7:44 pm

After simple emerge --sync I cannot longer use emerge (and some other python-based software):

Code: Select all

# emerge --info
'import site' failed; use -v for traceback
Traceback (most recent call last):
  File "/usr/bin/emerge", line 31, in <module>
    from os import path as osp
ImportError: No module named os
I tried

Code: Select all

eselect python
and

Code: Select all

revdep-rebuild
but the problem persists.

As I looked through the log, I noticed emerge did switched to 'the best available' version of python available upon completing the sync. I think that was the reason.

My python list:

Code: Select all

# eselect python list
Available python interpreters:
  [1]   python2.4
  [2]   python2.5
  [3]   python2.6 *
  [4]   python3.1
I really really need your help now as I cannot even unmerge anything...

Thanks.
Top
zgredek
Apprentice
Apprentice
Posts: 186
Joined: Wed Jun 15, 2005 8:59 pm

  • Quote

Post by zgredek » Fri Dec 25, 2009 11:44 pm

Anyone?
Top
kallamej
Administrator
Administrator
User avatar
Posts: 4993
Joined: Fri Jun 27, 2003 10:05 am
Location: Gothenburg, Sweden

  • Quote

Post by kallamej » Sat Dec 26, 2009 12:16 pm

emerge --sync alone should never break portage like that. Make sure that eselect python does not lie to you. Check /var/log/emerge.log for what you did last. Try manually fixing portage (replace portage-2.1.1 with your own version).
Please read our FAQ Forum, it answers many of your questions.
irc: #gentoo-forums on irc.libera.chat
Top
Genone
Retired Dev
Retired Dev
User avatar
Posts: 9656
Joined: Fri Mar 14, 2003 6:02 pm
Location: beyond the rim

  • Quote

Post by Genone » Sat Dec 26, 2009 11:01 pm

That's no portage problem, your python installation is broken. "os" is a standard library module, so selecting a new python version shouldn't matter here, however you can try to select a different one using "eselect" (don't remember the complete command line).
Top
zgredek
Apprentice
Apprentice
Posts: 186
Joined: Wed Jun 15, 2005 8:59 pm

  • Quote

Post by zgredek » Sun Dec 27, 2009 1:06 pm

kallamej wrote:emerge --sync alone should never break portage like that. Make sure that eselect python does not lie to you. Check /var/log/emerge.log for what you did last. Try manually fixing portage (replace portage-2.1.1 with your own version).
Unfortunately, it did...

Code: Select all

eselect python
successfully changes the python version. None of which seems to be working...
Top
zgredek
Apprentice
Apprentice
Posts: 186
Joined: Wed Jun 15, 2005 8:59 pm

  • Quote

Post by zgredek » Tue Jan 05, 2010 7:56 pm

I'm afraid I'll have to reinstall...

After a portage fix: http://www.gentoo.org/proj/en/portage/d ... ortage.xml I still get:

Code: Select all

Could not find platform independent libraries <prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
'import site' failed; use -v for traceback
Traceback (most recent call last):
  File "bin/emerge", line 23, in <module>
    import os
ImportError: No module named os

Anyone, please?
Top
Mike Hunt
Watchman
Watchman
User avatar
Posts: 5287
Joined: Sun Jul 19, 2009 11:01 pm

  • Quote

Post by Mike Hunt » Tue Jan 05, 2010 9:00 pm

You don't need to reinstall to fix a broken python.

Either fetch a dev-lang/python-2.6.4.tar.bz2 tarball from tinderbox and extract it to /

or do one of these:

Code: Select all

cd /root
wget http://distfiles.gentoo.org/distfiles/Python-2.6.4.tar.bz2
tar jxvf Python-2.6.4.tar.bz2
cd Python-2.6.4
./configure
make
./python /usr/bin/emerge python
cd /root
rm -rf Python-2.6.4*
eselect python set python2.6
python-updater
revdep-rebuild
Top
d2_racing
Bodhisattva
Bodhisattva
User avatar
Posts: 13047
Joined: Mon Apr 25, 2005 2:25 pm
Location: Ste-Foy,Canada
Contact:
Contact d2_racing
Website

  • Quote

Post by d2_racing » Wed Jan 06, 2010 9:19 pm

Make sure that you choose the right arch.
Top
zgredek
Apprentice
Apprentice
Posts: 186
Joined: Wed Jun 15, 2005 8:59 pm

  • Quote

Post by zgredek » Fri Jan 08, 2010 4:59 pm

I'm sorry - still getting a similar error:

Code: Select all

# ./python /usr/bin/emerge python -pv
Traceback (most recent call last):
  File "/usr/bin/emerge", line 31, in <module>
    import emergehelp, xpak, commands, errno, re, socket, string, time, types
  File "/usr/lib/portage/pym/emergehelp.py", line 5, in <module>
    import selinux
ImportError: No module named selinux
Maybe it's portage which is broken not python?
Top
jmbsvicetto
Moderator
Moderator
User avatar
Posts: 4735
Joined: Wed Apr 27, 2005 4:33 pm
Location: Angra do Heroísmo (PT)

  • Quote

Post by jmbsvicetto » Fri Jan 08, 2010 8:46 pm

Please post your emerge --info. Given the last message, I assume you messed with a selinux install / profile.
Jorge.

Your twisted, but hopefully friendly daemon.
AMD64 / x86 / Sparc Gentoo
Help answer || emwrap.sh
Top
zgredek
Apprentice
Apprentice
Posts: 186
Joined: Wed Jun 15, 2005 8:59 pm

  • Quote

Post by zgredek » Fri Jan 08, 2010 8:54 pm

jmbsvicetto wrote:Please post your emerge --info. Given the last message, I assume you messed with a selinux install / profile.
I'm afraid, emerge doesn't work at all:

Code: Select all

# emerge --info
Traceback (most recent call last):
  File "/usr/bin/emerge", line 31, in ?
    import emergehelp, xpak, commands, errno, re, socket, string, time, types
  File "/usr/lib/portage/pym/emergehelp.py", line 5, in ?
    import selinux
ImportError: No module named selinux

I don't use selinux.
Top
jmbsvicetto
Moderator
Moderator
User avatar
Posts: 4735
Joined: Wed Apr 27, 2005 4:33 pm
Location: Angra do Heroísmo (PT)

  • Quote

Post by jmbsvicetto » Fri Jan 08, 2010 8:57 pm

ok, let's start by your profile: ls -l /etc/make.profile
Jorge.

Your twisted, but hopefully friendly daemon.
AMD64 / x86 / Sparc Gentoo
Help answer || emwrap.sh
Top
Mike Hunt
Watchman
Watchman
User avatar
Posts: 5287
Joined: Sun Jul 19, 2009 11:01 pm

  • Quote

Post by Mike Hunt » Fri Jan 08, 2010 8:58 pm

:arrow: Manually fixing broken portage installations
Top
zgredek
Apprentice
Apprentice
Posts: 186
Joined: Wed Jun 15, 2005 8:59 pm

  • Quote

Post by zgredek » Fri Jan 08, 2010 9:07 pm

jmbsvicetto wrote:ok, let's start by your profile: ls -l /etc/make.profile

Code: Select all

 # ls -l /etc/make.profile
lrwxrwxrwx 1 root root 45 2010-01-08 22:08 /etc/make.profile -> /usr/portage/profiles/default/linux/x86/10.0/
Mike Hunt, I already (url) tried fixing the portage manually - still the same.
Top
Mike Hunt
Watchman
Watchman
User avatar
Posts: 5287
Joined: Sun Jul 19, 2009 11:01 pm

  • Quote

Post by Mike Hunt » Fri Jan 08, 2010 9:29 pm

Hmmm. It's the first time I see this fail.

did you use the portage-2.1.6 distfile?

Code: Select all

wget http://distfiles.gentoo.org/distfiles/portage-2.1.6.tar.bz2
Top
zgredek
Apprentice
Apprentice
Posts: 186
Joined: Wed Jun 15, 2005 8:59 pm

  • Quote

Post by zgredek » Fri Jan 08, 2010 9:35 pm

Mike Hunt wrote:Hmmm. It's the first time I see this fail.

did you use the portage-2.1.6 distfile?

Code: Select all

wget http://distfiles.gentoo.org/distfiles/portage-2.1.6.tar.bz2
Mike, is version actually works.

Now, as my system is 'slightly' out of date, what should I (re-)emerge to fix the problem? Python then revdep-rebuild?
Top
Mike Hunt
Watchman
Watchman
User avatar
Posts: 5287
Joined: Sun Jul 19, 2009 11:01 pm

  • Quote

Post by Mike Hunt » Fri Jan 08, 2010 9:49 pm

Good, now you could

Code: Select all

emerge --sync
emerge --oneshot sys-apps/portage dev-lang/python
run eselect python set python2.6 and python-updater

then as usual

Code: Select all

emerge -uDNav world
revdep-rebuild
Glad it's working. :)
Top
zgredek
Apprentice
Apprentice
Posts: 186
Joined: Wed Jun 15, 2005 8:59 pm

  • Quote

Post by zgredek » Fri Jan 08, 2010 10:44 pm

The log contains only the last message (No module named selinux).

Code: Select all

# ./emerge --oneshot sys-apps/portage dev-lang/python    

 * IMPORTANT: 5 news items need reading for repository 'gentoo'.
 * Use eselect news to read news items.

Calculating dependencies... done!

>>> Verifying ebuild manifests

>>> Starting parallel fetch

>>> Emerging (1 of 3) sys-apps/portage-2.1.7.16
Traceback (most recent call last):
  File "/usr/lib/portage/bin/ebuild", line 26, in ?
    import portage, portage_util, portage_const
  File "/usr/lib/portage/pym/portage_util.py", line 5, in ?
    import selinux
ImportError: No module named selinux
 * Fetch failed for 'sys-apps/portage-2.1.7.16', Log file:
 *  '/data/var/tmp/portage/sys-apps/portage-2.1.7.16/temp/build.log'
Top
Mike Hunt
Watchman
Watchman
User avatar
Posts: 5287
Joined: Sun Jul 19, 2009 11:01 pm

  • Quote

Post by Mike Hunt » Fri Jan 08, 2010 10:55 pm

Do you have an selinux USE flag enabled somewhere?

Maybe run revdep-rebuild also.
Top
zgredek
Apprentice
Apprentice
Posts: 186
Joined: Wed Jun 15, 2005 8:59 pm

  • Quote

Post by zgredek » Fri Jan 08, 2010 11:07 pm

Mike Hunt wrote:Do you have an selinux USE flag enabled somewhere?

Maybe run revdep-rebuild also.

Code: Select all

# ./emerge --info | grep selinux
#
REVDEP:

Code: Select all

# revdep-rebuild 
 * Configuring search environment for revdep-rebuild

 * Checking reverse dependencies
 * Packages containing binaries and libraries broken by a package update
 * will be emerged.

 * Collecting system binaries and libraries
 * Found existing 1_files.rr
 * Collecting complete LD_LIBRARY_PATH
 * Found existing 2_ldpath.rr.
 * Checking dynamic linking consistency
 * Found existing 3_broken.rr.
 * Assigning files to packages
 * Found existing 4_raw.rr
 * Cleaning list of packages to rebuild
 * Found existing 4_pkgs.rr
 * Assigning packages to ebuilds
 * Found existing 4_ebuilds.rr
 * Evaluating package order
Traceback (most recent call last):
  File "/usr/bin/emerge", line 31, in <module>
    import emergehelp, xpak, commands, errno, re, socket, string, time, types
  File "/usr/lib/portage/pym/emergehelp.py", line 5, in <module>
    import selinux
ImportError: No module named selinux
Traceback (most recent call last):
  File "/usr/bin/emerge", line 31, in <module>
    import emergehelp, xpak, commands, errno, re, socket, string, time, types
  File "/usr/lib/portage/pym/emergehelp.py", line 5, in <module>
    import selinux
ImportError: No module named selinux
 * 
 * Warning: Failed to resolve package order.
 * Will merge in arbitrary order
 * 
Possible reasons:
- An ebuild is no longer in the portage tree.
- An ebuild is masked, use /etc/portage/packages.keyword
and/or /etc/portage/package.unmask to unmask it
.....
 * All prepared. Starting rebuild
emerge --oneshot  app-cdr/k3b:0
app-office/kword:3.5
app-text/xpdf:0
dev-tex/luatex:0
dev-util/kdevelop:0
kde-base/kcontrol:3.5
kde-base/kdebase-kioslaves:3.5
kde-base/kdelibs:3.5
kde-base/khelpcenter:3.5
kde-base/konqueror:3.5
kde-base/kopete:3.5
kde-base/kpdf:3.5
media-gfx/gimp:2
media-libs/libquicktime:0
..........
Traceback (most recent call last):
  File "/usr/bin/emerge", line 31, in <module>
    import emergehelp, xpak, commands, errno, re, socket, string, time, types
  File "/usr/lib/portage/pym/emergehelp.py", line 5, in <module>
    import selinux
ImportError: No module named selinux
 * 
 * revdep-rebuild failed to emerge all packages.
 * you have the following choices:
 * - If emerge failed during the build, fix the problems and re-run revdep-rebuild.
 * - Use /etc/portage/package.keywords to unmask a newer version of the package.
 *   (and remove 5_order.rr to be evaluated again)
 * - Modify the above emerge command and run it manually.
 * - Compile or unmerge unsatisfied packages manually,
 *   remove temporary files, and try again.
 *   (you can edit package/ebuild list first)
 * 
 * To remove temporary files, please run:
 * rm /tmp/revdep-rebuild/*.rr
 * Found some broken files that weren't associated with known packages
 * The broken files are:
 *   /usr/lib/vmware/libconf/lib/gtk-2.0/modules/libatk-bridge.so
 *   /usr/lib/vmware/lib/libcurl.so.3/libcurl.so.3
 *   /usr/lib/vmware/lib/libspi.so.0/libspi.so.0
I think, the packages listed above have nothing to do with the situation...

Any more ideas?
Top
Mike Hunt
Watchman
Watchman
User avatar
Posts: 5287
Joined: Sun Jul 19, 2009 11:01 pm

  • Quote

Post by Mike Hunt » Fri Jan 08, 2010 11:16 pm

What about in /etc/portage/package.use ?

You can also reset the profile (I think you use #1)

Code: Select all

eselect profile set --force 1
Top
zgredek
Apprentice
Apprentice
Posts: 186
Joined: Wed Jun 15, 2005 8:59 pm

  • Quote

Post by zgredek » Fri Jan 08, 2010 11:25 pm

Mike Hunt wrote:What about in /etc/portage/package.use ?

You can also reset the profile (I think you use #1)

Code: Select all

eselect profile set --force 1
package.use is empty.

Code: Select all

# eselect profile set --force 1
#
Profile was already set to 1.
Top
Mike Hunt
Watchman
Watchman
User avatar
Posts: 5287
Joined: Sun Jul 19, 2009 11:01 pm

  • Quote

Post by Mike Hunt » Fri Jan 08, 2010 11:40 pm

Make sure your python symlink is correct

Code: Select all

# eselect python set --python2 python2.6
eselect python list --python2
Did you remove that Python-2.6.4 folder from the previous repairs ?
Top
zgredek
Apprentice
Apprentice
Posts: 186
Joined: Wed Jun 15, 2005 8:59 pm

  • Quote

Post by zgredek » Fri Jan 08, 2010 11:48 pm

Mike Hunt wrote:Make sure your python symlink is correct

Code: Select all

# eselect python set --python2 python2.6
eselect python list --python2
Did you remove that Python-2.6.4 folder from the previous repairs ?
Symlink:

Code: Select all

# ls -l /usr/bin/python*  
lrwxrwxrwx 1 root root    9 2010-01-08 23:48 /usr/bin/python2 -> python2.5
-rwxr-xr-x 1 root root 3280 2008-03-30 20:22 /usr/bin/python2.4
-rwxr-xr-x 1 root root 3280 2008-11-30 21:37 /usr/bin/python2.5
-rwxr-xr-x 1 root root 5352 2009-10-31 17:43 /usr/bin/python2.6
lrwxrwxrwx 1 root root    9 2009-12-24 01:52 /usr/bin/python3 -> python3.1
-rwxr-xr-x 1 root root 5384 2009-10-31 17:25 /usr/bin/python3.1
The folder is still there, but I don't use it.
Top
Mike Hunt
Watchman
Watchman
User avatar
Posts: 5287
Joined: Sun Jul 19, 2009 11:01 pm

  • Quote

Post by Mike Hunt » Fri Jan 08, 2010 11:52 pm

Ok, get rid of that Python-2.6.4 folder, because it can interfere.
Also make sure that eselect python show = python2.6
and run python-updater
Top
Post Reply

49 posts
  • 1
  • 2
  • Next

Return to “Portage & Programming”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic