# $pip install no funciona!   (Solucionado)

## Greg_P

Estoy tratando de resolver el siguiente problema y llevo en ello un par de horas.

dev-python/pip  cuando intento una búsqueda o instalar un paquete me muestra el siguiente error 

$pip2 search tornado

```

Exception:

Traceback (most recent call last):

  File "/usr/lib64/python2.7/site-packages/pip/basecommand.py", line 215, in main

    status = self.run(options, args)

  File "/usr/lib64/python2.7/site-packages/pip/commands/search.py", line 45, in run

    pypi_hits = self.search(query, options)

  File "/usr/lib64/python2.7/site-packages/pip/commands/search.py", line 59, in search

    with self._build_session(options) as session:

  File "/usr/lib64/python2.7/site-packages/pip/basecommand.py", line 72, in _build_session

    insecure_hosts=options.trusted_hosts,

  File "/usr/lib64/python2.7/site-packages/pip/download.py", line 329, in __init__

    self.headers["User-Agent"] = user_agent()

  File "/usr/lib64/python2.7/site-packages/pip/download.py", line 93, in user_agent

    from pip._vendor import distro

  File "/usr/lib64/python2.7/site-packages/pip/_vendor/distro.py", line 1050, in <module>

    _distro = LinuxDistribution()

  File "/usr/lib64/python2.7/site-packages/pip/_vendor/distro.py", line 594, in __init__

    if include_lsb else {}

  File "/usr/lib64/python2.7/site-packages/pip/_vendor/distro.py", line 922, in _get_lsb_release_info

    stdout, stderr = stdout.decode('utf-8'), stderr.decode('utf-8')

  File "/usr/lib64/python2.7/encodings/utf_8.py", line 16, in decode

    return codecs.utf_8_decode(input, errors, True)

UnicodeDecodeError: 'utf8' codec can't decode byte 0xf3 in position 35: invalid continuation byte
```

ya intente lo siguiente

emerger  dev-python/pip, dev-lang/python:3.5, dev-lang/python:2.7, dev-lang/python-exec

sin resultados

Saludos!!Last edited by Greg_P on Sat Mar 17, 2018 5:04 pm; edited 5 times in total

----------

## Greg_P

también me podrían aconsejar como re-instalar todo el ambiente de python desde cero,

ya que re-instalar todo el sistema no es un a opción (todo lo demás funciona OK)

emerge funciona OK

mi problema es que necesito comenzar a estudiar programación con python próximamente:

Saludos

----------

## ZaPa

Hola.

Recuerda, estas usando gentoo, aqui las "comidas preparadas" no existen. Tienes que prepararlas tu mismo  :Smile:  .

En la wiki de gentoo tienes info sobre python.

https://wiki.gentoo.org/wiki/Python

Un saludo.

----------

## Greg_P

Buenas; gracias por responder

Entiendo lo de "gentoo", de hecho por eso estoy usando esta distro (además me gusta aprender).

En ocasiones reparo cosas, enlaces simbólicos, modificando código, recompilado etc..

Pero acá no tengo ninguna pista y googleando tampoco encuentro nada.

porque pip falla cuando realizó una búsqueda $pip search,

pero funciona correctamente cuando ejecuto $pip chech o $pip list

Hasta ahora no había usado la herramienta, de hecho todo paquete dependiente de python lo he

instalado en el sistema a través de portage.

Como dato acabo de instalar el paquete a través 

dev-python/setuptools 

easy_install --user platformio en el directorio /home/user/.local

por lo que debe ser un bug, o algo similar

emerge --info

[/code]

