Installing Python Dependencies
Recenlty when using conda to create an environment, I used a script that was written about three months ago. At that time, I ran the code to install the python dependencies and it worked fine on my Kaggle notbook. But when I tried to run it again yesterday, it reported error after searching a specific package ( in this case it’s Cython version mismatch when installing a version of murmurhash).
I copied the code to run on my computer it still reported the error under my linux operation system. So it is obvious that some python packages may change dependencies relations, even when the packages are associated with certain earlier python version (python3.6 for example). Same scripts that successfully created and built an environment long time targeting a python version also long time ago may not always work in the long run. So the best practice may be creating an an environment and never recreating it after successfully installing the necessary dependencies. So Never transplanting or gliding the lily.
Anaconda proxy setting
This is what recently has been searched several times. For future reference, it could be noted here.
conda config --set proxy_servers.http http://localhost:XXXXX
conda ocnfig --set proxy_servers.https http://localhost:XXXXX
other basic conda commands
# creating new environment
conda create -n new_envrionment_name python=3.XX --yes
# list environments
conda env list
# delete an environment
conda remove -n environment_name --all
# activate an environment
conda activate new_envrionment_name
# or using path to create and activate new environments
conda create -p path/to/new/environment
conda activate path/to/new/environment
Running Jupyter Notebook by Docker
reference:
Prerequisites
- Having doocker or Docker Desktop installed according to your operating system.
Running
docker run --rm -p 8889:8888 quay.io/jupyter/base-notebook start-notebook.py --NotebookApp.token='my-token'
-p 8889:8888host port mapping to container portstart-notebook.py --NotebookApp.token='my-token'customizing your token.- The
start-notebook.pyscript configures the internal container and then runsjupyter labcommand (see here). - We can use the
crtl + ccommand to stop the terminal process.
Letting the container reading host folder, run:
Nginx Beginning Basics on Windows
Nginx beginner’s Guide on Windows
Configuration File
On Windows System, the configuration file is located in the conf folder of the unzipped application file. You can double click the exe file to run Nginx. Then it will show you message box to allow it to run on Windows. After confirmation it will run in the background as a service. We can use .\nginx.exe -s signal to control its behavior where signal can be stop, quit, reopen or reload.
Installing a Virtual Machine on Ubuntu 24.04
Check virtualization support
LC_ALL=C.UTF-8 lscpu | grep Virtualization
Load KVM (Kernel-based Virtual Machine)
lsmod | grep kvm # check if KVM is loaded
If not loaded, type:
sudo modprobe -a kvm kvm_intel
# or
sudo modprobe -a kvm kvm_amd # for AMD processor
Intall QEMU ( command line and graphical tool, e.g., Virtual Machine Manager )
sudo apt install qemu-system
Install QEMU/KVM virtual machines: Virtual Machine Manager
sudo apt install virt-manager
add user to libvirt group and start the sevice:
Create a Windows Bootable USB on Ubuntu
Using normal copy-paste method to write Windows ISO to a USB device on Ubuntu to boot on a windows machine is sometimes not applicable, as often on the installation start it will tell you it can’t detect any compatible devices or something. WoeUSB is one of the sollutions that can solve the above problem.
Install WoeUSB on Ubuntu:
# add repository
sudo add-apt-repository ppa:tomtomtom/woeusb
# maby need a sudo apt update to refresh package source
# install WoeUSB
sudo apt install woeusb woeusb-frontend-wxgtk
Write ISO mirror to USB device
After the installation now you can search ‘WoeUSB’ in the applications and run it. First it will show you a big message box that makes you panic but actually telling you don’t panic. After your confirmation, you will meet its user interface. Finally,you umount the USB device in the Gparted application before burning the ISO into it.
Using Cron to Schedule a Linux Machine
Cron: linux basic settings
Cron is a time-based job scheduler. You can set some commands to be done at a certain time or by a certain interval by installing and configuring it on a linux machine.
Syntax
The stars * (asterisks) and commands on the header row is the format of each cron task that you will create. It consists mainly of six parts, with the first five parts determine the job timing (reference here).
How to Create a New Hugo Post
- Creating: using hugo new
After a hugo blog is set up on a local computer, to create and publish a new blog, you need to use the hugo new command. It generates a new markdown file starting with its creation date, draft status and title. To run this command, first go to the site directory that contains all of the blog files within, e.g., one of them is the content folder that we access below.
R Scale Function
The scale function functions as Scaling and centering of matrix-like objects according to the help document. When using it with pipe grouping to scale some group of data, the aggragated column names are not what that has been set in the mutate arguments, but with extra brackets or commas like scale_num[:,].
There is a post about customizing a scale function to use, after that the names of the new named column are not with extra brackets or commas anymore.