Homebrew: how to remove redis/4.0.2 and use redis#3.2 as my default redis - redis

I started this quest with redis/3.0.3 installed, and looking to upgrade my local dev redis to version 3.2.3, which is what we're running in production. I ultimately ran brew upgrade redis, which installed redis 4.0.2, ahead of my desired version. Then I found that you can install 3.2.x with brew install redis#3.2. Also, while trying to cleanup 4.0.2, instead it cleaned up only 3.0.3.
Now I'm stuck in a situation where Homebrew won't allow me to uninstall redis/4.0.2, and views redis#3.2 as a separate Homebrew Formula.
$ brew switch redis 3.2
Error: redis does not have a version "3.2" in the Cellar.
Versions available: 4.0.2
See how in the Cellar, they're showing as separate Formulae here:
$ ls /usr/local/Cellar/ | grep redis
redis
redis#3.2
What is the correct "Homebrew" way to remove redis/4.0.2 and use redis#3.2 as my default redis, so that commands to redis-server and redis-cli reference 3.2 instead? I'm running Mac OS X Yosemite 10.10.5 and Homebrew 1.3.4.
$ ls -l /usr/local/bin/ | grep redis
lrwxr-xr-x 1 jsoro wheel 41 Oct 5 12:51 redis-benchmark -> ../Cellar/redis/4.0.2/bin/redis-benchmark
lrwxr-xr-x 1 jsoro wheel 41 Oct 5 12:51 redis-check-aof -> ../Cellar/redis/4.0.2/bin/redis-check-aof
lrwxr-xr-x 1 jsoro wheel 41 Oct 5 12:51 redis-check-rdb -> ../Cellar/redis/4.0.2/bin/redis-check-rdb
lrwxr-xr-x 1 jsoro wheel 35 Oct 5 12:51 redis-cli -> ../Cellar/redis/4.0.2/bin/redis-cli
lrwxr-xr-x 1 jsoro wheel 40 Oct 5 12:51 redis-sentinel -> ../Cellar/redis/4.0.2/bin/redis-sentinel
lrwxr-xr-x 1 jsoro wheel 38 Oct 5 12:51 redis-server -> ../Cellar/redis/4.0.2/bin/redis-server