```
Portage 2.3.19 (python 2.7.14-final-0, default/linux/amd64/17.0/systemd, gcc-6.4.0, glibc-2.25-r9, 4.9.72-gentoo

x86_64)

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

System uname: Linux-4.9.72-gentoo-x86_64-Intel-R-_Core-TM-_i7-4770K_CPU_@_3.50GHz-with-gentoo-2.4.1

KiB Mem:    16346480 total,  13634760 free

KiB Swap:   16383996 total,  16383996 free

Timestamp of repository gentoo: Fri, 26 Jan 2018 03:30:01 +0000

Head commit of repository gentoo: ba5ab003dd8ef58f73a8eff2b475405d0fe1b2da

sh bash 4.4_p12

ld GNU ld (Gentoo 2.29.1 p3) 2.29.1

app-shells/bash:          4.4_p12::gentoo

dev-lang/perl:            5.24.3::gentoo

dev-lang/python:          2.7.14-r1::gentoo, 3.5.4-r1::gentoo

dev-util/cmake:           3.9.6::gentoo

dev-util/pkgconfig:       0.29.2::gentoo

sys-apps/baselayout:      2.4.1-r2::gentoo

sys-apps/sandbox:         2.12::gentoo

sys-devel/autoconf:       2.13::gentoo, 2.69-r4::gentoo

sys-devel/automake:       1.11.6-r2::gentoo, 1.15.1-r1::gentoo

sys-devel/binutils:       2.29.1-r1::gentoo

sys-devel/gcc:            6.4.0-r1::gentoo

sys-devel/gcc-config:     1.8-r1::gentoo

sys-devel/libtool:        2.4.6-r3::gentoo

sys-devel/make:           4.2.1::gentoo

sys-kernel/linux-headers: 4.13::gentoo (virtual/os-headers)

sys-libs/glibc:           2.25-r9::gentoo

Repositories:

gentoo

    location: /usr/portage

    sync-type: rsync

    sync-uri: rsync://rsync.gentoo.org/gentoo-portage

    priority: -1000

    sync-rsync-extra-opts:

localrepo

    location: /usr/local/portage

    masters: gentoo

booboo

    location: /var/lib/layman/booboo

    sync-type: laymansync

    sync-uri: https://github.com/l29ah/booboo.git

    masters: gentoo

    priority: 50

gentoo-zh

    location: /var/lib/layman/gentoo-zh

    sync-type: laymansync

    sync-uri: git://github.com/microcai/gentoo-zh.git

    masters: gentoo

    priority: 50

jorgicio

    location: /var/lib/layman/jorgicio

    sync-type: laymansync

    sync-uri: https://github.com/jorgicio/jorgicio-gentoo.git

    masters: gentoo

    priority: 50

miramir

    location: /var/lib/layman/miramir

    sync-type: laymansync

    sync-uri: https://github.com/miramir/miramir-layman.git

    masters: gentoo

    priority: 50

vifino-overlay

    location: /var/lib/layman/vifino-overlay

    sync-type: laymansync

    sync-uri: https://github.com/vifino/vifino-overlay.git

    masters: gentoo

    priority: 50

wizard

    location: /var/lib/layman/wizard

    sync-type: laymansync

    sync-uri: https://github.com/m31271n/wizard.git

    masters: gentoo

    priority: 50

ABI="amd64"

ABI_X86="64"

ACCEPT_KEYWORDS="amd64"

ACCEPT_LICENSE="* -@EULA"

ACCEPT_PROPERTIES="*"

ACCEPT_RESTRICT="*"

ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801

hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci"

APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_

dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex

cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers includ

e info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir u

sertrack vhost_alias"

ARCH="amd64"

AUTOCLEAN="yes"

BOOTSTRAP_USE="cxx unicode internal-glib python_targets_python3_5 python_targets_python2_7 multilib"

CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author"

CBUILD="x86_64-pc-linux-gnu"

CFLAGS="-march=native -O2 -pipe"

CFLAGS_amd64="-m64"

CFLAGS_x32="-mx32"

CFLAGS_x86="-m32"

CHOST="x86_64-pc-linux-gnu"

CHOST_amd64="x86_64-pc-linux-gnu"

CHOST_x32="x86_64-pc-linux-gnux32"

CHOST_x86="i686-pc-linux-gnu"

CLEAN_DELAY="5"

COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog"

COLLISION_IGNORE="/lib/modules/* *.py[co] *$py.class */dropin.cache"

CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/gnupg/qualified.txt"

CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo

-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"

CPU_FLAGS_X86="aes avx avx2 fma3 mmx mmxext pclmul popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3"

CXXFLAGS="-march=native -O2 -pipe"

DBUS_SESSION_BUS_ADDRESS="unix:abstract=/tmp/dbus-OB4HVB52MI,guid=a241a84d2dbe9255489509d75a6cd07d"

DEFAULT_ABI="amd64"

DESKTOP_SESSION="openbox"

DISPLAY=":0.0"

DISTDIR="/usr/portage/distfiles"

EDITOR="/bin/nano"

ELIBC="glibc"

EMERGE_DEFAULT_OPTS="--jobs 8 --load-average=4 --verbose --ask --with-bdeps=y"

EMERGE_WARNING_DELAY="10"

EPREFIX=""

EROOT="/"

FCFLAGS="-O2 -pipe"

FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync mult

ilib-strict news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-

logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"

FETCHCOMMAND="wget -t 3 -T 60 --passive-ftp -O "${DISTDIR}/${FILE}" "${URI}""

FETCHCOMMAND_RSYNC="rsync -avP "${URI}" "${DISTDIR}/${FILE}""

FETCHCOMMAND_SFTP="bash -c "x=\${2#sftp://} ; host=\${x%%/*} ; port=\${host##*:} ; host=\${host%:*} ; [[ \${host}

 = \${port} ]] && port= ; eval \"declare -a ssh_opts=(\${3})\" ; exec sftp \${port:+-P \${port}} \"\${ssh_opts[@]

}\" \"\${host}:/\${x#*/}\" \"\$1\"" sftp "${DISTDIR}/${FILE}" "${URI}" "${PORTAGE_SSH_OPTS}""

FETCHCOMMAND_SSH="bash -c "x=\${2#ssh://} ; host=\${x%%/*} ; port=\${host##*:} ; host=\${host%:*} ; [[ \${host} =

 \${port} ]] && port= ; exec rsync --rsh=\"ssh \${port:+-p\${port}} \${3}\" -avP \"\${host}:/\${x#*/}\" \"\$1\""

rsync "${DISTDIR}/${FILE}" "${URI}" "${PORTAGE_SSH_OPTS}""

FFLAGS="-O2 -pipe"

GCC_SPECS=""

GDMSESSION="openbox"

GDM_LANG="es_CL.utf8"

GENTOO_MIRRORS="http://distfiles.gentoo.org"

GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock isync itrax mtk3301 nmea ntrip na

vcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx"

GRUB_PLATFORMS="efi-64"

GSETTINGS_BACKEND="dconf"

GTK_MODULES="canberra-gtk-module"

HOME="/home/greg"

INFINALITY_FT_AUTOHINT_HORIZONTAL_STEM_DARKEN_STRENGTH="10"

INFINALITY_FT_AUTOHINT_INCREASE_GLYPH_HEIGHTS="true"

INFINALITY_FT_AUTOHINT_SNAP_STEM_HEIGHT="100"

INFINALITY_FT_AUTOHINT_VERTICAL_STEM_DARKEN_STRENGTH="25"

INFINALITY_FT_BOLD_EMBOLDEN_X_VALUE="0"

INFINALITY_FT_BOLD_EMBOLDEN_Y_VALUE="0"

INFINALITY_FT_BRIGHTNESS="0"

INFINALITY_FT_CHROMEOS_STYLE_SHARPENING_STRENGTH="0"

INFINALITY_FT_CONTRAST="0"

INFINALITY_FT_FILTER_PARAMS="11 22 38 22 11"

INFINALITY_FT_FRINGE_FILTER_STRENGTH="0"

INFINALITY_FT_GAMMA_CORRECTION="0 100"

INFINALITY_FT_GLOBAL_EMBOLDEN_X_VALUE="0"

INFINALITY_FT_GLOBAL_EMBOLDEN_Y_VALUE="0"

INFINALITY_FT_GRAYSCALE_FILTER_STRENGTH="0"

INFINALITY_FT_STEM_ALIGNMENT_STRENGTH="25"

INFINALITY_FT_STEM_FITTING_STRENGTH="25"

INFINALITY_FT_STEM_SNAPPING_SLIDING_SCALE="40"

INFINALITY_FT_USE_KNOWN_SETTINGS_ON_SELECTED_FONTS="true"

INFINALITY_FT_USE_VARIOUS_TWEAKS="true"

INFINALITY_FT_WINDOWS_STYLE_SHARPENING_STRENGTH="5"

INFOPATH="/usr/share/gcc-data/x86_64-pc-linux-gnu/6.4.0/info:/usr/share/binutils-data/x86_64-pc-linux-gnu/2.29.1/

info:/usr/share/info"

INPUT_DEVICES="libinput keyboard mouse"

IUSE_IMPLICIT="abi_x86_64 prefix prefix-chain prefix-guest"

KERNEL="linux"

L10N="es es-CL es-419"

LANG="es_CL.iso88591"

LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text"

LC_COLLATE="C"

LC_CTYPE="es_CL.iso88591"

LC_MESSAGES="C"

LDFLAGS="-Wl,-O1 -Wl,--as-needed"

LDFLAGS_amd64="-m elf_x86_64"

LDFLAGS_x32="-m elf32_x86_64"

LDFLAGS_x86="-m elf_i386"

LESS="-R -M --shift 5"

LESSOPEN="|lesspipe %s"

LIBDIR_amd64="lib64"

LIBDIR_x32="libx32"

LIBDIR_x86="lib32"

LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer"

LOGNAME="greg"

LSCOLORS="Gxfxcxdxbxegedabagacad"

LS_COLORS="rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;0

5;37;41:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=

01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;3

1:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31

:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.wa

r=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;3

1:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35

:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.ti

ff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=

01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;3

5:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl

=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.cfg=00;32:*.conf=00;

32:*.diff=00;32:*.doc=00;32:*.ini=00;32:*.log=00;32:*.patch=00;32:*.pdf=00;32:*.ps=00;32:*.tex=00;32:*.txt=00;32:

*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.og

g=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:"

MAIL="/var/mail/greg"

MAKEOPTS="-j9 -l8"

MANPAGER="manpager"

MANPATH="/usr/share/gcc-data/x86_64-pc-linux-gnu/6.4.0/man:/usr/share/binutils-data/x86_64-pc-linux-gnu/2.29.1/ma

n:/usr/lib/llvm/5/share/man:/usr/local/share/man:/usr/share/man:/usr/share/rust-1.23.0/man"

MULTILIB_ABIS="amd64 x86"

MULTILIB_STRICT_DENY="64-bit.*shared object"

MULTILIB_STRICT_DIRS="/lib32 /lib /usr/lib32 /usr/lib /usr/kde/*/lib32 /usr/kde/*/lib /usr/qt/*/lib32 /usr/qt/*/l

ib /usr/X11R6/lib32 /usr/X11R6/lib"

MULTILIB_STRICT_EXEMPT="(perl5|gcc|gcc-lib|binutils|eclipse-3|debug|portage|udev|systemd|clang|python-exec|llvm)"

NETBEANS="apisupport cnd groovy gsf harness ide identity j2ee java mobility nb php profiler soa visualweb webcomm

on websvccommon xml"

OFFICE_IMPLEMENTATION="libreoffice"

OLDPWD="/home/greg/Workspace/virtualenv"

OPENCL_PROFILE="nvidia"

OPENGL_PROFILE="nvidia"

PAGER="/usr/bin/less"

PATH="/usr/x86_64-pc-linux-gnu/gcc-bin/6.4.0:/usr/lib/llvm/5/bin:/usr/local/bin:/usr/bin:/bin:/opt/bin"

PHP_TARGETS="php5-6 php7-0"

PKGDIR="/usr/portage/packages"

PORTAGE_ARCHLIST="alpha amd64 amd64-fbsd amd64-linux arm arm-linux arm64 arm64-linux hppa ia64 m68k m68k-mint mip

s nios2 ppc ppc-aix ppc-macos ppc64 ppc64-linux riscv s390 sh sparc sparc-solaris sparc64-solaris x64-cygwin x64-

macos x64-solaris x86 x86-cygwin x86-fbsd x86-linux x86-macos x86-solaris x86-winnt"

PORTAGE_BIN_PATH="/usr/lib/portage/python2.7"

PORTAGE_COMPRESS_EXCLUDE_SUFFIXES="css gif htm[l]? jp[e]?g js pdf png"

PORTAGE_CONFIGROOT="/"

PORTAGE_DEBUG="0"

PORTAGE_DEPCACHEDIR="/var/cache/edb/dep"

PORTAGE_ELOG_CLASSES="log warn error"

PORTAGE_ELOG_MAILFROM="portage@localhost"

PORTAGE_ELOG_MAILSUBJECT="[portage] ebuild log for ${PACKAGE} on ${HOST}"

PORTAGE_ELOG_MAILURI="root"

PORTAGE_ELOG_SYSTEM="save_summary:log,warn,error,qa echo"

PORTAGE_FETCH_CHECKSUM_TRY_MIRRORS="5"

PORTAGE_FETCH_RESUME_MIN_SIZE="350K"

PORTAGE_GID="250"

PORTAGE_GPG_SIGNING_COMMAND="gpg --sign --digest-algo SHA256 --clearsign --yes --default-key "${PORTAGE_GPG_KEY}"

 --homedir "${PORTAGE_GPG_DIR}" "${FILE}""

PORTAGE_INST_GID="0"

PORTAGE_INST_UID="0"

PORTAGE_INTERNAL_CALLER="1"

PORTAGE_NICENESS="15"

PORTAGE_OVERRIDE_EPREFIX=""

PORTAGE_PYM_PATH="/usr/lib64/python2.7/site-packages"

PORTAGE_PYTHONPATH="/usr/lib64/python2.7/site-packages"

PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-

file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --

exclude=/.git"

PORTAGE_RSYNC_RETRIES="-1"

PORTAGE_SYNC_STALE="30"

PORTAGE_TMPDIR="/var/tmp"

PORTAGE_VERBOSE="1"

PORTAGE_WORKDIR_MODE="0700"

PORTAGE_XATTR_EXCLUDE="btrfs.* security.evm security.ima    security.selinux system.nfs4_acl user.apache_hand

ler    user.Beagle.* user.dublincore.* user.mime_encoding user.xdg.*"

PORT_LOGDIR_CLEAN="find "${PORT_LOGDIR}" -type f ! -name "summary.log*" -mtime +7 -delete"

POSTGRES_TARGETS="postgres9_5"

PROFILE_ONLY_VARIABLES="ARCH ELIBC IUSE_IMPLICIT KERNEL USERLAND USE_EXPAND_IMPLICIT USE_EXPAND_UNPREFIXED USE_EX

PAND_VALUES_ARCH USE_EXPAND_VALUES_ELIBC USE_EXPAND_VALUES_KERNEL USE_EXPAND_VALUES_USERLAND"

PWD="/home/greg/Workspace/virtualenv/atom"

PYTHONDONTWRITEBYTECODE="1"

PYTHON_SINGLE_TARGET="python3_5"

PYTHON_TARGETS="python2_7 python3_5"

QT_QPA_PLATFORMTHEME="qt5ct"

RESUMECOMMAND="wget -c -t 3 -T 60 --passive-ftp -O "${DISTDIR}/${FILE}" "${URI}""

RESUMECOMMAND_RSYNC="rsync -avP "${URI}" "${DISTDIR}/${FILE}""

RESUMECOMMAND_SSH="bash -c "x=\${2#ssh://} ; host=\${x%%/*} ; port=\${host##*:} ; host=\${host%:*} ; [[ \${host}

= \${port} ]] && port= ; exec rsync --rsh=\"ssh \${port:+-p\${port}} \${3}\" -avP \"\${host}:/\${x#*/}\" \"\$1\""

 rsync "${DISTDIR}/${FILE}" "${URI}" "${PORTAGE_SSH_OPTS}""

ROOT="/"

ROOTPATH="/usr/x86_64-pc-linux-gnu/gcc-bin/6.4.0:/usr/lib/llvm/5/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/us

r/bin:/sbin:/bin:/opt/bin"

RPMDIR="/usr/portage/rpm"

RUBY_TARGETS="ruby22 ruby23"

SHELL="/bin/zsh"

SHLVL="4"

SYMLINK_LIB="yes"

TERM="xterm"

TERMINOLOGY="1"

TWISTED_DISABLE_WRITING_OF_PLUGIN_CACHE="1"

UNINSTALL_IGNORE="/lib/modules/* /var/run /var/lock"

USE="/ X a52 aac acl acpi alsa amd64 berkdb bluetooth branding bzip2 cairo cdda cdr cleartype cli corefonts crypt

 cuda cups cxx dbus dri dts dvd dvdr emboss encode exif fam firefox flac fortran gdbm gif glamor gpm gtk iconv in

finality ipv6 jpeg lcms ldap libnotify libsamplerate mad mng modules mp3 mp4 mpeg multilib ncurses nls nptl ogg o

pengl openmp pam pango pcre pdf png policykit ppds qt3support qt5 readline sdl seccomp sox spell ssl startup-notification svg systemd tcpd tiff truetype type1 udev udisks unicode upower usb vdpau vorbis wxwidgets x264 xattr xcb xinerama xml xv xvid zlib zsh-completion" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx avx2 fma3 mmx mmxext pclmul popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="efi-64" INPUT_DEVICES="libinput keyboard mouse" KERNEL="linux" L10N="es es-CL es-419" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6 php7-0" POSTGRES_TARGETS="postgres9_5" PYTHON_SINGLE_TARGET="python3_5" PYTHON_TARGETS="python2_7 python3_5" RUBY_TARGETS="ruby22 ruby23" USERLAND="GNU" VIDEO_CARDS="nvidia" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"

USER="greg"

USERLAND="GNU"

USE_EXPAND="ABI_MIPS ABI_PPC ABI_S390 ABI_X86 ALSA_CARDS APACHE2_MODULES APACHE2_MPMS CALLIGRA_EXPERIMENTAL_FEATURES CALLIGRA_FEATURES CAMERAS COLLECTD_PLUGINS CPU_FLAGS_ARM CPU_FLAGS_X86 CURL_SSL ELIBC ENLIGHTENMENT_MODULES FFTOOLS GPSD_PROTOCOLS GRUB_PLATFORMS INPUT_DEVICES KERNEL L10N LCD_DEVICES LIBREOFFICE_EXTENSIONS LIRC_DEVICES LLVM_TARGETS MONKEYD_PLUGINS NETBEANS_MODULES NGINX_MODULES_HTTP NGINX_MODULES_MAIL NGINX_MODULES_STREAM OFED_DRIVERS OFFICE_IMPLEMENTATION OPENMPI_FABRICS OPENMPI_OFED_FEATURES OPENMPI_RM PHP_TARGETS POSTGRES_TARGETS PYTHON_SINGLE_TARGET PYTHON_TARGETS QEMU_SOFTMMU_TARGETS QEMU_USER_TARGETS ROS_MESSAGES RUBY_TARGETS SANE_BACKENDS USERLAND UWSGI_PLUGINS VIDEO_CARDS VOICEMAIL_STORAGE XFCE_PLUGINS XTABLES_ADDONS"

USE_EXPAND_HIDDEN="ABI_MIPS ABI_PPC ABI_S390 CPU_FLAGS_ARM ELIBC KERNEL USERLAND"

USE_EXPAND_IMPLICIT="ARCH ELIBC KERNEL USERLAND"

USE_EXPAND_UNPREFIXED="ARCH"

USE_EXPAND_VALUES_ARCH="alpha amd64 amd64-fbsd amd64-linux arm arm-linux arm64 hppa ia64 m68k m68k-mint mips nios2 ppc ppc64 ppc64-linux ppc-aix ppc-macos riscv s390 sh sparc sparc64-solaris sparc-solaris x64-cygwin x64-macos x64-solaris x86 x86-cygwin x86-fbsd x86-linux x86-macos x86-solaris x86-winnt"

USE_EXPAND_VALUES_ELIBC="AIX bionic Cygwin Darwin DragonFly FreeBSD glibc HPUX Interix mingw mintlib musl NetBSD OpenBSD SunOS uclibc Winnt"

USE_EXPAND_VALUES_KERNEL="AIX Darwin FreeBSD freemint HPUX linux NetBSD OpenBSD SunOS Winnt"

USE_EXPAND_VALUES_USERLAND="BSD GNU"

USE_ORDER="env:pkg:conf:defaults:pkginternal:repo:env.d"

VBOX_APP_HOME="/usr/lib64/virtualbox"

VIDEO_CARDS="nvidia"

XAUTHORITY="/home/greg/.Xauthority"

XDG_CONFIG_DIRS="/etc/xdg"

XDG_DATA_DIRS="/usr/local/share:/usr/share"

XDG_GREETER_DATA_DIR="/var/lib/lightdm-data/greg"

XDG_RUNTIME_DIR="/run/user/1000"

XDG_SEAT="seat0"

XDG_SEAT_PATH="/org/freedesktop/DisplayManager/Seat0"

XDG_SESSION_DESKTOP="openbox"

XDG_SESSION_ID="2"

XDG_SESSION_PATH="/org/freedesktop/DisplayManager/Session0"

XDG_SESSION_TYPE="x11"

XDG_VTNR="7"

XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"

XTERM_256_COLORS="1"

ZSH="/usr/share/oh-my-zsh"
```

