How to fix R package installation fatal error: lzma.h: No such file or directory

Problem:

While installing some R package, you see an error message like

cram/cram_io.c:61:10: fatal error: lzma.h: No such file or directory
   61 | #include 
      |          ^~~~~~~~
compilation terminated.

Solution:

You need to install the liblzma development headers. On Ubuntu, you can do that using

sudo apt -y install liblzma-dev

 

Posted by Uli Köhler in R

How to fix R package installation fatal error: bzlib.h: No such file or directory

Problem:

While installing some R package, you see an error message like

cram/cram_io.c:57:10: fatal error: bzlib.h: No such file or directory
   57 | #include 
      |          ^~~~~~~~~
compilation terminated.

Solution:

You need to install the libbz2 development headers. On Ubuntu, you can do that using

sudo apt -y install libbz2-dev

 

Posted by Uli Köhler in R

How to fix Jupyter Lab ImportError: cannot import name ‘soft_unicode’ from ‘markupsafe’

Problem:

When running

jupyter lab

you see the following error message:

Traceback (most recent call last):
  File "/usr/local/bin/jupyter-lab", line 5, in <module>
    from jupyterlab.labapp import main
  File "/usr/local/lib/python3.8/dist-packages/jupyterlab/labapp.py", line 13, in <module>
    from jupyter_server.serverapp import flags
  File "/usr/local/lib/python3.8/dist-packages/jupyter_server/serverapp.py", line 39, in <module>
    from jinja2 import Environment, FileSystemLoader
  File "/usr/lib/python3/dist-packages/jinja2/__init__.py", line 33, in <module>
    from jinja2.environment import Environment, Template
  File "/usr/lib/python3/dist-packages/jinja2/environment.py", line 15, in <module>
    from jinja2 import nodes
  File "/usr/lib/python3/dist-packages/jinja2/nodes.py", line 23, in <module>
    from jinja2.utils import Markup
  File "/usr/lib/python3/dist-packages/jinja2/utils.py", line 656, in <module>
    from markupsafe import Markup, escape, soft_unicode
ImportError: cannot import name 'soft_unicode' from 'markupsafe' (/usr/local/lib/python3.8/dist-packages/markupsafe/__init__.py)

Solution:

You need to install an older version of markupsafe using

sudo pip3 install markupsafe==2.0.1

until other packages have been updated.

Posted by Uli Köhler in Python

How to fix R package installation /bin/bash: gfortran: command not found

Problem:

While installing some R package, you see an error message like

/bin/bash: gfortran: command not found

Solution:

You need to install the gfortran compiler. On Ubuntu, you can do that using

sudo apt -y install gfortran

 

Posted by Uli Köhler in R

How to fix R package installation /usr/bin/ld: cannot find -lblas

Problem:

While installing some R package, you see an error message like

/usr/bin/ld: cannot find -lblas

Solution:

You need to install the libblas development headers. On Ubuntu, you can do that using

sudo apt -y install libblas-dev

 

Posted by Uli Köhler in R

How to fix R package installation /usr/bin/ld: cannot find -llapack

Problem:

While installing some R package, you see an error message like

/usr/bin/ld: cannot find -llapack

Solution:

You need to install the liblapack development headers. On Ubuntu, you can do that using

sudo apt -y install liblapack-dev

 

Posted by Uli Köhler in R

How to fix R package installation fatal error: png.h: No such file or directory

Problem:

While installing some R package, you see an error message like

/bin/bash: libpng-config: command not found
read.c:3:10: fatal error: png.h: No such file or directory
    3 | #include 
      |          ^~~~~~~
compilation terminated.
make: *** [/usr/lib/R/etc/Makeconf:168: read.o] Error 1

Solution:

You need to install the libpng development headers. On Ubuntu, you can do that using

sudo apt -y install libpng-dev

 

Posted by Uli Köhler in R

How to fix R package installation fatal error: zlib.h: No such file or directory

Problem:

While installing some R package, you see an error message like

io_utils.c:16:10: fatal error: zlib.h: No such file or directory
   16 | #include <zlib.h>
      |          ^~~~~~~~
compilation terminated.
make: *** [/usr/lib/R/etc/Makeconf:168: io_utils.o] Error 1

Solution:

You need to install the zlib development headers. On Ubuntu, you can do that using

sudo apt -y install zlib1g-dev

 

Posted by Uli Köhler in R

How to fix R openssl error fatal error: openssl/opensslv.h: File or directory not found

Problem:

