Why does my numpy install keeps being KILLED? - python

here's what I am trying to do on Coding Ground
sh-4.3$ pip install --target=. virtualenv
You are using pip version 7.1.0, however version 8.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting virtualenv
Downloading virtualenv-15.0.2-py2.py3-none-any.whl (1.8MB)
100% |################################| 1.8MB 204kB/s
Installing collected packages: virtualenv
Successfully installed virtualenv
sh-4.3$ python virtualenv.py mine
New python executable in /home/cg/root/mine/bin/python
Installing setuptools, pip, wheel...done.
sh-4.3$ . mine/bin/activate
(mine) sh-4.3$ pip install numpy
Collecting numpy
Downloading numpy-1.11.0-cp27-cp27mu-manylinux1_x86_64.whl (15.3MB)
99% |############################### | 15.3MB 43.1MB/s eta 0:00:01Killed
(mine) sh-4.3$
Why does my trying of installation of numpy keep being killed?
And how do i solve this problem?

A quick fix for this would be to add swap memory. Here's an Ubuntu example:
sudo mkdir /media/fasthdd
dd if=/dev/zero of=/media/fasthdd/swapfile.img bs=1024 count=1M
sudo mkswap /media/fasthdd/swapfile.img
sudo swapon /media/fasthdd/swapfile.img
Don't forget to turn it off if you don't need it.

Related

pip install ibm-db seems failed. keep "Getting requirements to build wheel" for minutes