----------

## Stolz

 *Greg_P wrote:*   

> Hasta ahora no había usado la herramienta, de hecho todo paquete dependiente de python lo he
> 
> instalado en el sistema a través de portage.

 

Si vas a estudiar programación con Python verás que es común tener que instalar paquetes/librerias de Python que te hacen la vida más fácil. Como muchas de las herramientas de Gentoo y otros programas cotidianos dependen de Python, instalar esas librerías usando Portage no es muy buena idea porque en el mejor de los casos te pueden crear muchos conflictos de versiones (que se pueden resolver pero con mucho trabajo) y en el peor de los casos te pueden 'romper' tu sistema.

Por eso mi consejo es que no instales los paquetes de Python que requieras para programar directamente en tu sistema sino mediante un entorno virtual de Python. 

Para dejar el sistema como estaba antes edita el fichero /var/lib/portage/world e intenta quitar todos los paquetes que no requieras para uso cotidiano mas info [url]https://wiki.gentoo.org/wiki/Selected_set_(Portage)[/url]. Luego ejecutar "emerge -uavDN world" seguido de "emerge --depclean -av" (por si acaso, haz primero una copia de todos los programas listados usando el comando "quickpkg") y con eso deberías tener el sistema a día y libre de paquetes superfluos.

Para crear un entorno virtual de Python llamado `miProyecto` ejecuta