When installing the R openssl package using

BiocManager::install("openssl")

or any package depending on the openssl package, you see an error message like

-------------------------- [ERROR MESSAGE] ---------------------------
tools/version.c:1:10: fatal error: openssl/opensslv.h: File or directory not found
    1 | #include <openssl/opensslv.h>
      |          ^~~~~~~~~~~~~~~~~~~~
compilation terminated.
--------------------------------------------------------------------
ERROR: configuration failed for package ‘openssl’
* removing ‘/home/uli/R/x86_64-pc-linux-gnu-library/4.0/openssl’

Solution:

You need to install OpenSSL. On Ubuntu, install it using

sudo apt -y install libssl-dev

For other systems, see the description just above the error message by the authors of the package:

--------------------------- [ANTICONF] --------------------------------
Configuration failed because openssl was not found. Try installing:
 * deb: libssl-dev (Debian, Ubuntu, etc)
 * rpm: openssl-devel (Fedora, CentOS, RHEL)
 * csw: libssl_dev (Solaris)
 * brew: [email protected] (Mac OSX)
If openssl is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a openssl.pc file. If pkg-config
is unavailable you can set INCLUDE_DIR and LIB_DIR manually via:
R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'
Posted by Uli Köhler in R

Recommended procedure for profiling python scripts

Assuming we want to profile myscript.py, run:

python3 -m cProfile -o myscript.profile myscript.py

In order to view it, I strongly recommend runsnakerun:

runsnake myscript.profile

You can install runsnake on Ubuntu using

sudo apt -y install runsnakerun

 

Posted by Uli Köhler in Python

How to fix RCurl installation error xml2-config: Command not found

Problem:

While trying to install RCurl using

BiocManager::install("RCurl")

you see the following error message:

> BiocManager::install("RCurl")
/bin/bash: Zeile 1: xml2-config: Befehl nicht gefunden
/bin/bash: Zeile 1: xml2-config: Befehl nicht gefunden

Solution:

You need to install the libxml2 development headers which include the xml2-config executable.

On Ubuntu, you can install it using

sudo apt -y install libxml2-dev

 

Posted by Uli Köhler in R

How to fix RCurl installation error Cannot find curl-config

Problem:

While trying to install RCurl using

BiocManager::install("RCurl")

you see the following error message:

> BiocManager::install("RCurl")
'getOption("repos")' replaces Bioconductor standard repositories, see
'?repositories' for details

replacement repositories:
    CRAN: https://cloud.r-project.org

Bioconductor version 3.12 (BiocManager 1.30.16), R 4.0.4 (2021-02-15)
Installing package(s) 'RCurl'
versuche URL 'https://cloud.r-project.org/src/contrib/RCurl_1.98-1.6.tar.gz'
Content type 'application/x-gzip' length 731035 bytes (713 KB)
==================================================
downloaded 713 KB

* installing *source* package ‘RCurl’ ...
** Paket ‘RCurl’ erfolgreich entpackt und MD5 Summen überprüft
** using staged installation
checking for curl-config... no
Cannot find curl-config
ERROR: configuration failed for package ‘RCurl’
* removing ‘/usr/local/lib/R/site-library/RCurl’

The downloaded source packages are in
        ‘/tmp/RtmpVRZFXa/downloaded_packages’
Warnmeldung:
In .inet_warning(msg) :
  installation of package ‘RCurl’ had non-zero exit status

Solution:

You need to install the libcurl development headers which include the curl-config executable.

On Ubuntu, you can install it using

sudo apt -y install libcurl4-openssl-dev

 

Posted by Uli Köhler in R

How to set DLS ContactMe request to OpenStage 40 phones using Python

This snippet sends a ContactMe DLS provisioning request to an OpenStage 40 phone at IP 192.168.178.245 using Python. The phone will then contact 192.168.178.10 on port 18443 using HTTPS. By default (i.e. if the OpenStage 40 is not in Secure Mode, the certificate is not verified – any certificate will do!)

import requests

response = requests.post("http://192.168.178.245:8085/contact_dls.html/ContactDLS", data={
    "ContactMe": True,
    "dls_ip_addr": "192.168.178.10",
    "dls_ip_port": 18443
})
# Response will be <Response [204]> i.e. no content

Note that dls_ip_addr may also be a hostname!

Posted by Uli Köhler in Networking, Python

Wireshark MikroTik remote packet capture mini-HOWTO

Start Wireshark, in capture settings window enter capture filter

udp port 37008

