Skip to main content

Posts

Showing posts from 2020

What is a zombie process?

A zombie process is a sub-process that finished (normally or otherwise), but it's not yet reaped by its parent (i.e.: its parent didn't collect its exit code). It can't be killed (because it's already dead, hence "zombie"), but it won't consume resources (CPU and memory). However, it is still using a scheduler process id; it's theoretically possible to starve a system of pids (therefore, preventing it to create new processes) launching dummy subprocesses and not reaping them.

Solving ‘Could not resolve host: github.com’ issue

Recently I ran into this issue while trying to clone one of my own repository from GitHub C:\GitHub\FS> git clone https://github.com/<username>/FS.git Cloning into 'FS'... fatal: unable to access 'https://github.com/<username>/FS.git/': Could not resolve host: github.com At first I thought that this could be due to some proxy setting. So I tried to unset it by executing below command - C:\GitHub\FS> git config --global --unset https.proxy But that didn’t fix the problem and I was still getting the same error. As it turned out later, the culprit was my VPN connection. Turning off the VPN fixed the issue. For the records, I was using ‘Surfshark’ on my Windows 10 laptop.

Collect Python project dependencies

Sometimes we need to figure out dependencies of our Python project. I have been using the below two approaches to get it done: Using pipreqs If we want to collect all the dependencies and store them in a project-level 'requirement.txt' file, then pipreqs is an easy and simple solution. This library analyzes the import statements in the project to gather dependencies. First, we need to install pipreqs: pip install pipreqs In order to generate project-level requirement.txt file, run the below command: pipreqs /path/to/your/project/ requirements file would be saved as- ' /path/to/your/project/ requirements.txt ' To read about more advantages of pipreqs over pip freeze , read it from here Using pipdeptree     I have written a more detailed post about visual representation of python packages using 'pipdeptree' library in this blog . 'pipdeptree' provides more advanced options such as listing the dependencies in html format o

Troubleshooting "BackendDestroyException" in Docker

Setting up Docker in Windows environment is not an easy task. I have seen many people (including me) struggling to get it run on Windows PC. I have installed 'Docker for Desktop' in my laptop which has Windows 10 Pro 64-bit, Version 1909 (OS Build 18363.720). It was running fine with Windows containers. However, when I needed to switch to Linux container, it crashed with below error: Docker.Core.Backend. BackendDestroyException: Unable to stop Hyper-V VM: Service 'Hyper-V Host Compute Service (vmcompute)' cannot be started due to the following error: Cannot start service vmcompute on computer '.'. at Enable- MobyLinuxRequiredService, <No file>: line 103 at <ScriptBlock>, <No file>: line 804    at Docker.Core.Pipe. NamedPipeClient.<TrySendAsync> d__5.MoveNext() --- End of stack trace from previous location where exception was thrown ---    at System.Runtime. ExceptionServices. ExceptionDispatchInfo.Throw()    at Doc

Visualizing python project dependencies

When you install python packages using pip, it remembers the dependency tree of installed packages. Together with Graphviz, pipdeptree can generate a nice visualization of python project dependencies. What is even better is – It allows to save the output in a user friendly format such as jpeg, png or pdf. How to use it on Windows 10 PC Download Graphviz from this link                 http://www.graphviz.org/download/ Add below to PATH environment variable (Update the installed graphviz version if needed)         C:\Program Files (x86)\Graphviz2.38\bin      C:\Program Files (x86)\Graphviz2.38\bin\dot.exe Close any open command prompt, restart it and navigate to your python project folder. e.g.,               cd C:\Projects\GitHub\Installer_ Bootstrapper Install ‘pipdeptree’ and ‘graphviz’ python libraries        pip install pipdeptree    pip install graphviz Now you can start testing 'pipdeptree' View dependency tree of all installed packages