The issue was trivial and could have been easier if the Brew Docs/FAQs were more clear. The Brew FAQs say that uninstalls are handled by brew cleanup <formula>, which is what caused my redis/3.0.3 to be removed. However, brew cleanup would not remove redis/4.0.2. To remove it I used brew uninstall, which I could not find in the Docs...
$ brew uninstall redis
Uninstalling /usr/local/Cellar/redis/4.0.2... (11 files, 2.7MB)
Then, to fix the remaining issue of redis#3.2 not being symlinked under /usr/local/bin/, I first tried an uninstall/re-install of redis#3.2 to see if Homebrew would take care of it...
$ ls -l /usr/local/bin/ | grep redis
$ brew uninstall redis#3.2
Uninstalling /usr/local/Cellar/redis#3.2/3.2.11... (11 files, 1.7MB)
$ brew install redis#3.2
==> Downloading http://download.redis.io/releases/redis-3.2.11.tar.gz
## TRIMMED ##
==> Summary
🍺 /usr/local/Cellar/redis#3.2/3.2.11: 11 files, 1.7MB, built in 10 seconds
Of course, this did not create the symlinks--actually the Caveats section which I trimmed away from the output says this explicitly with suggestions. Instead of using their suggestion, I opted to create symlinks manually:
$ cd /usr/local/bin/
$ ls -l | grep redis
$
$ ln -s /usr/local/Cellar/redis\#3.2/3.2.11/bin/redis-check-aof redis-check-aof
$ ln -s /usr/local/Cellar/redis\#3.2/3.2.11/bin/redis-check-rdb redis-check-rdb
$ ln -s /usr/local/Cellar/redis\#3.2/3.2.11/bin/redis-cli redis-cli
$ ln -s /usr/local/Cellar/redis\#3.2/3.2.11/bin/redis-sentinel redis-sentinel
$ ln -s /usr/local/Cellar/redis\#3.2/3.2.11/bin/redis-server redis-server
$ ls -l | grep redis
lrwxr-xr-x 1 jsoro wheel 54 Oct 5 14:27 redis-check-aof -> /usr/local/Cellar/redis#3.2/3.2.11/bin/redis-check-aof
lrwxr-xr-x 1 jsoro wheel 54 Oct 5 14:27 redis-check-rdb -> /usr/local/Cellar/redis#3.2/3.2.11/bin/redis-check-rdb
lrwxr-xr-x 1 jsoro wheel 48 Oct 5 14:27 redis-cli -> /usr/local/Cellar/redis#3.2/3.2.11/bin/redis-cli
lrwxr-xr-x 1 jsoro wheel 53 Oct 5 14:27 redis-sentinel -> /usr/local/Cellar/redis#3.2/3.2.11/bin/redis-sentinel
lrwxr-xr-x 1 jsoro wheel 51 Oct 5 14:26 redis-server -> /usr/local/Cellar/redis#3.2/3.2.11/bin/redis-server
The last thing to note is that since I had run the redis-server while under the redis/4.0.2 version, the dump.rdb file was no longer compatible. Running redis-server using redis 3.2.x on a 4.x dump.rdb causes the server to exit immediately.
$ redis-server
## TRIMMED ##
38504:M 05 Oct 14:29:07.234 # Server started, Redis version 3.2.11
38504:M 05 Oct 14:29:07.259 # Can't handle RDB format version 8
38504:M 05 Oct 14:29:07.260 # Fatal error loading the DB: Invalid argument. Exiting.
Unfortunately you need to rm dump.rdb, or remove/rename the dump.rdb file, in order to get redis-server to start up again.

Related

No module named numpy in Flask

I need to use Numpy on EC2 instance that runs Flask with WSGI-py3, which can be accessed over HTTP.
After setting up everything needed, I can see the page in the browser. However, later I am installing Numpy using pip3 and now the service breaks with the following error in /var/log/apache2/error.log ModuleNotFoundError: No module named 'numpy', however I can import numpy in python3 without any problems
What could be done to be able to import numpy in Flask application?
EDIT:
It is confusing.. If I list all Python versions installed, I get:
0 lrwxrwxrwx 1 root root 9 Oct 25 2018 /usr/bin/python3 -> python3.6
0 lrwxrwxrwx 1 root root 16 Oct 25 2018 /usr/bin/python3-config -> python3.6-config
4 -rwxr-xr-x 1 root root 1018 Oct 28 2017 /usr/bin/python3-jsondiff
4 -rwxr-xr-x 1 root root 3661 Oct 28 2017 /usr/bin/python3-jsonpatch
4 -rwxr-xr-x 1 root root 1342 May 1 2016 /usr/bin/python3-jsonpointer
4 -rwxr-xr-x 1 root root 398 Nov 15 2017 /usr/bin/python3-jsonschema
4424 -rwxr-xr-x 2 root root 4526456 Apr 18 01:56 /usr/bin/python3.6
0 lrwxrwxrwx 1 root root 33 Apr 18 01:56 /usr/bin/python3.6-config -> x86_64-linux-gnu-python3.6-config
4424 -rwxr-xr-x 2 root root 4526456 Apr 18 01:56 /usr/bin/python3.6m
0 lrwxrwxrwx 1 root root 34 Apr 18 01:56 /usr/bin/python3.6m-config -> x86_64-linux-gnu-python3.6m-config
0 lrwxrwxrwx 1 root root 10 Oct 25 2018 /usr/bin/python3m -> python3.6m
0 lrwxrwxrwx 1 root root 17 Oct 25 2018 /usr/bin/python3m-config -> python3.6m-config
pip3 seems to be connected to python3.6
/usr/local/bin/flask uses #!/usr/bin/python3
If I install numpy using /usr/bin/python3 -m pip install numpy I still have the same problem
This probably means, the Python interpreter which runs Flask is a different than the Python interpreter which you have installed numpy into.
Unfortunately, I have no experience with AWS.
Basically, you have to figure out how to find the Python interpreter you installed Flask with.
Using virtual environment in EC2 has helped:
sudo apt-get update
sudo apt-get install apache2
sudo apt-get install libapache2-mod-wsgi-py3
sudo apt-get install python3.6
sudo ln -sT /usr/bin/python3 /usr/bin/python
sudo apt-get install python3-pip
sudo ln -sT /usr/bin/pip3 /usr/bin/pip
sudo pip install flask
sudo apt-get install virtualenv
mkdir ~/flaskapp
sudo ln -sT ~/flaskapp /var/www/html/flaskapp
cd ~/flaskapp
virtualenv flask --python=python3
sudo vim /etc/apache2/sites-enabled/000-default.conf:
.....
sudo pip3 install numpy
...

