HOWTO: fix your wordpress install after a system update – main page shows only php code

Background: we had a very big disconnection and the local WP installation didn’t come back after all the other systems came back. I have access to the website (so the apache2 service is running) but the main site as well as the admin site show only php text code. I tried rebooting the computer (a virtual machine) without luck. A very simple solution this one has. As usual, the solution is in StackOverflow.

sudo apt install php7.0 libapache2-mod-php7.0 
php7.0-mysql php7.0-curl php7.0-json

I restart then my apache2 and my website comes back. Fiu! Have a nice weeked, or see you tomorrow for the Mars discussion post…

Advertisement

HOWTO: add Java and CSS to your python dash application

This is a pretty sad first post for February. A lot of things have been going on, so many that I’ve not been able to approach to a computer in a relaxed way. Anyway, here’s my tip of the day. To apply CSS styles and use java on your dash applications, place the files in a specific folder called assets. They will be found and used. Hopefully!

---app.py
---assets/style.css
---assets/picture.gif
---data/data.csv

For Flask you have a link here. That’s all for the moment.

A jupyter notebook in a docker: Jupyter Docker Stacks

Again I’m with python. I want to run as package independent as possible, so I want to run the external python apps in a docker. If we have a jupyter notebook, we can easily run it this way if we have it in a “test” folder. Note that the “test” folde needs to be readable for everyone (777) or you’ll get this error :

tornado.web.HTTPError: HTTP 403: Forbidden

Anyway, this is what I get when I run my docker mapping the test folder:

# > docker run -p 8888:8888 -v "${PWD}"/test:/home/jovyan/work 
jupyter/scipy-notebook
Entered start.sh with args: jupyter lab
Executing the command: jupyter lab
[I DATE ServerApp] jupyter_server_terminals
| extension was successfully linked.
[I DATE ServerApp] jupyterlab
| extension was successfully linked.
[W DATE NotebookApp] 'ip' has moved from NotebookApp
to ServerApp. This config will be passed to ServerApp.
Be sure to update your config before our next release.
[W DATE NotebookApp] 'ip' has moved from NotebookApp
to ServerApp. This config will be passed to ServerApp.
Be sure to update your config before our next release.
[I DATE ServerApp] nbclassic
| extension was successfully linked.
[I DATe ServerApp] Writing Jupyter server cookie secret
to /home/jovyan/.local/share/jupyter/runtime/jupyter_cookie_secret
[I DATE ServerApp] notebook_shim
| extension was successfully linked.
[I DATE ServerApp] notebook_shim
| extension was successfully loaded.
[I DATE ServerApp] jupyter_server_terminals
| extension was successfully loaded.
[I DATE LabApp] JupyterLab extension loaded from
/opt/conda/lib/python3.10/site-packages/jupyterlab
[I DATE LabApp] JupyterLab application directory
is /opt/conda/share/jupyter/lab
[I DATE ServerApp] jupyterlab
| extension was successfully loaded.
[I DATE ServerApp] nbclassic
| extension was successfully loaded.
[I DATE ServerApp] Serving notebooks
from local directory: /home/jovyan
[I DATE ServerApp] Jupyter Server 2.1.0 is running at:
[I DATE ServerApp] http://XXX:8888/lab?token=XXX
[I DATE ServerApp] or http://127.0.0.1:8888/lab?token=XXX
[I DATE ServerApp] Use Control-C to stop this server
and shut down all kernels (twice to skip confirmation).
[C DATE ServerApp]

To access the server, open this file in a browser:
file:///home/jovyan/.local/share/jupyter/runtime/jpserver-7-open.html
Or copy and paste one of these URLs:
http://XXX:8888/lab?token=XXX
or http://127.0.0.1:8888/lab?token=XXX

The Jupyter Docker stack documentation is available here. Happy docking!

perl: warning: Setting locale failed on Debian GNU/Linux 11 (bullseye)

I love these titles. They look like coming from a disaster movie or something. I’ve encountered this one while trying some of our software on a Debian 11 docker. The full error looks like this:

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = "en_US:en",
LC_ALL = "en_US.UTF-8",
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").

The solution is pretty easy. It’s described in this post. I choose apt-get install iperf. I log out and log in again and the error is gone. Yeah, this was more like the tip of the day, but …let’s go!

A python dash web multiplot example reading CSV data

I previously used plotty to get a python plot on a website. It’s time to elaborate. Now we want to have two plots with data from a CSV file. It’s not as complicated as it sounds. Allow me to show and explain.

import dash
from dash import dcc, html
from dash.dependencies import Input, Output
import plotly.express as px
from plotly.subplots import make_subplots
import plotly.graph_objects as go
import pandas as pd

app = dash.Dash(__name__)

