what is the meaning of pip install -v? - pip

Recently, I seen a command of pip install -v
actually it is
$ git clone https://github.com/NVIDIA/apex
$ cd apex
$ pip install -v --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" ./
I usually command pip install something
But what is pip install -v?

-v or we can can also use --verbose. Both are same.
-v is used when you want to use or expressed something in more words than are needed.
-v Give more output. Option is additive, and can be used up to 3 times.

Related

grep output to pip install

How to take a subset of python dependencies in requirements.txt and using grep send them to pip install?
Let's say I want to install redis and gunicorn only: with
cat requirements.txt | grep "redis\|gunicorn"
I get only the dependencies I want,
redis>=3.5.3
gunicorn>=20.1.0
but I would like to pass it as requirement file to pip install.
I guess I should create a temp file with the output of grep and do something like pip install -r tempfile, but I don't understand how to do it.
Could anyone help me?
You can use xargs to pass the outputs to pip:
grep "redis\|gunicorn" requirements.txt | xargs pip install

Install homebrew using Makefile

I'm trying to install Homebrew using a Makefile, the contents of the Makefile is this:
.PHONY: install
install:
# Install homebrew
/usr/bin/ruby -e $(shell curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)
However this just prints the entire contents of the script, but it does not execute anything. I got as far as googling for this issue and seeing that the characters $, (, ) have a special meaning in a Makefile, however I could not find any solution.
try just piping output from curl to ruby like this:
.PHONY: install
install:
# Install homebrew
curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install | ruby
If you encounter the following warning:
Warning: The Ruby Homebrew install is now deprecated and has been rewritten in Bash.
Please migrate to the following command:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
You can modify #igagis answer as such
.PHONY:install
install:
curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh | bash
I was running into needing sudo, then sudo telling me not to run as root so the command i used was:
sudo true
curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh | sudo -u $$USER bash
Notes:
I use sudo true to run sudo and do nothing. that way the user can input their password. running sudo make from the terminal caused the $USER to be root. if you remove the sudo true line, then if sudo has not been run yet, the sudo access check will fail and not let you insert a password when running the curl line
the two $ makes the makefile write a literal $

How can I use systemtap(stap) in the centos container in docker for mac

When I use stap, it tell me this error as the image,how can i fix it.
Really don't know why this question has been downvotted once. When i get concern, downvotter are one of the reason i always hesitate to ask thing on stackoverflow...
So, got the same concern with a container under ubuntu and it is how i fix it : try to launch an ubuntu bash on docker (not centos but the step should be similar)
docker run -it --cap-add sys_admin ubuntu bash
Then install some library and systemtap
apt-get update
apt-get --yes install build-essential cmake bc curl diffutils git kmod libcurl4-openssl-dev wget
apt-get --yes install systemtap systemtap-sdt-dev
Now install the kernel headers (will take time)
export KERNELVER=$(uname -r | cut -d '-' -f 1)
export KERNELDIR=/linux-$KERNELVER
cd /
curl -o linux-${KERNELVER}.tar.gz https://www.kernel.org/pub/linux/kernel/v4.x/linux-${KERNELVER}.tar.gz
tar zxf linux-${KERNELVER}.tar.gz
cd linux-${KERNELVER}
zcat /proc/1/root/proc/config.gz > .config
make all
make modules_prepare
make headers_install
make modules_install
Now run stap -l 'syscall.*'. It should work and display :
...
syscall.waitpid
syscall.write
syscall.writev
This is taken from : https://github.com/fdebonneval/mobydig/blob/master/resources/build

Hide "Requirement already satisfied" warning

We have a shell script that automatically prepares virtual environment and then runs tests in it. Part of the script installs requirements:
pip install -r requirements.txt
When the script is run multiple times it prints a warning for each requirement:
Requirement already satisfied (use --upgrade to upgrade): discover==0.4.0
...
I need to run the installation step every time in case that someone adds a new requirement. I understand why the warning is displayed. The problem is that it clutters the test output.
Is there a way how to disable/hide this warning?
It worked for me:
pip install -r requirements.txt | grep -v 'already satisfied'
Assuming the errors go to stderr, this bash code should do it:
pip install -r requirements.txt 2> >(grep -v 'Requirement already satisfied' 1>&2)
For more recent versions of 'pip', where errors go to stdout, the above can be simplified to:
pip install -r requirements.txt | grep -v 'already satisfied'
For Windows users landing here this can be resolved in a virtually similar manner using Find
pip install -r requirements.txt | find /V "already satisfied"
and as answered in a Windows specific question the other way is
pip install -r requirements.txt | findstr /V /C:"Requirement already satisfied"

Will this bash loop apt-get install all my anaconda packages?

I don't want to just try it and mess something up.
$ dlpackages=$(ls -l anaconda3/bin | awk '{print $9}')
$ for package in $dlpackages; do sudo apt-get install $package; done
or as root: $ for package in $dlpackages; do apt-get install $package; done
Add a safety check for each package, to see if it can be located.
dlpackages=$(ls -l anaconda3/bin | awk '{print $9}')
for package in $dlpackages; do
[[ $(apt-cache search $package) ]] && sudo apt-get install $package
done
Now for every string, the install will only be executed if the package can be found.
Alternatively use the -s option of install as Eric Renouf suggested.
In general things in bin aren't the same as package names. conda list may be closer, but you'll ultimately probably have to figure out the translation of package names manually.

Resources