my pip info
pip3 --version
pip 22.0.3 from /myPath/Python/3.8/lib/python/site-packages/pip (python 3.8)
while i install "ibm-db" for the lastest version, it shows
Defaulting to user installation because normal site-packages is not writeable
Collecting ibm-db
Using cached ibm_db-3.1.1.tar.gz (1.1 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... -
and nothing happened anymore.
what shoule I do?
thanks
Check that you have gcc and python-devel installed. If not (Assuming a Redhat derivative, something similar for others)
sudo dnf install gcc
sudo dnf install python3-devel
The pip installation seems to access some system files, despite being installed with --user, so you may have to:
sudo pip3 install --user ibm_db
You can find more info at: pypi

pip install --upgrade gives the same warning

Successfully installed pip-21.0.1
WARNING: You are using pip version 20.2.1; however, version 21.0.1 is available.
Full trace
$ /usr/bin/python3 -m pip install --upgrade pip
Defaulting to user installation because normal site-packages is not writeable
Collecting pip
Downloading pip-21.0.1-py3-none-any.whl (1.5 MB)
|████████████████████████████████| 1.5 MB 19.7 MB/s
Installing collected packages: pip
WARNING: The scripts pip, pip3 and pip3.6 are installed in '/home/ubuntu/.local/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed pip-21.0.1
WARNING: You are using pip version 20.2.1; however, version 21.0.1 is available.
You should consider upgrading via the '/usr/bin/python3 -m pip install --upgrade pip' command.
Despite upgrading why does it give the warning?
You don't have write permission to do the site-package upgrade re site-packages is not writeable. You can run it with sudo if you wish, although for a Debian based distribution it would be more appropriate to leave package managed files alone.
And you are not using the local version you installed re `'/home/ubuntu/.local/bin' which is not on PATH`.
To do this,
export PATH=$PATH:/home/ubuntu/.local/bin
Use sudo /usr/bin/python3 -m pip install --upgrade pip

ERROR: Could not build wheels for opencv-python which use PEP 517 and cannot be installed directly

I was trying to install OpenCV4 in a docker on jetson nano. It has jetpack 4.4 s os. The docker was successfully created and Tensorflow is running but while installing OpenCV using pip it is showing CMake error.
root#5abf405fb92d:~# pip3 install opencv-python
Collecting opencv-python
Downloading opencv-python-4.4.0.42.tar.gz (88.9 MB)
|████████████████████████████████| 88.9 MB 2.5 kB/s
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing wheel metadata ... done
Requirement already satisfied: numpy>=1.13.3 in /usr/local/lib/python3.6/dist-packages (from opencv-python) (1.18.4)
Building wheels for collected packages: opencv-python
Building wheel for opencv-python (PEP 517) ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 /usr/local/lib/python3.6/dist-packages/pip/_vendor/pep517/_in_process.py build_wheel /tmp/tmpqpzwrofy
cwd: /tmp/pip-install-93nxibky/opencv-python
Complete output (9 lines):
File "/tmp/pip-build-env-o_hualnr/overlay/lib/python3.6/site-packages/skbuild/setuptools_wrap.py", line 560, in setup
cmkr = cmaker.CMaker(cmake_executable)
File "/tmp/pip-build-env-o_hualnr/overlay/lib/python3.6/site-packages/skbuild/cmaker.py", line 95, in __init__
self.cmake_version = get_cmake_version(self.cmake_executable)
File "/tmp/pip-build-env-o_hualnr/overlay/lib/python3.6/site-packages/skbuild/cmaker.py", line 82, in get_cmake_version
"Problem with the CMake installation, aborting build. CMake executable is %s" % cmake_executable)
Traceback (most recent call last):
Problem with the CMake installation, aborting build. CMake executable is cmake
----------------------------------------
ERROR: Failed building wheel for opencv-python
Failed to build opencv-python
ERROR: Could not build wheels for opencv-python which use PEP 517 and cannot be installed directly
I had the same problem and i did this,
pip install --upgrade pip setuptools wheel
then install opencv again,
pip install opencv-python
this worked for me
If after
pip install --upgrade pip setuptools wheel
you still have the same error,
You can try to specify the older version of OpenCV to install.
Ex.
pip3 install opencv-python==3.4.13.47
Yes .. Finally found a work around.
Follow this https://github.com/mdegans/nano_build_opencv and build from source and finally gets installed.
PS: It may take a bit long for building, for me it took 10 Hrs :P.
Happy Image-Processing..
I had a similar problem and what solved it for me was not to use python:3-alpine but python:3.8-slim. E.g.:
FROM python:3.8-slim
WORKDIR /usr/src/app
RUN apt update
RUN apt -y install build-essential libwrap0-dev libssl-dev libc-ares-dev uuid-dev xsltproc
RUN apt-get update -qq \
&& apt-get install --no-install-recommends --yes \
build-essential \
gcc \
python3-dev \
mosquitto \
mosquitto-clients
RUN pip3 install --upgrade pip setuptools wheel
RUN python3 -m pip install --no-cache-dir \
numpy scipy matplotlib scikit-build opencv-contrib-python-headless \
influxdb paho-mqtt configparser Pillow \
qrcode
worked finally for me.
please check your python specifications:
- opencv -> python[
version='
>=2.7,<2.8.0a0
>=3.5,<3.6.0a0
>=3.6,<3.7.0a0
>=3.7,<3.8.0a0']
I handled it by reinstalling python3 from scratch in my MacBook:
brew reinstall python#3.9
I also reinstalled numpy and matplotlib packages experimentally.
pip3 install numpy
pip3 install matplotlib
pip3 install opencv-contrib-python
The versions:
macOS Mojave 10.14.5
Python 3.9.7
OpenCV 4.5.3
OpenCV's version is 4.5.3 by this way:
import cv2
print(cv2.__version__)
But by "pip list", it shows "opencv-contrib-python 3.4.9.31".
if you are trying to install opencv in your raspberrypi 3B, Use following steps:
sudo raspi-config
advanced -- expand filesystem
reboot your pi
Open your raspi terminal and do following stuff:
use command: sudo apt-get update
use command: sudo apt-get upgrade
check your python version and upgarde it to latest one
install pip and upgrade pip
use command: mkdir project
use command: cd project
create virtual environment
activate virtual environment
install dependencies ,can get dependencies from https://singleboardbytes.com/647/install-opencv-raspberry-pi-4.htm
if error in installing libdhf5-dev
use command: sudo apt-get install python3-h5py and reinstall libdhf5-dev
use command: pip install scikit-build
use command: pip install cython
before installing opencv ,make sure you are in virtual environment or
activate environment
use command: pip install --no-cache-dir opencv-contrib-python==4.5.3.56
Remember to use mentioned version...
Thank You...
I came across similiar situation
I had error
Failed to build opencv-python ERROR: Could not build wheels for
opencv-python which use PEP 517 and cannot be installed directly
WARNING: You are using pip version 19.2.3, however version 22.0.4 is
available. You should consider upgrading via the 'python -m pip
install --upgrade pip' command.
I ran in command prompt with admin privileges following
python -m pip install --upgrade pip
Now "pip install opencv-python" works

Python - Where is the pip executable after install?

Since I am on a server and do not have admin privilege, I need to install my own version of python and pip locally. After installed python, I used the code python get-pip.py --user which is on the official site. I get the following return and seems pip is successfully installed. But I do not know where is the pip executable so that I cannot add it to the system environment. So where is it installed?
Collecting pip
Using cached pip-8.1.2-py2.py3-none-any.whl
Collecting setuptools
Using cached setuptools-27.2.0-py2.py3-none-any.whl
Collecting wheel
Using cached wheel-0.29.0-py2.py3-none-any.whl
Installing collected packages: pip, setuptools, wheel
Successfully installed pip setuptools wheel
On Unix, pip install --user ... drops scripts into ~/.local/bin
pip sould be somewhere around ~/.local

pip install --upgrade pip installs the same version

Somehow pip --upgrade doesn't upgrade any packages.
I'm on OSX El Capitan (10.11.3) and installed python using brew install python
Python: /usr/local/bin/python# -> ../Cellar/python/2.7.11/bin/python
Pip: /usr/local/bin/pip# -> ../Cellar/python/2.7.11/bin/pip
After successful install I run pip install --upgrade pip.
Full output:
$ pip install --upgrade pip
Collecting pip
Using cached pip-8.1.0-py2.py3-none-any.whl
Installing collected packages: pip
Successfully installed pip-8.0.2
You are using pip version 8.0.2, however version 8.1.0 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Why doesn't pip install the new version?
Update
I think it has something to do with my ~/.pydistutils.cfg file which fixes the DistutilsOptionError: must supply either home or prefix/exec-prefix -- not both error when running pip. I followed these instructions
Related SO question
$ sudo pip install -U pip
Collecting pip
Downloading pip-9.0.3-py2.py3-none-any.whl (1.4MB)
100% |████████████████████████████████| 1.4MB 335kB/s
Installing collected packages: pip
Found existing installation: pip 9.0.1
Uninstalling pip-9.0.1:
Successfully uninstalled pip-9.0.1
Successfully installed pip-9.0.3
Getting annoyed by things not working I created a new OSX profile. In the new profile everything was working fine so after investigating further I found a file ~/Library/Application\ Support/pip/pip.conf in my main profile containing:
[global]
target=/usr/local/lib/python2.7/site-packages
I don't know how it got there but removing it resolved the issue.
This also resolved the need for the ~/.pydistutils.cfg file.

Categories