On MikroTik router, goto Tools / Packet Sniffer and enter the options according to your needs. Make sure Streaming enabled is checked!

A fresh install of Wireshark already has all required plugins enabled, so you can start capturing right away!

Posted by Uli Köhler in Networking

How to flash Marlin 2.x to BTT SKR 1.4 using PlatformIO

The best way to flash Marlin via PlatformIO onto the LPC1768 MCU on a BTT SKR v1.4 board is to insert an SD card into it, connect the computer via USB and use the mbed as upload_protocol.

In order to do this, edit ini/lpc176x.ini from within Visual Studio Code and add the following new code to [env:LPC1768]:

upload_protocol = mbed
upload_port=/media/uli/A87B-A154/

with upload_port being the directory where the SD card is mounted (while you can do this using an SD card reader, it is so much easier by just connecting the BTT SKR v1.4 via USB directly to your computer, allowing both serial port and SD card access at the same time).

Full example of the [env:LPC1768] section:

[env:LPC1768]
platform = ${common_LPC.platform}
extends  = common_LPC
board    = nxp_lpc1768
upload_protocol = mbed
upload_port=/media/uli/A87B-A154/

In the PlatformIO menu, choose LPC1768/Upload. There is no special configuration for the BTT SKR v1.4 but of course you need to configure Configuration.h etc correctly – see https://www.makenprint.uk/3d-printing/3d-printing-guides/skr-v1-4-configuration-h-marlin-2-setup-part-2/

After uploading, press the reset button on the Board to apply the firmware update. You can use picocom to connect to your printer, see How to connect to your 3D printer using picocom, e.g.:

picocom -b 115200 /dev/ttyACM0 --imap lfcrlf --ech

Enter M115 to check if you have correctly updated the fiwa

You might need to manually re-mount the SD card using your file manager after a firmware update in order to enabled PlaformIO doing another update.

Posted by Uli Köhler in 3D printing, Embedded, PlatformIO

What is the standard username / password for motionEye?

The standard username / password for the motioneye surveillance camera webinterface is username admin with an empty password.

Posted by Uli Köhler in Networking

How to put text into input element in Pyppeteer

In Pyppeteer, if you have an input like this one:

<input id="myInput">

you can fill with text like abc123 by using page.type() like in this snippet:

await page.type('#myInput', 'abc123')

Full example

This example fetches techoverflow.net and puts my search into the search query input on the top right:

#!/usr/bin/env python3
import asyncio
from pyppeteer import launch

async def main():
    browser = await launch()
    page = await browser.newPage()
    await page.goto('https://www.techoverflow.net')
    # Fill text with input
    await page.type('.search-form-input', 'my search')
    # Make screenshot
    await page.screenshot({'path': 'screenshot.png'})
    # Cleanup
    await browser.close()

asyncio.get_event_loop().run_until_complete(main())

 

Posted by Uli Köhler in Pyppeteer, Python

How to disable SSL certificate verification in Pyppeteer

If you see an error message like

pyppeteer.errors.PageError: net::ERR_CERT_AUTHORITY_INVALID at https://10.9.5.12/

in Pyppeteer and you are sure that you just want to skip certificate verification change

browser = await launch()

to

browser = await launch({"ignoreHTTPSErrors": True})

or add "ignoreHTTPSErrors": True to the list of parameters to launch if you already have other parameters there. This will just ignore the net::ERR_CERT_AUTHORITY_INVALID and other, related HTTPS errors.

Posted by Uli Köhler in Pyppeteer, Python

Pyppeteer minimal screenshot example

This script is a minimal example on how to use Pyppeteer to fetch a web page and save a screenshot to screenshot.png:

#!/usr/bin/env python3
import asyncio
from pyppeteer import launch

async def main():
    browser = await launch()
    page = await browser.newPage()
    await page.goto('https://www.techoverflow.net')
    # Make screenshot
    await page.screenshot({'path': 'screenshot.png'})
    # Cleanup
    await browser.close()

asyncio.get_event_loop().run_until_complete(main())

How to run:

sudo pip3 install pyppeteer
python3 PyppeteerScreenshotExample.py

 

Posted by Uli Köhler in Pyppeteer

What SSH username to use for OpenStage 40?

The SSH username is admin. A working command to connect to an OpenStage 40 using SSH is

ssh -oKexAlgorithms=+diffie-hellman-group1-sha1 [email protected]

 

Posted by Uli Köhler in Networking
This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Cookie settingsACCEPTPrivacy &amp; Cookies Policy