Can't open lib '/usr/local/lib/libmsodbcsql.17.dylib'

I am trying to get mssql working on my OSX machine. However, it keeps giving me error:
$ sqlcmd -S 0.0.0.0,1401 -U SA -P P#55w0rd -i database-setup/sql/initialize.sql
Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : Can't open lib '/usr/local/lib/libmsodbcsql.17.dylib' : file not found.
Although, I am pretty sure, my file is in that location:
$ ls -la /usr/local/lib/libmsodbcsql.17.dylib
lrwxr-xr-x 1 localadmin admin 64 7 4 16:38 /usr/local/lib/libmsodbcsql.17.dylib -> /usr/local/Cellar/msodbcsql17/17.1.0.1/lib/libmsodbcsql.17.dylib
$ ls -la /usr/local/Cellar/msodbcsql17/17.1.0.1/lib/libmsodbcsql.17.dylib
-r--r--r-- 1 localadmin admin 2539360 7 4 15:34 /usr/local/Cellar/msodbcsql17/17.1.0.1/lib/libmsodbcsql.17.dylib
I know this question has been asked multiple times but none of the available solutions have worked for me.
Things I have tried:
https://github.com/Microsoft/homebrew-mssql-release/issues/7
https://github.com/Microsoft/homebrew-mssql-release/issues/3
I fixed my problem by:
$ brew uninstall msodbcsql17 mssql-tools
and then:
$ brew install msodbcsql17 mssql-tools
For me this solved it:
brew install microsoft/mssql-release/msodbcsql17

I installed nodejs , but npm looks like not working( at embedded linux)

I installed Node.js.
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs (15.4MB)
I can find the Node.js npm.
root#linaro-server:/usr/bin# ll | grep node
lrwxrwxrwx 1 root root 22 Jan 24 10:31 node -> /etc/alternatives/node*
-rwxr-xr-x 1 root root 5996796 Jan 24 07:05 nodejs*
lrwxrwxrwx 1 root root 38 Jan 24 07:05 npm -> ../lib/node_modules/npm/bin/npm-cli.js*
# node -v
v0.10.25
# npm -v
no returns, it looks like npm not working.
How can I activate npm or reinstall npm.
Now, I run this command:
curl https://npmjs.org/install.sh | sh
but my linux prompt stop at
fetching: http://registry.npmjs.org/npm/-/npm-1.3.25.tgz
How can I manage this probelem?
I was confused the environment of nodejs.
My CPU is ARM.
uname -a
shows
Linux linaro-server 3.6.0-10612-g9d11689 #11 SMP PREEMPT Mon Dec 3 16:04:32 IST 2012 armv7l armv7l armv7l GNU/Linux
So I should compile node.js.
The following is my solution.
wget http://nodejs.org/dist/node-latest.tar.gz
tar zxvf node-latest.tar.gz
cd node-v*
./configure --without-snapshot --dest-cpu=arm --dest-os=linux
make
make install
the MAKE takes a time, but above steps show me the good result.
I can get normal return of node -v and npm -v.
root:/home/user01> node -v
v0.11.9
root:/home/user01> npm -v
1.3.15
node and npm was installed at /usr/local/bin
root:/usr/local/bin> ll | grep node
-rwxr-xr-x 1 root root 10912375 Jan 27 08:04 node*
lrwxrwxrwx 1 root root 38 Jan 27 08:04 npm -> ../lib/node_modules/npm/bin/npm-cli.js*
I referred this file :
http://events.linuxfoundation.org/sites/events/files/slides/nodejs-presentation_0.pdf

