Trouble Installing Scipy in Virtualenv on a Amazon Ec2 Linux Micro Instance

Trouble installing scipy in virtualenv on a amazon ec2 linux micro instance

One solution is to temporarily enable swap on your micro instance. As described at this SO post, enable 1gb swap via:

sudo /bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024
sudo /sbin/mkswap /var/swap.1
sudo /sbin/swapon /var/swap.1

Once swap is on, install scipy via pip:

sudo apt-get install -y libatlas-base-dev gfortran python-dev build-essential g++
sudo pip install numpy
sudo pip install scipy

Once scipy successfully installs, you can disable it via:

sudo swapoff /var/swap.1
sudo rm /var/swap.1

Installing OpenCV/python on Amazon Linux (apache)?

tested and working on amzn-ami-hvm-2016.03.1.x86_64-gp2

sudo yum install git cmake gcc-c++ numpy python-devel 
sudo pip install --upgrade pip
sudo ln -rs /usr/local/bin/pip /usr/bin/
wget https://pypi.python.org/packages/18/eb/707897ab7c8ad15d0f3c53e971ed8dfb64897ece8d19c64c388f44895572/numpy-1.11.1-cp27-cp27mu-manylinux1_x86_64.whl
sudo pip install numpy-1.11.1-cp27-cp27mu-manylinux1_x86_64.whl
git clone https://github.com/Itseez/opencv.git
cd opencv
git checkout 3.1.0
mkdir build
cd build
cmake .. -DBUILD_opencv_python2=ON
make -j4
sudo make install
echo 'export PYTHONPATH=$PYTHONPATH:/usr/local/lib/python2.7/site-packages/:/usr/local/lib/python2.7/dist-packages/'>>~/.bashrc;. ~/.bashrc
python -c 'import cv2; print "cv2 imported"'

most importantly after cmake step. you should see this in the output.

--   Python 2:
-- Interpreter: /usr/bin/python2.7 (ver 2.7.10)
-- Libraries: /usr/lib64/libpython2.7.so (ver 2.7.10)
-- numpy: /usr/local/lib64/python2.7/site-packages/numpy/core/include (ver 1.11.1)
-- packages path: lib/python2.7/dist-packages

now if it is not showing up, you need to completely remove build folder and rerun cmake again after correctly installing numpy, just rerunning cmake inside your already existing build folder will not work.



Related Topics



Leave a reply



Submit