Error detected while processing function jedi#init_python[11]..26_display_exception:

While using Vim in a Python virtual environment created using the venv module, this error pops up when opening a Python script:

Error detected while processing function jedi#init_python[11]..26_display_exception:
line 19:
Error: jedi-vim failed to initialize Python: jedi#setup_python_imports: ModuleNotFoundError: No module named ‘jedi’ (in function jedi#init_python[4]..26_init_python[27]..jedi#setup_python_imports, li
ne 27). See :messages and/or :JediDebugInfo for more information.

Let’s gather some information about the working environment:

Vim version:

:vers

VIM - Vi IMproved 8.1 (2018 May 18, compiled Mar 19 2020 13:12:18)
Included patches: 1-875, 878, 884, 948, 1046, 1365-1368, 1382, 1401

OS information:

cat /etc/os-release
NAME="Ubuntu"
VERSION="19.10 (Eoan Ermine)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 19.10"
VERSION_ID="19.10"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=eoan
UBUNTU_CODENAME=eoan

Current status of the jedi-vim plugin installation:

dpkg -l |grep vim-python-jedi

Package: vim-python-jedi
Version: 0.14.1-1
Priority: optional
Section: universe/python
Source: python-jedi
Origin: Ubuntu
Maintainer: Ubuntu Developers
Original-Maintainer: Piotr O┼╝arowski
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 117 kB
Depends: python3-jedi, vim-nox | vim-python
Recommends: vim-addon-manager
Homepage: https://github.com/davidhalter/jedi
Download-Size: 24.0 kB
APT-Manual-Installed: yes
APT-Sources: http://ca.archive.ubuntu.com/ubuntu eoan/universe amd64 Packages
Description: autocompletion tool for Python - VIM addon files
Jedi is an autocompletion tool for Python. It works. With and without
syntax errors. Sometimes it sucks, but that's normal in dynamic languages.
But it sucks less than other tools. It understands almost all of the basic
Python syntax elements including many builtins.
.
`vim-addons install python-jedi` will create all needed symlinks in
~/.vim/

Vim plugins using the OS package installer (for Debian/Ubuntu based distros) are handled by the vim-addons utility.

To list all the installed Vim plugins:

vim-addons list


editexisting
espeak
justify
matchit
python-jedi

The version provided by Ubuntu for jedi-vim is older than the latest one publicly available. For more details about the releases: jedi-vim releases

Since version 8, Vim has now a native plugins management.

For more details:


:h packages
:h package-create

To install the vanilla version of jedi-vim and have it available at Vim startup:


