Unix tips and common solutions.
Unix tips.
My encountered problems and solutions
This part of blog is dedicated to problems that I run into regularly but not often enough to remember the solutions.
- Markdown cheatsheet to make this nice style.
OS, bash, and installation problems and solutions
-
Cannot uninstall ‘
'. It is a distutils installed project and thus we cannot accurately determine which files belong to it and which would lead to only a partial uninstall. This problem occurred while updating [DVC](https://pypi.org/project/dvc/). The fast and easy solution without burden of downgrading pip, resolving it, and upgrading pip back was found on [stackoverflow](https://stackoverflow.com/questions/53807511/pip-cannot-uninstall-package-it-is-a-distutils-installed-project) `pip install --ignore-installed` -
screen -S your_name
and renaming already existing screen from stackoverflow
2.1. In case screen is bugged and appears as attached
but you have no open terminal with this screen
screen -r yourName
There is a screen on:
8600.yourName (02/28/2021 01:33:59 PM) (Attached)
There is no screen to be resumed matching yourName.
Then you can reconnect with screen -D -r yourName
Anaconda
- Never use conda base env for
conda update -n base conda
- it can ruin all conda installation, especially when there are more than one python version installed. (for example python3.7 and python3.8)
Jupyter
- Can’t select kernel in notebook or jupyter lab.
- Install in
(base)
conda envpip install --user ipykernel
and add your virtual environment to Jupyter by typing:python -m ipykernel install --user --name=myCondaEnv
PIP
- How to solve ReadTimeoutError: HTTPSConnectionPool(host=’pypi.python.org’, port=443) with pip?
- stop proxy or active VPN for installation time. In my case I stopped Hamachi LogMeIn client and reconnected to Wi-Fi.
Docker
-
Run nvidia-based docker mapping it to all available GPUs on the machine
docker run -it --rm -v /data:/data --gpus all --shm-size=64g my/docker_name:version1
. Where-v
is mapping,--rm
performs clean up when the task is done. -
Connect running container
docker exec -it e14e37231d7c /bin/bash
. To detach usectrl+P+Q
Bash
- Disk space management.
df -h
anddu -h --max-depth=1
- Find and remove
find /dir/to/search/ -type f -name "FILE-TO-FIND-Regex" -exec rm -f {} \;
, for examplefind . -type f -name "events.out.tfevents.*" -exec rm -f {} \;