Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 613936 - app-portage/layman aborting with message "ImportError: cannot import name 'DependencyWarning'"
Summary: app-portage/layman aborting with message "ImportError: cannot import name 'De...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal blocker (vote)
Assignee: Layman Overlay Manager project
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-03-26 21:32 UTC by Marius
Modified: 2022-10-28 05:55 UTC (History)
2 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 Marius 2017-03-26 21:32:29 UTC
With one of the last updates layman (or python?) seem to have broke completely:

---
# layman
Traceback (most recent call last):
  File "/usr/lib/python-exec/python3.4/layman", line 30, in <module>
    from   layman.cli            import Main
  File "/usr/lib64/python3.4/site-packages/layman/cli.py", line 29, in <module>
    from layman.api import LaymanAPI
  File "/usr/lib64/python3.4/site-packages/layman/api.py", line 25, in <module>
    from layman.remotedb        import RemoteDB
  File "/usr/lib64/python3.4/site-packages/layman/remotedb.py", line 46, in <module>
    from   sslfetch.connections     import Connector
  File "/usr/lib64/python3.4/site-packages/sslfetch/connections.py", line 40, in <module>
    import requests
  File "/usr/lib64/python3.4/site-packages/requests/__init__.py", line 60, in <module>
    from .packages.urllib3.exceptions import DependencyWarning
ImportError: cannot import name 'DependencyWarning'
#
---


Also, when trying to emerge --sync, layman aborts:


---
...
=== Sync completed for gentoo
>>> Syncing repository 'vifino-overlay' into '/var/lib/layman/vifino-overlay'...
>>> Starting layman sync for vifino-overlay...
Traceback (most recent call last):
  File "/usr/lib64/python3.4/site-packages/portage/util/_async/AsyncFunction.py", line 39, in _run
    result = self.target(*(self.args or []), **(self.kwargs or {}))
  File "/usr/lib64/python3.4/site-packages/portage/sync/controller.py", line 159, in sync
    taskmaster.run_tasks(tasks, func, status, options=task_opts)
  File "/usr/lib64/python3.4/site-packages/portage/sync/controller.py", line 66, in run_tasks
    result = getattr(inst, func)(**kwargs)
  File "/usr/lib64/python3.4/site-packages/portage/sync/syncbase.py", line 125, in sync
    return self.update()
  File "/usr/lib64/python3.4/site-packages/portage/sync/modules/laymansync/subproc.py", line 114, in update
    **portage._native_kwargs(self.spawn_kwargs))
AttributeError: 'module' object has no attribute '_native_kwargs'
>>> Syncing repository 'nightmare' into '/var/lib/layman/nightmare'...
>>> Starting layman sync for nightmare...
Traceback (most recent call last):
  File "/usr/lib64/python3.4/site-packages/portage/util/_async/AsyncFunction.py", line 39, in _run
    result = self.target(*(self.args or []), **(self.kwargs or {}))
  File "/usr/lib64/python3.4/site-packages/portage/sync/controller.py", line 159, in sync
    taskmaster.run_tasks(tasks, func, status, options=task_opts)
  File "/usr/lib64/python3.4/site-packages/portage/sync/controller.py", line 66, in run_tasks
    result = getattr(inst, func)(**kwargs)
  File "/usr/lib64/python3.4/site-packages/portage/sync/syncbase.py", line 125, in sync
    return self.update()
  File "/usr/lib64/python3.4/site-packages/portage/sync/modules/laymansync/subproc.py", line 114, in update
    **portage._native_kwargs(self.spawn_kwargs))
AttributeError: 'module' object has no attribute '_native_kwargs'
>>> Syncing repository '0x4d4c' into '/var/lib/layman/0x4d4c'...
>>> Starting layman sync for 0x4d4c...
Traceback (most recent call last):
  File "/usr/lib64/python3.4/site-packages/portage/util/_async/AsyncFunction.py", line 39, in _run
    result = self.target(*(self.args or []), **(self.kwargs or {}))
  File "/usr/lib64/python3.4/site-packages/portage/sync/controller.py", line 159, in sync
    taskmaster.run_tasks(tasks, func, status, options=task_opts)
  File "/usr/lib64/python3.4/site-packages/portage/sync/controller.py", line 66, in run_tasks
    result = getattr(inst, func)(**kwargs)
  File "/usr/lib64/python3.4/site-packages/portage/sync/syncbase.py", line 125, in sync
    return self.update()
  File "/usr/lib64/python3.4/site-packages/portage/sync/modules/laymansync/subproc.py", line 114, in update
    **portage._native_kwargs(self.spawn_kwargs))
AttributeError: 'module' object has no attribute '_native_kwargs'
# 
---



Here's my emerge info:

