2

I'm getting an ImportError when trying to use Nala after installation:

$ sudo nala update
Traceback (most recent call last):
  File "/usr/bin/nala", line 5, in <module>
    from nala.__main__ import main
  File "/usr/lib/python3/dist-packages/nala/__main__.py", line 30, in <module>
    import nala.fetch as _fetch  # pylint: disable=unused-import
  File "/usr/lib/python3/dist-packages/nala/fetch.py", line 37, in <module>
    import typer
  File "/usr/lib/python3/dist-packages/typer/__init__.py", line 12, in <module>
    from click.termui import get_terminal_size as get_terminal_size
ImportError: cannot import name 'get_terminal_size' from 'click.termui' (/usr/lib/python3/dist-packages/click/termui.py)

This is on a server installation that has been upgraded to 22.04 and not from a fresh install of 22.04. From a historical perspective, this server was initially built with 12.04 and has been upgraded several times to 22.04.

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.2 LTS
Release:        22.04
Codename:       jammy

Nala was installed as follows:

sudo apt install nala

As a test, I installed Nala on a fresh installation of Ubuntu 22.04 in a Virtual Box machine, and it works fine. So it looks like the problem is associated with this system being an upgrade to 22.04.

I also did the following:

wget https://gitlab.com/volian/volian-archive/uploads/b20bd8237a9b20f5a82f461ed0704ad4/volian-archive-keyring_0.1.0_all.deb\
wget https://gitlab.com/volian/volian-archive/uploads/d6b3a118de5384a0be2462905f7e4301/volian-archive-nala_0.1.0_all.deb
sudo apt install ./volian-archive*.deb
sudo apt --purge autoremove nala
sudo apt install nala

Additional info:

  • Nala Version:

    $ apt policy nala
    nala:
      Installed: 0.12.3
      Candidate: 0.12.3
      Version table:
     *** 0.12.3 100
            100 https://deb.volian.org/volian scar/main amd64 Packages
            100 https://deb.volian.org/volian scar/main i386 Packages
            100 /var/lib/dpkg/status
         0.12.2 100
            100 https://deb.volian.org/volian scar/main amd64 Packages
            100 https://deb.volian.org/volian scar/main i386 Packages
         0.11.1~bpo22.04.1 100
            100 http://us.archive.ubuntu.com/ubuntu jammy-backports/universe amd64 Packages
            100 http://us.archive.ubuntu.com/ubuntu jammy-backports/universe i386 Packages
    
  • python3-pip version:

    $ apt policy python3-pip
    python3-pip:
      Installed: 22.0.2+dfsg-1ubuntu0.2
      Candidate: 22.0.2+dfsg-1ubuntu0.2
      Version table:
     *** 22.0.2+dfsg-1ubuntu0.2 500
            500 http://us.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 Packages
            500 http://us.archive.ubuntu.com/ubuntu jammy-updates/universe i386 Packages
            500 http://security.ubuntu.com/ubuntu jammy-security/universe amd64 Packages
            500 http://security.ubuntu.com/ubuntu jammy-security/universe i386 Packages
            100 /var/lib/dpkg/status
         22.0.2+dfsg-1 500
            500 http://us.archive.ubuntu.com/ubuntu jammy/universe amd64 Packages
            500 http://us.archive.ubuntu.com/ubuntu jammy/universe i386 Packages
    
  • python3-typer version:

    $ apt policy python3-typer
    python3-typer:
      Installed: 0.4.0-1
      Candidate: 0.4.0-1
      Version table:
         0.7.0-1 100
            100 https://deb.volian.org/volian scar/main amd64 Packages
            100 https://deb.volian.org/volian scar/main i386 Packages
     *** 0.4.0-1 500
            500 http://us.archive.ubuntu.com/ubuntu jammy/universe amd64 Packages
            500 http://us.archive.ubuntu.com/ubuntu jammy/universe i386 Packages
            100 /var/lib/dpkg/status
    
  • python3-click version:

    $ apt policy python3-click
    python3-click:
      Installed: 8.1.3-2
      Candidate: 8.1.3-2
      Version table:
     *** 8.1.3-2 100
            100 https://deb.volian.org/volian scar/main amd64 Packages
            100 https://deb.volian.org/volian scar/main i386 Packages
            100 /var/lib/dpkg/status
         8.0.3-1 500
            500 http://us.archive.ubuntu.com/ubuntu jammy/main amd64 Packages
            500 http://us.archive.ubuntu.com/ubuntu jammy/main i386 Packages
    
  • And the following resulted in no output:

    $ sudo apt-mark showhold
    

I don't know how to resolve this. Does anyone have any suggestions?

mpboden
  • 3,046

1 Answers1

3

I also have nala installed on Ubuntu 22.04, and it works fine. So I think you're right that something happened during the upgrade.

I would suggest you uninstall (and purge) your current version of nala, and reinstall the latest version.

Remove (Purge) Old Nala

Remove the current version and all related packages and files:

sudo apt autoremove --purge nala

Use with caution: Be very certain that this only removes packages related to nala.

Now you can install nala in 2 ways: From Ubuntu repo or from Volian repo.

Install Nala from Ubuntu repo
sudo apt update && sudo apt install nala

Nala version from this repo will be 0.11.1~bpo22.04.1.

Install Nala from Volian repo

First install the repo and key:

wget https://gitlab.com/volian/volian-archive/uploads/b20bd8237a9b20f5a82f461ed0704ad4/volian-archive-keyring_0.1.0_all.deb
wget https://gitlab.com/volian/volian-archive/uploads/d6b3a118de5384a0be2462905f7e4301/volian-archive-nala_0.1.0_all.deb
sudo apt install ./volian-archive*.deb

Then install nala from the Volian repo:

sudo apt update && sudo apt install nala

Nala version from this repo will be 0.12.3.

From the info provided, it seems the python3-typer module hasn't been upgraded. Do so manually by running:

sudo apt install python3-typer=0.7.0-1
Artur Meinild
  • 31,035