df = pd.read_csv('data3colums.csv')
##columns are named here and you need to use these names
df.columns=['Time','data','Size(T)']
fig = px.line(df, x="Time",y="data",markers=True)
fig2 = px.line(df, x="Time",y="Size(T)",markers=True)
app.layout = html.Div(children=[
# All elements from the top of the page
html.Div([
html.H1(children='Time series one'),
html.Div(children='''Title one'''),
dcc.Graph(id='graph1',figure=fig),
]),
# New Div for the new 'row' of the page
html.Div([
html.H1(children='Time Series two'),
html.Div(children='''Title two'''),
dcc.Graph(id='graph2',figure=fig2),
]),
])
if __name__ == '__main__':
app.run_server(debug=True,host='IP-OF-MY-MACHINE')

If you want to know more about how to plot data from CSV here you have the plotly documetation. It can be useful also to know about plotting time series, since at least in my CSV I have time tags. And here you have the stackoverflow post about this topic. Because we can’t forget about stackoverflow.

EDIT: this post has been backdated to “yesterday” because I forgot to publish it, so another post may come later. Hopefully…this will mean I had time for my things ๐Ÿ˜‰

Error: cannot find -lmkl_intel_lp64 while compiling on Ubuntu 20.04

Ubuntu 20 is escalating positions as the heir of CentOS 7, and I started experiencing compatibility issues. I was compiling relion with the next options

cmake -DAMDFFTW=ON -DCUDA_ARCH=86 -DCUDA=ON -DCudaTexture=ON 
-DFORCE_OWN_FLTK=ON -DCMAKE_CXX_COMPILER=g++ -DCMAKE_C_COMPILER=gcc
-DMPI_C_COMPILER=/usr/bin/mpicc
-DMPI_C_LIBRARIES=/usr/lib/x86_64-linux-gnu/openmpi/lib/
-DMPI_C_INCLUDE_PATH=/usr/lib/x86_64-linux-gnu/openmpi/include/
-DCUDA_ARCH=61 -DCUDA=ON -DCudaTexture=ON -DMKLFFT=ON
-DFORCE_OWN_FLTK=ON -DGUI=ON
-DCMAKE_INSTALL_PREFIX=/XXX/relion_local/
-D CMAKE_BUILD_TYPE=Release ..

when I found this error

[ 59%] Linking CXX executable ../../bin/relion_tomo_tomo_ctf
/usr/bin/ld: cannot find -lmkl_intel_lp64
/usr/bin/ld: cannot find -lmkl_sequential
/usr/bin/ld: cannot find -lmkl_core
collect2: error: ld returned 1 exit status
make[2]: *** [src/apps/CMakeFiles/tomo_ctf.dir/build.make:102:
bin/relion_tomo_tomo_ctf] Error 1
make[1]: *** [CMakeFiles/Makefile2:352:
src/apps/CMakeFiles/tomo_ctf.dir/all] Error 2
make: *** [Makefile:130: all] Error 2

I’m using the default package install locations, no modules or anything fancy. So it looks like some libraries are missing. Of course I try to find them with ldconfig -p | grep ‘mkl’ but they are obviously not there. Let’s install them:

# apt-get install libmkl*intel* libmkl*se* libmkl*core*
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'libmkl-intel-thread' for glob 'libmkl*intel*'
Note, selecting 'libmkl-blacs-intelmpi-ilp64' for glob 'libmkl*intel*'
Note, selecting 'libmkl-intel-ilp64' for glob 'libmkl*intel*'
Note, selecting 'libmkl-blacs-intelmpi-lp64'
for glob 'libmkl*intel*'
Note, selecting 'libmkl-intel-lp64' for glob 'libmkl*intel*'
Note, selecting 'libmkl-sequential' for glob 'libmkl*se*'
Note, selecting 'libmkl-core' for glob 'libmkl*core*'
Note, selecting 'libmkl-cdft-core' for glob 'libmkl*core*'
The following additional packages will be installed:
libmkl-def libmkl-locale libmkl-vml-def
The following NEW packages will be installed:
libmkl-blacs-intelmpi-ilp64 libmkl-blacs-intelmpi-lp64
libmkl-cdft-core libmkl-core libmkl-def
libmkl-intel-ilp64 libmkl-intel-lp64
libmkl-intel-thread libmkl-locale
libmkl-sequential libmkl-vml-def

0 upgraded, 11 newly installed, 0 to remove and 19 not upgraded.
Need to get 38,4 MB of archives.
After this operation, 204 MB of additional disk space will be used.
Do you want to continue? [Y/n] y

You may need to run apt-get install mklibs in addition. Of course it depends on what you have been doing with your system so far, since this will call some python libraries also. After getting those packages, make and make install run without errors. Time to ask the user to test it…

Python Import Error: can’t import name gcd from fractions

Deprecation is a big issue in python. I’m in need of Molecular Dynamic (MD) simulations tools. The error above comes from one tool I already posted about, called LipIDens, more specifically, it’s a complain thrown away by vermouth. Vermouth (for VERsatile, MOdular, and Universal Tranformation Helper) isย also a drink and the python library that powers Martinize2. The vermouth source comes here. It is supposed to be used to apply transformation on molecular structures. Which means I don’t really know what it does! Anyway, my error reads

