import utmp fails with ImportError: No module named utmpaccess

Bug #1578261 reported by Ken Baker
28
This bug affects 5 people
Affects Status Importance Assigned to Milestone
python-utmp (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

In a fresh installation of Ubuntu 16.04, I install python, and python-utmp. I run python and try to import utmp. The import fails as follows:

$ python
Python 2.7.11+ (default, Apr 17 2016, 14:00:29)
[GCC 5.3.1 20160413] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import utmp
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/dist-packages/utmp.py", line 1, in <module>
    import utmpaccess
ImportError: No module named utmpaccess
>>>

Description: Ubuntu 16.04 LTS
Release: 16.04

$ apt-cache policy python
python:
  Installed: 2.7.11-1
  Candidate: 2.7.11-1
  Version table:
 *** 2.7.11-1 500
        500 http://ports.ubuntu.com/ubuntu-ports xenial/main armhf Packages
        100 /var/lib/dpkg/status

$ apt-cache policy python-utmp
python-utmp:
  Installed: 0.8.2
  Candidate: 0.8.2
  Version table:
 *** 0.8.2 500
        500 http://ports.ubuntu.com/ubuntu-ports xenial/universe armhf Packages
        100 /var/lib/dpkg/status

Revision history for this message
Ken Baker (bakerkj) wrote :

I believe this bug is caused by the transition from dh_pysupport to dh_python2 and the difference in how shared libraries are handled.

The old package (0.8+nmu1ubuntu3) installed the .so file here:
/usr/lib/pyshared/python2.7/utmpaccessmodule.so

The new package (0.8.2) installs the .so file here:
/usr/lib/python2.7/dist-packages/utmpaccessmodule.arm-linux-gnueabihf.so

Python can't find the module in the new location. It either needs to be:
/usr/lib/python2.7/dist-packages/utmpaccessmodule.so
Or here:
/usr/lib/python2.7/dist-packages/utmpaccess.arm-linux-gnueabihf.so

I believe the second is correct.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in python-utmp (Ubuntu):
status: New → Confirmed
Revision history for this message
ricolai (ricolai) wrote :

On x86_64, I confirm that :
sudo ln -s /usr/lib/python2.7/dist-packages/utmpaccessmodule.x86_64-linux-gnu.so /usr/lib/python2.7/dist-packages/utmpaccess.x86_64-linux-gnu.so

fixes the problem.

Revision history for this message
Ken Baker (bakerkj) wrote :

Any chance of getting this bug fixed in Ubuntu Xenial?

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.