Redis - Monit does not start properly

Monit can not start redis-server properly.
Running Redis through init.d works correctly:
$ sudo su
$ /etc/init.d/redis_6379 start
$ #=> Starting Redis server...
$ ps aux | grep redis
$ #=> root 8980 0.0 0.0 42128 1964 ? Ssl 04:56 0:00 /etc/redis/src/redis-server *:6379
$ /etc/init.d/redis_6379 stop
$ #=> Stopping ...
$ #=> Redis stopped
$ #=> (ps aux| grep redis) There's no redis process.
Running Redis through Monit does not work correctly:
(I killed the Redis process and rm /var/run/redis_6379.pid)
$ sudo su
$ monit start redis
$ ps aux | grep redis
$ #=> root 9082 0.0 0.0 35076 1972 ? Ssl 05:08 0:00 /etc/redis/src/redis-server *:6379
monit.log:
[MSK Jan 6 05:08:14] info : 'redis' start on user request
[MSK Jan 6 05:08:14] info : monit daemon at 3947 awakened
[MSK Jan 6 05:08:14] info : Awakened by User defined signal 1
[MSK Jan 6 05:08:14] info : 'redis' start: /etc/init.d/redis_6379
[MSK Jan 6 05:08:44] error : 'redis' failed to start
[MSK Jan 6 05:08:44] info : 'redis' start action done
Stopping Redis through Monit does not works correclty also:
$ ps aux | grep redis
$ #=> root 9018 0.0 0.0 35076 1968 ? Ssl 05:02 0:00 /etc/redis/src/redis-server *:6379
$ monit stop redis
$ ps aux | grep redis
$ #=> root 9082 0.0 0.0 35076 1972 ? Ssl 05:08 0:00 /etc/redis/src/redis-server *:6379
monit.log
[MSK Jan 6 05:10:02] info : 'redis' stop on user request
[MSK Jan 6 05:10:02] info : monit daemon at 3947 awakened
[MSK Jan 6 05:10:02] info : Awakened by User defined signal 1
[MSK Jan 6 05:10:02] info : 'redis' stop action done
I have:
Ubuntu 12.04.3 LTS
redis-2.8.2
monit-5.3.2
redis instalation path /etc/redis
monit instalation path /etc/monit (installed from apt-get repo)
And following config files:
https://gist.github.com/itsNikolay/665112df34d2eae09330
I had the same problem, and there is no mutch talk about this situation around. I fixed it with another solution, it may concern someone else so I post it here.
in monit configuration file I had
start program = "/etc/init.d/redis start"
stop program = "/etc/init.d/redis stop"
Replacing by the following fixed the problem (with Ubuntu)
start program = "/usr/sbin/service redis start"
stop program = "/usr/sbin/service redis stop"
Just changes owner of /etc/redis dir
$ chown -R root /etc/redis
and restart monit
$ monit restart
The problem is gone. Strange. I wish it helps.

make: *** /lib/modules/2.6.32-279.el6.x86_64/build: No such file or directory. Stop

