Pip and custom prefixes… again! This time it’s Ubuntu’s fault

I wanted to install a Python library to a custom location. Thanks to a long fight with Python on that issue (I can’t believe I haven’t blogged about this!), I know that --prefix does the trick for pip. So I run pip and this happens:

> pip3 install --prefix tmp/ boto3
ERROR: Can not combine '--user' and '--prefix' 
as they imply different installation locations

Alternatively the error is:

distutils.errors.DistutilsOptionError: can't combine user
with prefix, exec_prefix/home, or install_(plat)base

It seems to be an option that Ubuntu adds by default. The magic solution comes from a GNU bug tracker thread:

> pip3 install -U pip

Basically, this installs pip into my user directory (you can find it now in .local/bin/pip). pip3 still fail afterwards with a version mismatch:

> pip3 install --prefix tmp/ boto3
Traceback (most recent call last):
  File "/usr/bin/pip3", line 9, in <module>
    from pip import main
ImportError: cannot import name 'main'

But now I can call my local pip (which is a pip3):

> pip install --prefix tmp/ boto3
Collecting boto3
...
Successfully installed boto3-1.9.206 botocore-1.12.206

To force a re-install, even if the library is already installed somewhere else, use the flag --ignore-installed.

Add shared Exchange calender to Evolution Mail

I just spent a lot of time searching, so I really need to make sure not to forget this. I want to see a colleague’s calendar. Everything is in Office 365, so I have no problem adding the calendar in the web interface. Naive me thought, this will cause Evolution Mail to show the calendar also. Nope.

I searched for a way to add a calendar in the calendar view of Evolution. With right click on the account or in some menu. Nope. I can add calendars for myself, but not get a colleague’s calendar. Of course. That would have been too easy!

So what does work? Thank you jldugger:

On the Mail view, right click your exchange account, select “Subscribe to folder of other EWS user.” Type in the name of the account you want, and choose “Calendar” from the dropdown.

For me “Free/Busy as Calendar” worked, “Calendar” did not.

Tree view in Nautilus on Ubuntu 18.04

Someone thought it a good idea to remove the settings dialogue in Nautilus. Whatever. Here is how to set “list view” as default and enable tree view:

gsettings set org.gnome.nautilus.preferences default-folder-viewer 'list-view'
gsettings set org.gnome.nautilus.list-view use-tree-view true

Microsoft Teams on Linux

I use Linux in a corporate environment where Microsoft Office 365 is the toolchain of choice. One of the first things I needed to do my job was Microsoft Teams. Here are two things that worked for me.

The first (obvious) idea is to use the web UI. Messaging works out of the box with Chromium or Google Chrome. Getting audio and video calls to work is not obvious anymore. Basically, you need to pretend that you are on a Windows machine. This can be done by setting the “User Agent” to “Edge – Windows” with in the developer tools – see Christian Hujer’s blog post on the topic. Unfortunately, this hack breaks the message history. And there seems to be no way to get screen sharing to work. So while this solution is very easy, it is not optimal.

The second thing I tried and which works fine for me, is the unofficial MS Teams client by Ismael Martinez. I have it running on Ubuntu 18.04. As far as I have seen, everything works. Thank you!

Anaconda destroys Plasma

I just started my computer. Plasma did not start. I only saw the message “Could not start D-bus. Can you call qdbus-qt5?”. No. I cannot call this! I don’t have a working desktop!

What I managed to do was start a session with a different desktop environment and then search the internet for a solution. Will the error message, you will quickly find that “Anaconda update breaks KDE if it’s added to PATH”. Yes! I installed Anaconda the last time I used this computer! So I removed the lines it had added to my .bashrc and everything worked again.

Note to self: Do not add Anaconda to your PATH. Do not let it edit your .bashrc (which it does when you use conda init). Stupid snake!

Find file names with invalid encoding on Linux

I have files copied from Windows computers in ancient times. The filenames contain special characters and they have been messed up somewhere along the way. For example I got a file named 9.5.2 Modelo de aceptaci??n (espa??ol).doc in the folder 9 Garant??a del Estado.

