Во время установки стабильного репозитория Docker Engine в Ubuntu 18.04.02 Server Edition: невозможно импортировать имя '_gi' из 'gi' - PullRequest
0 голосов
/ 29 октября 2019

Следуя указанным здесь указаниям: https://docs.docker.com/install/linux/docker-ce/ubuntu/#install-using-the-repository Я пытаюсь установить Docker Engine в Ubuntu 18.04.02 Server Edition.

Первые шаги установки прошли успешно, но я обнаружил следующее сообщение об ошибке:

(base) marco@pc:~$ sudo add-apt-repository \ 
> "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
> $(lsb_release -cs) \
> stable"
Traceback (most recent call last):
  File "/usr/bin/add-apt-repository", line 11, in <module>
    from softwareproperties.SoftwareProperties import SoftwareProperties, 
shortcut_handler
  File "/usr/lib/python3/dist-packages/softwareproperties
/SoftwareProperties.py", line 67, in <module>
    from gi.repository import Gio
  File "/usr/lib/python3/dist-packages/gi/__init__.py", line 42, in 
<module>
    from . import _gi
ImportError: cannot import name '_gi' from 'gi' (/usr/lib/python3/dist-
packages/gi/__init__.py)

Но импорт gi в python3 работает нормально:

(base) marco@pc:~$ python3
Python 3.7.3 (default, Mar 27 2019, 22:11:17) 
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import gi
>>> 

Решено:

Благодаря @ Smurfz87 я обнаружил, что версия python3.7.3 вызывает эту проблему с apt-repository. После изменения первой строки / usr / bin / add-apt-repository для указания версии 3.6: #! / Usr / bin / python3.6 все прошло нормально:

(base) marco@pc:~$ sudo add-apt-repository \
>    "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
>    $(lsb_release -cs) \
>    stable"
Hit:1 http://gb.archive.ubuntu.com/ubuntu bionic InRelease
Get:2 https://download.docker.com/linux/ubuntu bionic InRelease [64.4 kB]                                                            
Get:3 http://gb.archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 
kB]                                                         
Get:4 http://gb.archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6
 kB]
Get:5 https://download.docker.com/linux/ubuntu bionic/stable amd64    
Packages [9594 B]
Get:6 http://gb.archive.ubuntu.com/ubuntu bionic-updates/universe i386 
Packages [985 kB]  
Get:7 http://gb.archive.ubuntu.com/ubuntu bionic-updates/universe amd64 
Packages [1017 kB]
Hit:8 http://apt.postgresql.org/pub/repos/apt bionic-pgdg InRelease                                                                                                                                        
Hit:9 http://ppa.launchpad.net/certbot/certbot/ubuntu bionic InRelease                                                                                                                                     
Get:10 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 
kB]                                                                                                                               
Fetched 2328 kB in 11s (217 kB/s)                                                                                                                                                                          
Reading package lists... Done

(base) marco@pc:~$ sudo apt-get update
Hit:1 http://security.ubuntu.com/ubuntu bionic-security InRelease
Hit:2 http://apt.postgresql.org/pub/repos/apt bionic-pgdg InRelease
Hit:3 http://gb.archive.ubuntu.com/ubuntu bionic InRelease
Hit:4 http://gb.archive.ubuntu.com/ubuntu bionic-updates InRelease               
Hit:5 http://gb.archive.ubuntu.com/ubuntu bionic-backports InRelease             
Hit:6 http://ppa.launchpad.net/certbot/certbot/ubuntu bionic InRelease
Hit:7 https://download.docker.com/linux/ubuntu bionic InRelease
Reading package lists... Done

(base) marco@pc:~$ sudo apt-get install docker-ce docker-ce-cli 
containerd.io
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  aufs-tools cgroupfs-mount pigz
The following NEW packages will be installed
  aufs-tools cgroupfs-mount containerd.io docker-ce docker-ce-cli pigz
0 to upgrade, 6 to newly install, 0 to remove and 0 not to upgrade.
Need to get 85.6 MB of archives.
After this operation, 384 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y

Как решитьпроблема?

Марко

...