openSUSE / obs-service-tar_scm

An OBS source service: fetches code from any SCM and archives it
GNU General Public License v2.0
31 stars 105 forks source link

ModuleNotFoundError: No module named 'yaml' #252

Open mmetak opened 6 years ago

mmetak commented 6 years ago

I hope this is the right place for this issue report. Currently, all builds for archlinux that use obs_scm fail with the error in the title. Bellow, I copied the build log from the official obs-service-tar_scm package in openSUSE:Tools and the required package is installed python2-yaml.

[   55s] [141/157] installing python2-yaml-3.13-2
[   55s] [142/157] installing util-linux-2.32.1-2
[   55s] [143/157] installing git-2.19.0-1
[   57s] [144/157] installing apr-1.6.3-1
[   57s] [145/157] installing python2-dateutil-2.7.3-2
[   57s] [146/157] installing python2-packaging-17.1-2
[   57s] [147/157] installing python2-traceback2-1.4.0-4
[   57s] [148/157] installing fakeroot-1.23-1
[   57s] [149/157] installing systemd-239.2-1
[   58s] Initializing machine ID from random generator.
[   58s] Created symlink /etc/systemd/system/getty.target.wants/getty@tty1.service -> /usr/lib/systemd/system/getty@.service.
[   58s] Created symlink /etc/systemd/system/multi-user.target.wants/remote-fs.target -> /usr/lib/systemd/system/remote-fs.target.
[   58s] :: Append 'init=/usr/lib/systemd/systemd' to your kernel command line in your
[   58s]    bootloader to replace sysvinit with systemd, or install systemd-sysvcompat
[   58s] :: Running post-transaction hooks...
[   58s] (1/8) Updating journal message catalog...
[   58s] (2/8) Reloading system manager configuration...
[   58s]   Skipped: Current root is not booted.
[   58s] (3/8) Updating udev hardware database...
[   58s] (4/8) Applying kernel sysctl settings...
[   58s]   Skipped: Current root is not booted.
[   58s] (5/8) Creating system user accounts...
[   58s] (6/8) Creating temporary files...
[   58s] (7/8) Reloading device manager configuration...
[   58s]   Skipped: Device manager is not running.
[   58s] (8/8) Arming ConditionNeedsUpdate...
[   58s] [150/157] installing apr-util-1.6.1-3
[   59s] :: Running post-transaction hooks...
[   59s] (1/1) Arming ConditionNeedsUpdate...
[   59s] [151/157] installing python2-setuptools-1:40.4.1-1
[   59s] :: Running post-transaction hooks...
[   59s] (1/1) Arming ConditionNeedsUpdate...
[   59s] [152/157] installing python2-unittest2-1.1.0-4
[   59s] :: Running post-transaction hooks...
[   59s] (1/1) Arming ConditionNeedsUpdate...
[   59s] [153/157] installing python2-pbr-4.2.0-1
[   59s] :: Running post-transaction hooks...
[   59s] (1/1) Arming ConditionNeedsUpdate...
[   59s] [154/157] installing serf-1.3.9-2
[   59s] :: Running post-transaction hooks...
[   59s] (1/1) Arming ConditionNeedsUpdate...
[   59s] [155/157] installing python2-mock-2.0.0-4
[   59s] :: Running post-transaction hooks...
[   59s] (1/1) Arming ConditionNeedsUpdate...
[   59s] [156/157] installing subversion-1.10.2-2
[   60s] :: Running post-transaction hooks...
[   60s] (1/4) Warn about old perl modules
[   60s] (2/4) Reloading system manager configuration...
[   60s]   Skipped: Current root is not booted.
[   60s] (3/4) Creating temporary files...
[   60s] (4/4) Arming ConditionNeedsUpdate...
[   60s] [157/157] installing obs-service-tar_scm-0.9.1.1537341862.5348694-0
[   60s] :: Running post-transaction hooks...
[   60s] (1/1) Arming ConditionNeedsUpdate...
[   60s] removing nis flags from //etc/nsswitch.conf...
[   60s] now finalizing build dir...
[   60s] SIOCSIFADDR: File exists
[   60s] Unpacking obs-service-tar_scm-0.9.1.1537341862.5348694.obscpio ...
[   60s] 522 blocks
[   60s] Running build time source services...
[   60s] Traceback (most recent call last):
[   60s]   File "/usr/lib/obs/service/tar", line 22, in <module>
[   60s]     import TarSCM        # pylint: disable=wrong-import-position
[   60s]   File "/usr/lib/obs/service/TarSCM/__init__.py", line 6, in <module>
[   60s]     from TarSCM.tasks      import Tasks
[   60s]   File "/usr/lib/obs/service/TarSCM/tasks.py", line 14, in <module>
[   60s]     import yaml
[   60s] ModuleNotFoundError: No module named 'yaml'
[   60s] service run failed for service 'tar'
[   60s] 
[   60s] lamb58 failed "build PKGBUILD" at Thu Sep 20 11:30:02 UTC 2018.
mmetak commented 6 years ago

After some digging, I think I found the problem. obs-service-tar_scm pulls obs-service-recompress as a dependency that according to its PKGBUILD file, depends solely on python (it's python3 on archlinux). So, pacman installs python and python2.

This causes the problem. When there are both versions of python installed (2 & 3) then when building this package I get shebang for python3, #!/usr/bin/python3 in file /usr/lib/obs/service/tar_scm.

I solved this problem by updating obs-service-recompress PKGBUILD file and replacing python in depends with depends=('bzip2' 'gzip' 'xz'). This dependency was weird in the first place for archlinux. Packages for other distros don't depend on python.