```
python -m venv miProyecto
```

Eso creará un subdirectorio llamado miProyecto en tu directorio actual. El comando también instala de forma automática los paquetes PIP y setuptools dentro del entorno virtual.

Para entrar en el entorno virtual ejecuta

```
cd miProyecto && source ./bin/activate
```

Una vez dentro del entorno, la variable $PATH se modifica automáticamente para usar la versión de Python de tu entorno virtual en vez de la de tu sistema. Además todos los paquetes que instales con "pip install 'SomePackage'" se instalarán dentro del entorno virtual, sin afectar a tu sistema.

Para salir del entorno virtual ejecuta

```
deactivate
```

Puedes tener tantos entornos virtuales como quieras, cada uno con su propia version de Python, sus propias dependencias, etc,... sin afectar a tu sistema y sin riesgo de romper Gentoo.

Hay cientos de tutoriales online explicando mejor los entornos virtuales pero creo que con eso ya te haces buena idea de porqué es la forma recomendada de programar en Python.

----------

## Greg_P

Solucionado 

El problema era que mi sistema usaba la localización iso88591 y para que python pueda interpretar correctamente 

el código (caracteres) debe utilizar UTF-8 (codificación de caracteres Unicode)

[Por lo mismo la solución es adaptar eñ locale a .utf8

https://wiki.gentoo.org/wiki/Localization/Guide/es

```
 File "/usr/lib64/python2.7/encodings/utf_8.py", line 16, in decode

    return codecs.utf_8_decode(input, errors, True)

UnicodeDecodeError: 'utf8' codec can't decode byte 0xf3 in position 35: invalid continuation byte
```

Finalmente para utilizar python en gentoo recomiendo utilizar virtualenv y virtualenvwrapper

para proteger el sistema de corrupción debido a la actualización de librerías.

----------

