сряда, 28 февруари 2024 г.

From 0 to working scientific python with pypolychord

This is a brand new Lenovo laptop I got as a backup because my dear Asus got broken. So I got this smaller and weaker but still cute laptop. So I wanted to make this post just to list the quickest install from 0 to a working python file. 

Install python and jupyter

1. pacman -S python3

2. pacman -S jupyter-notebook

Install miniconda3 (instructions here)

3. mkdir -p ~/miniconda3

4. cd ~/miniconda3                                                                                                                                                                                                        
5. wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda3/miniconda.sh

6. bash ~/miniconda3/miniconda.sh -b -u -p ~/miniconda3

7. ~/miniconda3/bin/conda init bash
 

Then install the packages I need. I'm pretty sure I have an exported file from this environment with the packages but this is the absolute minimum of stuff. 

8.
conda create --name myenv
conda install -n myenv pip
conda install ipykernel
python3 -m ipykernel install --user --name=myenv
pacman -S gcc
pip install wheel
sudo pacman -S make
sudo pacman -S gcc-fortran

(optional conda install libgcc - no idea if this helped)

sudo pacman -S gcc-libs

pip install numpy
pip install git+https://github.com/PolyChord/PolyChordLite@master
conda install matplotlib
pip install getdist

I was getting a persistent error with libstdc++.so.6 (see here for other suggestions), here's what I did (after I installed gcc-libs and gcc-fortran)

sudo find / -name "libstdc++.so*"
conda install -c anaconda libstdcxx-ng
conda update libstdcxx-ng
ls ~/miniconda3/envs/myenv/bin/../lib
cp /usr/lib/libstdc++.so.6.0.32 ~/miniconda3/envs/myenv/bin/../lib 

And then manually removing libstdc++.so.6.0.21 and libstdc++.so.6.0.29

The problem with mpi4py:

I was getting a kernel crash from inside polychord, that I know it's related to mpi4py. So I had to install it. When trying to pip install it, I woul get this error:

"The Open MPI wrapper compiler was unable to find the specified compiler
     x86_64-conda_cos6-linux-gnu-cc in your PATH.
      
     Note that this compiler was either specified at configure time or in
     one of several possible environment variables.
     --------------------------------------------------------------------------
     failure.
     removing: _configtest.c _configtest.o
     error: Cannot compile MPI programs. Check your configuration!!!"

Solving it took a long time and 3 gpts!
 >sudo pacman -S openmpi

>yay -S mpicc
 >yay -S mpich

>echo $PATH
>conda list #look for openmpi - I had it, but obviously not working well enough

x86_64-conda_cos6-linux-gnu-cc

which gcc
/usr/bin/gcc

which mpicc
~/miniconda3/envs/BAO/bin/mpicc
export MPICC=~/miniconda3/envs/BAO/bin/mpicc

>pip install mpi4py #longer output but still and error

The Open MPI wrapper compiler was unable to find the specified compiler
      x86_64-conda_cos6-linux-gnu-cc in your PATH.
      
      Note that this compiler was either specified at configure time or in
      one of several possible environment variables.
      --------------------------------------------------------------------------
      failure.
      removing: _configtest.c _configtest.o
      error: Cannot compile MPI programs. Check your configuration!!!

>which x86_64-conda_cos6-linux-gnu-cc
/i didn't have it anywhere/
>conda install x86_64-conda_cos6-linux-gnu-cc
ls ~/miniconda3/envs/BAO/bin #look for x86_64-conda_cos6-linux-gnu-cc - I have x86_64-conda-linux-gnu-cc
>export PATH=~/miniconda3/envs/BAO/bin:$PATH
>pip install mpi4py #nope, same error as above
>conda install -c conda-forge openmpi
>conda install -c conda-forge openmpi --force-reinstall
>pip install mpi4py #yay!!! 

It finally worked. As you can imagine, a lot of steps, it took a while to figure it out. But now polychord is working and all is fine. 