Installed 
/usr/local/lib/python3.9/site-packages/lipidens-1.0.0-py3.9.egg
Processing dependencies for lipidens==1.0.0
error: networkx 3.0 is installed but
networkx~=2.0 is required by {'vermouth'}

What to do here? I found the solution and the explanation once more on StackOverflow. It’s very interesting to know that the the grammar for a mathematical library changed after Python 3.5. So then, why on the LipIDens documentation it is recommended to use a python above 3.9? I’m going to leave the answer to this question open (old developer environments with remnants or insufficient tests) and show you my solution. We install a specific python package. I choose pip to install it instead of conda because it goes to my python site-packages, which I personally consider a more elegant solution. Here you have my output:

bash-5.1# pip install networkx==2.5
Collecting networkx==2.5
Downloading networkx-2.5-py3-none-any.whl (1.6 MB)
|XXXXXXX| 1.6 MB 4.3 MB/s
Requirement already satisfied: decorator>=4.3.0 in /usr/local/lib/python3.9/site-packages (from networkx==2.5) (5.1.1)
Installing collected packages: networkx
Attempting uninstall: networkx
Found existing installation: networkx 2.0
Uninstalling networkx-2.0:
Successfully uninstalled networkx-2.0
Successfully installed networkx-2.5
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
bash-5.1# python setup.py install

After the pip install over my local python I run again the LipIDens installer and it works. Another issue is to get meaningful results from the program! BTW, I decided to keep writing my bits thanks to some good feedback that I was missing before… thank you guys. I appreciate it.

ERROR : /usr/share/Modules/init/sh: No such file or directory on Ubuntu 22.04

We started the migration to a new Linux flavour – in principle Ubuntu– and therefore we started also to experience the first issues. We have a very established software module method, with the module definitions being loaded from a network location. We can install software modules, but after every folder needed and every other adjustment is made we see this:

$ > ssh user@new-server
Last login: DATE from other-server.org
-bash: /usr/share/Modules/init/sh: No such file or directory

I have a machine “other-server” to check how the modules are working. And I find that the folder “Modules” is missing in Ubuntu. The content of the folder modules in the same location seems to be the same, so I do

root@new-server:/usr/share# ln -s /usr/share/modules Modules

And try logging again. With this result:

$ > ssh user@new-server
user@new-server's password:
Last login: DATE from other-server.org
user@new-server ~ $ > module avail
/PATH/modulecmd:
error while loading shared libraries:
libtcl8.5.so: cannot open shared object file:
No such file or directory

So there’s now a library problem. Let’s try to fix it very quickly. I localize a similar library

root@new-server:~# ls /usr/lib/*/*libtcl*
/usr/lib/x86_64-linux-gnu/libtcl8.6.so
/usr/lib/x86_64-linux-gnu/libtcl8.6.so.0
/usr/lib/x86_64-linux-gnu/libtclenvmodules.so
root@new-server:~#
cp /usr/lib/x86_64-linux-gnu/libtcl8.6.so /usr/lib/libtcl8.5.so
root@new-server:~# ldconfig

And the error is gone. We can do this because the libraries are not so different…. I have no idea of the side effects. Let’s hope there are not so many ๐Ÿ˜‰!

Windows 10 change other user’s password from the admin account

I’m going to be brief because I don’t want to expand what is written on this wintips post. Basically we don’t use MS accounts (do you?) so I managed to change the passwords in a very quick and problemless way using the Method 3. Reset Windows Password from Control Panel of the already mentioned post. But I wanted to record this. I’m getting busy lately and I don’t have as much time as I would like to log my “achievements” here. So that’s it, have a nice day….

WordPress multisite: more than one WP site in one server

I don’t have so much mood to write lately. I guess I’ve been busy thinking or something like that. Anyway, here I am again. (B)logging the last thing I did, that is to transform a single WP install onto a multisite install.I will be following this guide to arrive to the desired multisite configuration.

I start with an installed version (so no docker) on CentOS 7. I deactivate the plugins, then edit /var/www/html/wp-config.php as indicated.

Add this code before the /* That's all, stop editing! Happy blogging. */ line:

/* Multisite */
define('WP_ALLOW_MULTISITE', true);

I save the edits on the wp-config.php, and restart httpd service. Unfortunately I don’t get the Network Setup Menu as in the guide (maybe you get it) but I don’t worry about it and continue. After that I will regret, and I will need to edit various other files to achieve what I want. Here you have the details about the file modifications needed. But basicallyt I have installed phpMyAdmin also. For that I have installed and configured mod_rewrite for apache and fixed a package error problem with php 7.4 install on CentOS 7.9. In brief

yum-config-manager --disable 'remi-php*'
yum-config-manager --enable remi-php74

And of course, I have given permission to access phpmyadmin on this server. But at the end, as usual I manage to get what I want. Or should I say you managed to get what you wanted? ๐Ÿง. Because what I want is to write about what I think, not about what I do. And I’m not in the mood ๐Ÿ˜”. See you around…