Tagged: how_to

Python: idle: no python-exec wrapped executable found in /usr/lib/python-exec

Python IDLE

IDLE is Python’s Integrated Development and Learning Environment where it allows programmers to easily write Python code. It's like a shell, you can execute a single statement or create/execute a Python script.

If you see below error message when you try to run IDLE, it's most likely you are missing tk USE flag for python.

idle: no python-exec wrapped executable found in /usr/lib/python-exec

To check if you are missing the tk USE flag, first check the python version:$ eselect python list Available Python interpreters, in order of preference: [1] python3.8 [2] python3.9 (fallback)

Also, check the system configuration file, /etc/python-exec/python-exec.conf, for python version:

FILE /etc/python-exec/python-exec.conf
... python3.8

Then, execute emerge with the following flags to see if tk USE flag was enabled originally. In below case, tk is not enabled since it's -tk.# emerge -pve world | grep -i dev-lang/python-3.8 [ebuild R ] dev-lang/python-3.8.8:3.8::gentoo USE="gdbm ipv6 ncurses readline sqlite ssl xml -bluetooth -build -examples -hardened (-libressl) -test -tk -verify-sig -wininst" 0 KiB

Disclaimer:
The information in this site is the result of my researches on the Internet and of my experiences. This information below is solely used for my purpose and may not be suitable for others.

To enable the flag, you need to re-run emerge with the tk flag.# USE=tk emerge -a dev-lang/python:3.8

After successful update, check if it's enabled by running the same command: # emerge -pve world | grep -i dev-lang/python-3.8 [ebuild R ] dev-lang/python-3.8.8:3.8::gentoo USE="gdbm ipv6 ncurses readline sqlite ssl tk xml -bluetooth -build -examples -hardened (-libressl) -test -verify-sig -wininst" 0 KiB

That's all!
-gibb

Displaying Desktop Notification w/ cron

Gentoo Linux needs to run a set of scheduled maintenance commands to keep the system up-to-date. I try to run them weekly, but I sometimes (or often) forget to do so. To remind myself, I decided to display some kind of system notification. Gentoo Linux comes with a command for that. It's called notify-send. This command can be configured to run weekly with cron (with a bit of extra commands and arguments). After playing with different options, following setting with cron finally worked for me.

Disclaimer:
The information in this site is the result of my researches on the Internet and of my experiences. This information below is solely used for my purpose and may not be suitable for others.

# crontab -e # This command runds at 7am on Fridays 00 7 * * 5 export DISPLAY=:0.0 && export XAUTHORITY=/home/[user-name]/.Xauthority && /usr/bin/notify-send -t 0 'Maintenance' 'Run the maintenance commands'

Without the -t 0 option, the notification disappears within a certain time. This option will let the notification stays up until it's clicked.

Step for Maintaining Gentoo Server

That's all!
-gibb

Getting Sound Working From VirtualBox Clients

I got the sound working on my new system (Dell Precision 3640 Tower) with Gentoo after following the steps in Getting Sound (ALSA) Working on Gentoo. However, I couldn't get through from any of VirtualBox clients (Window$10, Manjaro Linux, or Ubuntu)

Some advices on the internet were to change the settings for Host Audio Driver and Audio Controller options on the VirtualBox host side. I tried all combination but couldn't get it working.

Disclaimer:
The information in this site is the result of my researches on the Internet and of my experiences. This information below is solely used for my purpose and may not be suitable for others.

PulseAudio:

PulseAudio is a general purpose sound server intended to run as a middleware between applications and ALSA. I never needed to install PulseAudio to get the sound working before, so I followed the Gentoo Wiki: PulseAudio.

Kernel Update & Installation:

The Gentoo Wiki: PulseAudio shows which kernel options to turn on using make menuconfig and recompiling the kernel. # cd /usr/src/linux # make menuconfig # make && make modules_install ... # make install ... # grub-mkconfig -o /boot/grub/grub.cfg ...

After rebooting, make sure that the kernel version is updated by uname -r:# uname-v #5 SMP Fri Duc 18 14:46:23 EST 2020

Then, install pulseaudio:# emerge --ask media-sound/pulse

USE flags:

Once pulseaudio is installed, enable the system to support pulseaudio for some applications by updating /etc/portage/make.conf:

FILE /etc/portage/make.conf
USE="... pulseaudio ..."

Then update the system:# emerge --ask --changed-use --deep @world

ALSA Plugin:

ALSA needs to be configured to output to PulseAudio by default:# emerge --ask media-plugins/alsa-plugins

After following the above steps, the next time VirtualBox is started, the sound should be enabled from a client OS.

That's all!
-gibb

Updated: Python Modules

Disclaimer:
The information in this site is the result of my researches in the Internet and of my experiences. This information below is solely used for my purpose and may not be suitable for others.

Python Modules for i3pystatus:

With a fresh install, I seem to have issues with properly starting i3pystatus in both my workstation and VirtualBox guest. The following statement to execute i3pystatus in the i3wm config file no longer seem to be working. So, after a lot of googling, I found a solution that worked for me:... bar { # Below statement used to work before but this now gives following error message: # Traceback (most recent call last): # File ".../pystatusconfig.py", line 1, in # from i3pystatus import Status # ModuleNotFoundError: No module name 'i3pystatus' # # status_command python3 -c ~/.config/i3/pystatusconfig.py # # But after switching to below statement, it runs without above error message. status_command i3pystatus -c ~/.config/i3/pystatusconfig.py ...

pyalsaaudio:

Then, I needed to install alsaaudio python module for the volume control to work in addition to aforementioned colour, netifaces, and psutil: $ pip install --user colour \ netifaces \ psutil \ pyalsaaudio

CpuUsage: TypeError:

After above issues have been taken care of, and restarting i3pystatus, another error pops up. This time, it was something about a format issue for CpuUsage. The exact error message was this "CpuUsage: TypeError: format() missing 1 required positional argument: 'format_string'". I stumbled upon this one before and couldn't figure out even after googling. I copied the same statements as others but still got the error. Then I learned that there was an issue opened for this or something similar in enkore/i3pystatus. According to this thread, there is a fix for it and applied to the source code, but mine didn't get that fix for some reasons. So, I manually fixed it.

The target file is ~/.local/lib/python3.8/site-packages/i3pystatus/cpu_usage.py. In this file, at line 88, a string "format_string=" needs to be removed. ... # At the line 88, the "format_string=" string needs to be removed. # string = self.formatter.format(format_string=self.format_all, string = self.formatter.format(self.format_all, ...

That's all!
-gibb

Updated: NVIDIA Drivers

Disclaimer:
The information in this site is the result of my researches in the Internet and of my experiences. This information below is solely used for my purpose and may not be suitable for others.

NVIDIA Drivers:

The new video card installed on DELL Precision 3640 Tower is Nvidia Quadro P620, and the driver for this card is included in x11-drivers/nvidia-drivers. So, no need to download drivers from the NVIDIA website. Just run and follow the instruction of post installation at Gentoo Wiki: NVIDIA/nvidia-drivers : # emerge --ask x11-drivers/nvidia-drivers

That's all!
-gibb