понеделник, 19 февруари 2024 г.

Install Maple on a new Manjaro computer

 1. Install ld-lsb (the name of Linux Standard Base package in Manjaro)

2. Download Maple Network Tools from here

3. chmod +X NetworkToolsLinuxX64Installer.run and then run it to install the Network Tools

3. Install Maple and Activate. 

Without the Network Tools, Maple won't activate and will give you FLEXnet error with the license. Apart from that, everything installed flawlessly. No machine name complaints.

понеделник, 4 декември 2023 г.

Debug kde panic related to appimagelauncherd

I had several kernel panics or kde panics, hard to tell. My first suspicion was that I had a problem with my SSD, so I wanted to run smartctl to check it out:

>sudo smartctl -t short /dev/nvme0 

To see the results:  

>sudo  smartctl -l selftest /dev/nvme0

To see full summary of disk usage:

>sudo  smartctl -x /dev/nvme0

Then I had to check out the logs from journalctl for the X and the kernel.  

>journalctl -xb 

>journalctl -xe

(with -k you can see kernel drama from the previous boot (see manual)

>journalctl -kb

Then I checked dmesg 

>dmesg|grep error

Also the state of the sensors (they were ok) 

>sensors

The systemctl log for failed processes:

>systemctl --user --failed

And finally, by suggestion of a forum, the core dumps.

>coredumpctl list

I saw a problem with the following service (appimagelauncherd) that was spamming my core dumps with tons of errors and at some point it seemed that the space for dumps ended and the computer crashed. Basically I got 1000 variations of the following error all over the logs:


"
traps: appimagelaunche[1232] general protection fault ip:7f2d012ca394 sp:7ffc8910b128 error:0 in libstdc++.so.6.0.32[7f2d0129c000+137000]"

I tried to stop it the right way as above, but it gave me errors. 

>systemctl --user status appimagelauncherd.service
>systemctl --user disable --now appimagelauncherd.service
>systemctl --user status appimagelauncherd.service

In the end, I got annoyed and I removed it in the most brutal way:

cd /usr/lib/systemd/user/

sudo mv appimagelauncherd.service ~/scripts
cd ~/.config/systemd/user/default.target.wants/
sudo mv appimagelauncherd.service ~/scripts

Note, this thing has also settings: AppImageLauncherSettings (where you can click that it stops relaunching after you kill it, but I didn't do it at the time), so maybe that could have stopped it without manually removing the service but I discovered it afterwards. Right now the computer has been working for 5 days and it works ok. I don't know if this solved my problem, but for now at least it doesn't crash every 5 minutes.

P.S. Another error I saw in dmesg and tried to fx is about the bt_coex_acitve, so I did the following (but I'm not srue the driver for the wifi accepted it (link)):

sudo modprobe -r iwlmvm
sudo modprobe iwlmvm bt_coex_active=N

Another error I was getting was:

"kwin_core: XCB error: 152 (BadDamage), sequence: 10052, resource id: 16910493, major code: 143 (DAMAGE), minor code: 3 (Subtract)"

which according to Manjaro forum can be removed with editing "~/.bash_profile" to include:

# suppress QT logging
QT_LOGGING_RULES='*=false'
export QT_LOGGING_RULES

Finaly, I was getting an error from Akonadi

akonadiserver[1706]: org.kde.pim.akonadiserver: arguments: ("--defaults-file=~/.local/share/akonadi/mysql.conf", "- -datadir=~/.local/share/akonadi/db_data/", "--socket=/run/user/1000/akonadi/mysql.socket", "--pid-file=/run/user/ 1000/akonadi/mysql.pid")

and I did as advised in Manjaro forum:

mv ~/.local/share/akonadi/db_data/ibdata1 ~/.local/share/akonadi/db_data/ibdata1.old
akonadictl start
It took a while to restart akonadictl but it finished. 

Also to limit the space that journalctl takes:

journalctl --vacuum-time=2weeks