I downloaded the RALINK driver from their web site
untar -xvf rtl*
and then i ran "make" in it. google search suggested "kernel-devel"
needed to be installed.
i installed the kernel-devel package but i still get this error
make: *** /lib/modules/2.6.32-279.el6.x86_64/build: No such file or directory. Stop.
when i check to see if that file exists..
i cd into /lib/modules/2.6.32-279.el6.x86_64/
i believe this error happens right after "make" command tries to execute this command
make ARCH=x86_64 CROSS_COMPILE= -C /lib/modules/2.6.32-279.el6.x86_64/build M=/home/a/Desktop/3/rtl8712_8188_8191_8192SU_usb_linux_v2.6.6.0.20120405 modules
and it's there it is called "build"
so why is it saying no such file or directory ?
**EDIT**
If your problem is like the one I was having (see below), it seems the kernel development package isn't installed.
Try:
yum install kernel-devel
Original Message
I am having the same problem. But, interestingly, when I ls-l on the parent directory to the "missing directory" (so, ls -l /lib/modules/2.6.32-431.el6.x86_64/) it shows that build is a broken link pointing to /usr/src/kernels/2.6.32-431.el6.x86_64, but /usr/src/kernels/ is empty.
So, I don't know if this is much help, but hopefully it gives someone else a better idea of what's wrong.
[root#xx libreswan-3.7]# ls -l /lib/modules/2.6.32-431.el6.x86_64/
total 3524
lrwxrwxrwx. 1 root root 46 Dec 12 13:42 build -> ../../../usr/src/kernels/2.6.32-431.el6.x86_64
drwxr-xr-x. 2 root root 4096 Nov 21 22:41 extra
drwxr-xr-x. 11 root root 4096 Dec 12 13:42 kernel
-rw-r--r--. 1 root root 589679 Dec 12 13:43 modules.alias
...
-rw-r--r--. 1 root root 851070 Dec 12 13:43 modules.usbmap
lrwxrwxrwx. 1 root root 5 Dec 12 13:42 source -> build
drwxr-xr-x. 2 root root 4096 Nov 21 22:41 updates
drwxr-xr-x. 2 root root 4096 Dec 12 13:42 vdso
drwxr-xr-x. 2 root root 4096 Nov 21 22:41 weak-updates
[root#xx libreswan-3.7]# ls /usr/src/kernels/
[root#xx libreswan-3.7]#
Notice that the "source" link is also broken because it points to build.
cd /lib/modules/2.6.32-431.el6.x86_64
sudo rm build
sudo ln -s ../../../usr/src/kernels/2.6.32-431.29.2.el6.x86_64/ build
The above commands fixed the issue for me
But basically you must be able to use any version of 2.6.32* directory in the last command.
Thanks to Nighthawk663.
I have the same problem in ./configure --with-linux=/lib/modules/uname -r/build/. It says "not a file..." too.
Reason:
The kernel head files are missing for the current kernel.
How I solved it:
find current kernel: uname -r
yum install kernel-devel-$(uname -r)
you may not find it...
just google that version of kernel-devel-... download the rpm file, and do
rpm -i kernel-devel-xxxx.rpm
Then it works for me!
/usr/lib/modules/your-kernel-edition/build is a link file.
the link file exists. but the target file might not exists. So It is ok to see the link file, but the folder can not be changed into it (cd).
Similar Example on fedora 29.
lrwxrwxrwx. 1 root root 40 Oct 21 07:38 /usr/lib/modules/4.18.16-300.fc29.x86_64/build -> /usr/src/kernels/4.18.16-300.fc29.x86_64
Just install kernel-devel.
Example.
sudo dnf install kernel-devel-$(uname -r)
Because the link is not with your kernel version.
Delete the wrong link.
$ rm build`
Use $ uname -r to check the kernel version
Build new link with your kernel version.
$ ln -s ../../../usr/src/kernels/($(uname -r)/ build
Done