---
# emerge --info
Portage 2.3.3 (python 3.4.5-final-0, default/linux/amd64/13.0, gcc-4.9.4, glibc-2.23-r3, 4.9.9-gentoo x86_64)
=================================================================
System uname: Linux-4.9.9-gentoo-x86_64-Intel-R-_Core-TM-_i5-7200U_CPU_@_2.50GHz-with-gentoo-2.3
KiB Mem:     8105628 total,   5351120 free
KiB Swap:    8388604 total,   8388604 free
Timestamp of repository gentoo: Sun, 26 Mar 2017 21:00:01 +0000
sh bash 4.3_p48-r1
ld GNU ld (Gentoo 2.25.1 p1.1) 2.25.1
app-shells/bash:          4.3_p48-r1::gentoo
dev-lang/perl:            5.22.3_rc4::gentoo
dev-lang/python:          2.7.12::gentoo, 3.4.5::gentoo
dev-util/cmake:           3.7.2::gentoo
dev-util/pkgconfig:       0.28-r2::gentoo
sys-apps/baselayout:      2.3::gentoo
sys-apps/openrc:          0.23.2::gentoo
sys-apps/sandbox:         2.10-r3::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69::gentoo
sys-devel/automake:       1.14.1::gentoo, 1.15::gentoo
sys-devel/binutils:       2.25.1-r1::gentoo, 2.26.1::gentoo
sys-devel/gcc:            4.9.4::gentoo
sys-devel/gcc-config:     1.7.3::gentoo
sys-devel/libtool:        2.4.6-r3::gentoo
sys-devel/make:           4.2.1::gentoo
sys-kernel/linux-headers: 4.4::gentoo (virtual/os-headers)
sys-libs/glibc:           2.23-r3::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000

0x4d4c
    location: /var/lib/layman/0x4d4c
    sync-type: laymansync
    sync-uri: https://github.com/0x4d4c/gentoo-overlay.git
    masters: gentoo
    priority: 50

nightmare
    location: /var/lib/layman/nightmare
    sync-type: laymansync
    sync-uri: https://gitlab.com/r3lgar/nightmare.git
    masters: gentoo
    priority: 50

sublime-text
    location: /var/lib/layman/sublime-text
    sync-type: laymansync
    sync-uri: git://github.com/DamnWidget/sublime-text.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

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /etc/stunnel/stunnel.conf /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/php/apache2-php7.1/ext-active/ /etc/php/cgi-php7.1/ext-active/ /etc/php/cli-php7.1/ext-active/ /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-march=native -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="rsync://mirror.eu.oneandone.net/gentoo/ rsync://mirror.netcologne.de/gentoo/ rsync://ftp.halifax.rwth-aachen.de/gentoo/ rsync://ftp-stud.hs-esslingen.de/gentoo/"
LANG="en_US.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j4"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
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_TMPDIR="/var/tmp"
USE="X aac acl aes alsa amd64 avx avx2 berkdb bzip2 cli cracklib crypt cxx dbus dri encode fma3 fortran gdbm graphviz iconv imagemagick infinality inotify ipv6 javascript jbig jpeg jpeg2k lcms libass libcaca libnotify lm_sensors lzma mmx mmxext modules mono mp3 mp4 mpeg mplayer multilib ncurses networkmanager nls nptl ogg openal opengl openmp pam pcre png popcnt postscript pulseaudio readline rss samba sdl seccomp session slang smp socks5 sound sox sqlite sse sse2 sse3 sse4_1 sse4_2 ssl ssse3 svg tcpd theora threads tiff truetype udev unicode upower usb v4l vaapi vdpau vorbis wavpack webkit wifi wmf x264 xattr xcomposite 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 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="emu efi-64 pc" INPUT_DEVICES="evdev synaptics" KERNEL="linux" 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" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_4" RUBY_TARGETS="ruby21" USERLAND="GNU" VIDEO_CARDS="intel i965" 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"
Unset:  CC, CPPFLAGS, CTARGET, CXX, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON
---
Comment 1 Brian Dolbec (RETIRED) gentoo-dev 2017-04-08 17:26:21 UTC
    import requests
  File "/usr/lib64/python3.4/site-packages/requests/__init__.py", line 60, in <module>
    from .packages.urllib3.exceptions import DependencyWarning
ImportError: cannot import name 'DependencyWarning'


This error is caused by internal dev-python/requests code.

Please try re-emerging dev-python/requests to see if that resolves the problem. 


Zac, is the _native_kwargs error something that still needs fixing in portage?
Comment 2 Marius 2017-04-09 11:48:32 UTC
I performed an emerge -e dev-python/requests and rebooted my system, unfortunately I'm still seeing those issues.
Comment 3 Brian Dolbec (RETIRED) gentoo-dev 2017-04-09 14:03:36 UTC
Next on the suspect list then is python3.4.  You have another python installe, try switching to python2.7?