First, I want to find and list these files. Stackexchange tells us how to do that:

LC_ALL=C find . -name '*[! -~]*'

This will find all names that have non-ASCII letters, not only those that are broken. But in my case I have folders where ALL of the names are broken, so I don’t mind.

Second, I want to fix the names. I did it manually, but for future reference, if I ever were to do anything like that again, I might use one of the solutions proposed in this thread on serverfault.com.

How to get WiFi running on Suse Leap 42.3 (Broadcom driver)

After the update from Suse Leap 42.2 to Suse Leap 42.3, my Wifi stopped working. Which is kind of bad, because I need internet to figure out what is wrong…

This was the situation right after the update, when it was not working:

> lspci -nnk | grep -A 3 "Network"
04:00.0 Network controller [0280]: Broadcom Corporation BCM43142 802.11b/g/n [14e4:4365] (rev 01)
        Subsystem: Hewlett-Packard Company Device [103c:804a]
        Kernel driver in use: bcma-pci-bridge
        Kernel modules: bcma
> hwinfo --short
network:
  eth0                 Realtek RTL8101/2/6E PCI Express Fast/Gigabit Ethernet controller
                       Broadcom BCM43142 802.11b/g/n
network interface:
  eth0                 Ethernet network interface
  lo                   Loopback network interface
> iwconfig
lo        no wireless extensions.
eth0      no wireless extensions.
> lsmod | grep "wl"

No WiFi to be seen!

So now this is what I did:

  1. Remove the old driver:
    > rpm -e broadcom-wl broadcom-wl-kmp-default 
    
  2. Find out my exact kernel version (the last part is the part we need, i.e., “default”):
    > uname -r
    4.4.104-39-default
    
  3. Add the Packman repository to my repositories:
    > zypper addrepo http://packman.inode.at/suse/openSUSE_Leap_42.3/ packman
    
  4. Install the drivers, paying attention to my kernel type (…-“default”):
    > zypper install broadcom-wl-kmp-default broadcom-wl
    

    You can also download the rpm by hand and install it. In that case, you need to pay attention to the full kernel number. Meaning, for my kernel 4.4.104-39, I should install the driver from broadcom-wl-kmp-default-6.30.223.271_k4.4.49_19-3.6.x86_64.rpm where the numbers after the k match exactly. Using Packman does that for you.

    Another issue I had with manual installation was missing keys. At least my configuration forces a valid PGP key and aborts if no key is in the key list. And I didn’t have a key for the downloaded rpms. It is possible to tell rpm to install the packages without checking the key (option --nosignature), but that did not properly install the package (without error messages, of course). When installing with zypper it looks for the key itself and you don’t have to worry.

  5. I rebuilt the loaded modules list and then restarted, but I am not sure it is necessary:
    > mkinitrd
    

Finally, the outputs of the above commands are (for reference, the next time it breaks):

> lspci -nnk | grep -A 3 "Network"
04:00.0 Network controller [0280]: Broadcom Corporation BCM43142 802.11b/g/n [14e4:4365] (rev 01)
        Subsystem: Hewlett-Packard Company Device [103c:804a]
        Kernel driver in use: wl
        Kernel modules: bcma, wl
> hwinfo --short
network:
  eth0                 Realtek RTL8101/2/6E PCI Express Fast/Gigabit Ethernet controller
  wlan0                Broadcom BCM43142 802.11b/g/n

network interface:
  wlan0                WLAN network interface
  eth0                 Ethernet network interface
  lo                   Loopback network interface
> iwconfig
lo        no wireless extensions.
wlan0     IEEE 802.11abg  ESSID:"..."  
          Mode:Managed  Frequency:2.412 GHz  Access Point: ...   
          Bit Rate=65 Mb/s   Tx-Power=200 dBm   
          Retry short limit:7   RTS thr:off   Fragment thr:off
          Encryption key:off
          Power Management:off
          Link Quality=70/70  Signal level=-39 dBm  
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0
eth0      no wireless extensions.
> lsmod | grep "wl"
wl                   6451200  0 
cfg80211              610304  1 wl

And it only took all afternoon … sometimes I hate Linux 🙁