unzip -d jedi-vim ~/Downloads/jedi-vim-0.10.0.zip
mkdir -p ~/.vim/pack/vendor/start/jedi-vim
cp -rf jedi/vim/* ~/.vim/pack/vendor/start/jedi-vim/

~./vim/pack/vendor/start is the destination folder for any packages that contain plugins for Vim and automatically enabled at startup.

The plugin is now available and ready to be used in Vim.

If Vim is used in a Python virtual environment, the following error pops up:

jedi-vim: Error when loading the jedi python module (module ‘jedi’ has no attribute ‘__version__’). Please ensure that Jedi is installed correctly (see Installation in the README.

Furthermore, the Python code autocompletion feature provided by jedi-vim is not available in Vim.

2 options are available to fix this issue:

Either install the Python module jedi within the virtual environment using pip

Or re-create the virtual environment and enable access to the system site-packages dir (https://docs.python.org/3.7/library/venv.html) as follows:

python3 -m venv --system-site-packages my_new_env

Enable this new virtual environment:

cd $HOME/my_new_env

source bin/activate

python -c 'import jedi'

If there is anything wrong with loading this module:

Traceback (most recent call last):
File “”, line 1, in
ModuleNotFoundError: No module named ‘jedi’

This module will be picked up from the version installed using the OS package manager. For Ubuntu, jedi is provided by the python3-jedi package.

LibreOffice Calc: How to format cells for time duration ?

LibreOffice Calc provides different possibilities for formatting cells to include time information.
If you want to use functions such MIN, MAX or AVERAGE on time duration formatted cells, the most appropriate category for time duration is [H]:MM

More details:

https://ask.libreoffice.org/en/question/27557/calc-user-defined-number-format-for-time-duration-showing-hours-and-minutes/

The LibreOffice built-in help for current UI language (English (USA)) is not installed on your computer

If you’re using LibreOffice 6.3.5.2 on Ubuntu 19.10, the built-in help is not available by default within the whole application.
In Ubuntu, the built-in help documentation has its dedicated package.
For the English USA language:


apt info libreoffice-help-en-us
Package: libreoffice-help-en-us
Version: 1:6.3.5-0ubuntu0.19.10.1
Priority: optional
Section: doc
Source: libreoffice
Origin: Ubuntu
Maintainer: Ubuntu Developers
Original-Maintainer: Debian LibreOffice Maintainers
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 19.8 MB
Provides: libreoffice-help (= 6.3)
Depends: libreoffice-common (= 1:6.3.5-0ubuntu0.19.10.1), libreoffice-l10n-en-us, libreoffice-help-common (= 1:6.3.5-0ubuntu0.19.10.1)
Recommends: libreoffice-core (>> 1:6.3.5)
Replaces: libreoffice-help-common (<< 1:6.1.0~beta1)
Homepage: http://www.libreoffice.org
Task: ubuntu-desktop-default-languages, lubuntu-live, ubuntu-mate-live, ubuntu-budgie-live
Supported: 9m
Download-Size: 1,371 kB
APT-Sources: http://ca.archive.ubuntu.com/ubuntu eoan-updates/main amd64 Packages
Description: office productivity suite -- English_american help
LibreOffice is a full-featured office productivity suite that provides a
near drop-in replacement for Microsoft(R) Office.
.
This package contains the help of LibreOffice in English_american.

To install it:


apt install libreoffice-help-en-us

The package libreoffice-help-common will also be installed as a required dependency.

Missing documentation in Vim on Suse Linux Enterprise Server 12 SP4

Offline Vim documentation usually comes with the Vim binary itself and can be accessed with the following Vim command:

:h help.txt

Regarding the OS vendor, the documentation is not always automatically installed.

This issue occurred on Suse Linux Enterprise Server 12 SP4.

To check the existing installed Vim related packages:


zypper search -i vim

Only the vim binary is installed and provided by the package vim

What is needed is Vim runtime files.


zypper search vim

vim-data is the package that provides Vim runtime files, including Vim documentation.

To install it:


zypper install vim-data

The documentation is now available in Vim:


:h help.txt

[WARNING] This document format requires a nonempty element

If you are using pandoc for converting markdown files to html files, you can come up with this warning message:

[WARNING] This document format requires a nonempty element

This message pop up while using gfm (GitHub Flavored Markdown) and the version of pandoc provided on Debian stable.(https://packages.debian.org/buster/pandoc, version 2.2.1)

As a solution, it is suggested to specify some metadata parameters as argument to pandoc command line tool.
Let’s give an example:

file1=$(basename -s .md $file)
file1=${file1/_/ }
pandoc -s -f gfm -t html+raw_html --metadata pagetitle:"${file1^}" -o ${file%md}"$suffix" $file

Despite such setting, the warning message still pop up.
The workaround has been to upgrade pandoc to a newer version (2.5). No need to provide the metadata details anymore to get rid of this warning.

How to begin thinking like a programmer

Some notes regarding this video presentation of Andy Harris:

Youtube video: How to begin thinking like a programmer

Slides for this presentation

Programming is about:

  • Programming isn’t about languages
  • The language ultimately doesn’t matter much
  • There’s not a lot of memorizing
  • Most programming isn’t about math
  • Programming languages are simpler than human ones
  • Programming is really about solving problems
  • It’s about explaining things to the idiot computer

Coding isn’t about language is about:

  • Most beginners think they don’t understand what code to write
  • The real problem is they don’t really understand the problem they’re trying to solve

Failure is WONDERFUL

  • Did you tell it what to do incorrectly ?
  • Or did you tell it to do the wrong thing?
  • Most beginners assume it’s an implementation problem
  • Usually it’s really an algorithm problem

How to not go crazy

  • The art of teaching is knowing what NOT to teach
  • Learn it and do it before you learn something else
  • This is NOT a spectator sport
  • Teaching yourself means you have an amateur teacher
  • You don’t have to know everything