Hopefully portage/layman is installed to that python as well.  If so, do you get those same errors with that other python?
Comment 4 Marius 2017-04-09 16:56:53 UTC
Thanks Brian, indeed switching Python versions helped here.

What I did:

eselect python set python2.7
emerge --sync
Comment 5 Zac Medico gentoo-dev 2017-04-09 18:58:42 UTC
(In reply to Brian Dolbec from comment #1)
> Zac, is the _native_kwargs error something that still needs fixing in
> portage?

We removed _native_kwargs in 2.3.0 since it was only only neeeded for Python < 2.6.5:

https://gitweb.gentoo.org/proj/portage.git/commit/?id=9590cb4bf4140e3fc5610b1ea0e290b2df93c24a
Comment 6 Brian Dolbec (RETIRED) gentoo-dev 2017-04-09 19:21:15 UTC
Thanks Zac.

So, your python-3.4 install is totally messed up then.  You should probably re-emerge python-3.4 to be safe and probably re-emerge any python programs you want installed to it.  It will be hard to tell which of them may be broken.
There must have been a recent portage upgrade that didn't make into you messed up 3.4 install.  Check your make.conf PYTHON_TARGETS variable to be sure it is still set correctly.
Comment 7 Marius 2017-04-09 21:03:11 UTC
I've tried `emerge -e python && eselect python set python3.4 && emerge --sync`, unfortunately layman still failed. So I tried `emerge layman` (while 2.7 was active) and this happened:

>>> Installing (1 of 1) app-portage/layman-2.4.2::gentoo
 * Running layman-updater...
Traceback (most recent call last):
  File "/usr/lib/python-exec/python3.4/layman-updater", line 21, in <module>
    from layman.updater import Main
  File "/usr/lib64/python3.4/site-packages/layman/updater.py", line 12, in <module>
    from layman.api           import LaymanAPI
  File "/usr/lib64/python3.4/site-packages/layman/api.py", line 25, in <module>
    from layman.remotedb        import RemoteDB
  File "/usr/lib64/python3.4/site-packages/layman/remotedb.py", line 46, in <module>
    from   sslfetch.connections     import Connector
  File "/usr/lib64/python3.4/site-packages/sslfetch/connections.py", line 40, in <module>
    import requests
  File "/usr/lib64/python3.4/site-packages/requests/__init__.py", line 60, in <module>
    from .packages.urllib3.exceptions import DependencyWarning
ImportError: cannot import name 'DependencyWarning'


Then I activated 3.4 and re-tried emerging layman, resulting in the same output.
I'm not quite sure what's wrong here, but all I can say is that every other Python program besides layman seems to be working just fine.
Comment 8 Zac Medico gentoo-dev 2017-04-09 21:19:26 UTC
(In reply to Marius from comment #7)
>     from .packages.urllib3.exceptions import DependencyWarning
> ImportError: cannot import name 'DependencyWarning'

It looks like you need a newer version of urllib3. The DependencyWarning exception is not available in dev-python/urllib3-1.12, so we'll have to require a newer version in the layman ebuilds. See this commit which is present only in tags since 1.14:

https://github.com/shazow/urllib3/commit/4f12e74955c7356e9d839d3ff776600cd4f61f89
Comment 9 Zac Medico gentoo-dev 2017-04-09 21:38:56 UTC
Actually it's the dev-python/requests dependencies that were wrong. Fixed now:

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6dcba13330f43b79d6e9e459287a7111892e0389
Comment 10 Zac Medico gentoo-dev 2017-04-09 21:49:04 UTC
(In reply to Marius from comment #0)
> "/usr/lib64/python3.4/site-packages/portage/sync/modules/laymansync/subproc.
> py", line 114, in update
>     **portage._native_kwargs(self.spawn_kwargs))
> AttributeError: 'module' object has no attribute '_native_kwargs'

It looks like this still needs to be fixed, because the current code still uses portage._native_kwargs:

https://github.com/gentoo/layman/blob/2.4.1/pm_plugins/portage/sync/modules/laymansync/subproc.py#L75
Comment 11 Zac Medico gentoo-dev 2017-04-09 21:58:40 UTC
Pull request sent:

https://github.com/gentoo/layman/pull/41
Comment 12 Devan Franchini (RETIRED) gentoo-dev 2017-06-22 23:55:00 UTC
I merged the pull request to the GitHub codebase. I'll be pushing those commits to the Gentoo git repo as well.
Comment 13 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-10-28 05:55:37 UTC
Fixed in 2.4.3 (thx to joecool for noticing).