ValueError: Namespace Gtk not available ValueError: Namespace Gtk not available python-3.x python-3.x

ValueError: Namespace Gtk not available


You need to install gobject-introspection, python3-gi and gir1.2-gtk-3.0, these packages includes the files to expose the GTK+ libs to python3.

sudo apt install python3-gi gobject-introspection gir1.2-gtk-3.0
root@oz123:/home/oz123# python3Python 3.6.8 (default, Jan 14 2019, 11:02:34) [GCC 8.0.1 20180414 (experimental) [trunk revision 259383]] on linuxType "help", "copyright", "credits" or "license" for more information.>>> import gi>>> gi.require_version('Gtk', '3.0')Traceback (most recent call last):  File "<stdin>", line 1, in <module>  File "/usr/lib/python3/dist-packages/gi/__init__.py", line 130, in require_version    raise ValueError('Namespace %s not available' % namespace)ValueError: Namespace Gtk not available>>> root@oz123:/home/oz123# apt install -y gir1.2-gtk-3.0root@oz123:/home/oz123# python3Python 3.6.8 (default, Jan 14 2019, 11:02:34) [GCC 8.0.1 20180414 (experimental) [trunk revision 259383]] on linuxType "help", "copyright", "credits" or "license" for more information.>>> import gi>>> gi.require_version('Gtk', '3.0')>>> 

side-note

Packages calles xyz-dev in debian\ubuntu contain C headers, pkg-config files and autotools macros. These are only needed if you intend to build software using compiled languages such as C and C++.These all are installed to:

/usr/include/../xyz/header1.h  # headers/usr/include/../xyz/header2.h.../usr/lib/x86_64-linux-gnu/pkgconfig/libxyz.pc  # pkgconfig files.../usr/share/aclocal/xyz.m4  # autotools macros

Use dpkg -L libgtk-3-dev to see all the files installed by this package on your system.

update

please remove dropbox with dpkg -r dropbox Than reinstall with the following command

root@yeni2:/# dpkg -i dropbox_2019.02.14_amd64.deb Selecting previously unselected package dropbox.(Reading database ... 126384 files and directories currently installed.)Preparing to unpack dropbox_2019.02.14_amd64.deb ...Unpacking dropbox (2019.02.14) ...dpkg: dependency problems prevent configuration of dropbox: dropbox depends on libpango1.0-0 (>= 1.36.3); however:  Package libpango1.0-0 is not installed.dpkg: error processing package dropbox (--install): dependency problems - leaving unconfiguredProcessing triggers for man-db (2.8.3-2) ...Processing triggers for gnome-menus (3.13.3-11ubuntu1) ...Processing triggers for desktop-file-utils (0.23-1ubuntu3) ...Processing triggers for mime-support (3.60ubuntu1) ...Processing triggers for hicolor-icon-theme (0.17-2) ...Errors were encountered while processing: dropbox

Now if there missing dependencies fix them with:

root@yeni2:/# apt install -fReading package lists... DoneBuilding dependency tree       Reading state information... DoneCorrecting dependencies... DoneThe following additional packages will be installed:  libpango1.0-0 libpangox-1.0-0The following NEW packages will be installed:  libpango1.0-0 libpangox-1.0-00 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.1 not fully installed or removed.Need to get 45.0 kB of archives.After this operation, 203 kB of additional disk space will be used.Do you want to continue? [Y/n] Get:1 http://de.archive.ubuntu.com/ubuntu bionic/universe amd64 libpangox-1.0-0 amd64 0.0.2-5 [41.7 kB]Get:2 http://de.archive.ubuntu.com/ubuntu bionic/universe amd64 libpango1.0-0 amd64 1.40.14-1 [3,332 B]Fetched 45.0 kB in 0s (264 kB/s)    debconf: delaying package configuration, since apt-utils is not installedSelecting previously unselected package libpangox-1.0-0:amd64.(Reading database ... 126411 files and directories currently installed.)Preparing to unpack .../libpangox-1.0-0_0.0.2-5_amd64.deb ...Unpacking libpangox-1.0-0:amd64 (0.0.2-5) ...Selecting previously unselected package libpango1.0-0:amd64.Preparing to unpack .../libpango1.0-0_1.40.14-1_amd64.deb ...Unpacking libpango1.0-0:amd64 (1.40.14-1) ...Setting up libpangox-1.0-0:amd64 (0.0.2-5) ...Setting up libpango1.0-0:amd64 (1.40.14-1) ...Setting up dropbox (2019.02.14) ...Please restart all running instances of Nautilus, or you will experience problems. i.e. nautilus --quitDropbox installation successfully completed! You can start Dropbox from your applications menu.Processing triggers for libc-bin (2.27-3ubuntu1) ...