Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 261165 - app-admin/webapp-config-1.50.16-r3: broken. ImportError: No module named portage
Summary: app-admin/webapp-config-1.50.16-r3: broken. ImportError: No module named portage
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Gentoo Web Application Packages Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-03-04 13:26 UTC by Vilhelm von Ehrenheim
Modified: 2013-08-03 13:15 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vilhelm von Ehrenheim 2009-03-04 13:26:04 UTC
When I try to use webapp-config it fails directly with the error "ImportError: No module named portage". I've tried to re-emerge both webapp-config and python but it is always the same error. I've also tried to run python-updater but this does not solve it either. 

If i run python interpreter I can run "import portage" whithout any problems.

Reproducible: Didn't try




I don't know if it's relevant but I've changed the profile to hardened on this machine since it was first installed.

Here is the emerge --info.

Portage 2.1.6.7 (hardened/x86, gcc-4.1.2, glibc-2.6.1-r0, 2.6.20-gentoo-r8 i686)
=================================================================
System uname: Linux-2.6.20-gentoo-r8-i686-Intel-R-_Pentium-R-_4_CPU_1.70GHz-with-glibc2.0
Timestamp of tree: Wed, 25 Feb 2009 16:45:02 +0000
app-shells/bash:     3.2_p39
dev-java/java-config: 1.3.7-r1, 2.1.6-r1
dev-lang/python:     2.5.2-r7
dev-python/pycrypto: 2.0.1-r6
sys-apps/baselayout: 1.12.9-r2
sys-apps/sandbox:    1.2.18.1-r2
sys-devel/autoconf:  2.63
sys-devel/automake:  1.9.6-r2, 1.10.2
sys-devel/binutils:  2.18-r3
sys-devel/gcc-config: 1.4.0-r4
sys-devel/libtool:   1.5.26
virtual/os-headers:  2.4.33.3
ACCEPT_KEYWORDS="x86"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -march=i686 -pipe"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/terminfo /etc/udev/rules.d"
CXXFLAGS="-O2 -march=i686 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="distlocks fixpackages parallel-fetch protect-owned sandbox sfperms strict unmerge-orphans userfetch"
GENTOO_MIRRORS="http://mirror.uni-c.dk/pub/gentoo http://ds.thn.htu.se/linux/gentoo ftp://ftp.du.se/pub/os/gentoo http://ftp.du.se/pub/os/gentoo"
LDFLAGS=""
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="a52 aac acpi alsa apache2 apm bash-completion berkdb bzip2 cdr cracklib crypt cups curl dma dri dvd emacs emacs-w32 encode esd exif fbcon ffmpeg ftp geoip gif gtk2 hardened imagemagick jack java javascript jpeg lash libwww lm_sensors lua midi mime mp3 mpeg mysql nas ncurses nls offensive ogg opengl pam pdf php pic plotutils png ppds profile python readline session sockets spell sse2 ssl stroke svg tcpd tetex tiff unicode urandom usb verbose vhosts vorbis win32codex x86 xml xorg xv xvid zlib" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="access auth auth_dbm auth_anon auth_digest authz_host alias file-cache echo charset-lite cache disk-cache mem-cache ext-filter case_filter case-filter-in deflate mime-magic cern-meta expires headers usertrack unique-id proxy proxy-connect proxy-ftp proxy-http info include cgi cgid dav dav-fs vhost-alias speling rewrite log_config logio env setenvif mime status autoindex asis negotiation dir imap actions userdir so filter" ELIBC="glibc" INPUT_DEVICES="keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" USERLAND="GNU"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LANG, LC_ALL, LINGUAS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Patrick McCarty 2009-03-26 20:30:39 UTC
I had exactly the same problem with webapp-config and I just figured out how to at least work around it.

If I ran python and typed import portage, it gave me the same error as webapp-config.
However, running sudo python and typing import portage worked.

The webapp-config program installs its files into /usr/local/lib/python2.5/site-packages/WebappConfig on my server. I don't know enough about python and gentoo to know if this is normal or not, and I don't understand why there are two python directories /usr/local/lib/python2.5 and /usr/lib/python2.5.
At any rate, I figured that maybe python code running from the local version didn't have the portage directory in its search path. So I learned how to add a directory to python's path using a .pth file:
cd /usr/local/lib/python2.5/site-packages
sudo vim portage.pth

type the following into the file and save:
/usr/lib/portage/pym

After creating this file, I was able to do import portage from a regular (non-sudo) python, and webapp-config finally worked and other webapps that depend on it finally emerged. So I got it working at least, though I don't know why the problem occurred in the first place, or why there are two python directories. I would appreciate advice on how to fix the root of the problem if that can be determined.
-Patrick
Comment 2 Vilhelm von Ehrenheim 2009-03-27 10:37:51 UTC
(In reply to comment #1)
> I had exactly the same problem with webapp-config and I just figured out how to
> at least work around it.
> If I ran python and typed import portage, it gave me the same error as
> webapp-config.
> However, running sudo python and typing import portage worked.
> The webapp-config program installs its files into
> /usr/local/lib/python2.5/site-packages/WebappConfig on my server. I don't know
> enough about python and gentoo to know if this is normal or not, and I don't
> understand why there are two python directories /usr/local/lib/python2.5 and
> /usr/lib/python2.5.
> At any rate, I figured that maybe python code running from the local version
> didn't have the portage directory in its search path. So I learned how to add a
> directory to python's path using a .pth file:
> cd /usr/local/lib/python2.5/site-packages
> sudo vim portage.pth
> type the following into the file and save:
> /usr/lib/portage/pym
> After creating this file, I was able to do import portage from a regular
> (non-sudo) python, and webapp-config finally worked and other webapps that
> depend on it finally emerged. So I got it working at least, though I don't know
> why the problem occurred in the first place, or why there are two python
> directories. I would appreciate advice on how to fix the root of the problem if
> that can be determined.
> -Patrick

This workaround worked for me to. Thanks, this has been bugging me like crazy.  

I would also like to know why this happends. Shouldn't the files be placed in the right folder to begin with and if there are two folders why isn't python looking for modules in both dirs?

// Vilhelm
Comment 3 Devan Franchini (RETIRED) gentoo-dev 2013-03-27 20:58:16 UTC
Bug has been fixed or is not reproducible on my system, regardless of whether I run it directly through my terminal, or through python. 

I'm using the latest version from the git HEAD^.