Failed to install Pandas [duplicate] - python

I am using the below dockerfile to build an image .
FROM <custom registry>/python:alpine3.7
# Copy local code to the container image.
ENV APP_HOME app
WORKDIR $APP_HOME
COPY . .
#RUN pip install versioneer
RUN pip install Flask google-auth google-cloud-storage numpy datetime pandas sklearn
ENV PORT 8080
CMD ["python", "app_hello.py"]
When I tried to do a docker build it gave me the below error
File "setup.py", line 37, in <module>
import versioneer
ModuleNotFoundError: No module named 'versioneer'
----------------------------------------
Command "/usr/local/bin/python /usr/local/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /tmp/tmp8gvrvde_" failed with error code 1 in /tmp/pip-install-s551_g8p/numpy
I tried to install versioneer as well , but it did not work.
What am I missing here ?

Command "/usr/local/bin/python /usr/local/lib/python3.7/site-packages/pip/_vendor/pep517/in_process.py get_requires_for_build_wheel /tmp/tmp8gvrvde" failed with error code 1 in /tmp/pip-install-s551_g8p/numpy
The error happens when build numpy, and this indicates you need to upgrade pip to make it work:
pip install --upgrade pip
Additional, you need install compiler for build with next:
apk add build-base
With above, a sample workable Dockerfile as next:
FROM python:alpine3.7
RUN pip install --upgrade pip; apk add build-base; pip install numpy
RUN python -c "import numpy; print(numpy.__version__)"
The output:
$ docker build -t abc:1 .
Sending build context to Docker daemon 2.048kB
Step 1/3 : FROM python:alpine3.7
---> 00be2573e9f7
Step 2/3 : RUN pip install --upgrade pip; apk add build-base; pip install numpy
---> Running in bba4eed0d626
Collecting pip
Downloading https://files.pythonhosted.org/packages/8a/d7/f505e91e2cdea53cfcf51f4ac478a8cd64fb0bc1042629cedde20d9a6a9b/pip-21.2.2-py3-none-any.whl (1.6MB)
Installing collected packages: pip
Found existing installation: pip 19.0.1
Uninstalling pip-19.0.1:
Successfully uninstalled pip-19.0.1
Successfully installed pip-21.2.2
...
Collecting numpy
Downloading numpy-1.21.1.zip (10.3 MB)
...
Successfully built numpy
Installing collected packages: numpy
Successfully installed numpy-1.21.1
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
Removing intermediate container bba4eed0d626
---> 6e11968fe036
Step 3/3 : RUN python -c "import numpy; print(numpy.__version__)"
---> Running in 0f4c47db07cd
1.21.1
Removing intermediate container 0f4c47db07cd
---> f189962ad246
Successfully built f189962ad246
Successfully tagged abc:1

Related

Error with requirements file when creating docker image

Note, I'm brand new to docker.
I'm trying to create a docker image of my flask app but when I run sudo docker image build -t flask_docker . it keeps throwing version errors at the step of installing the requirements.txt file.
Here is my docker file
FROM python:3.8-alpine
COPY requirements.txt /app/requirements.txt
WORKDIR /app
RUN pip3 install -r requirements.txt
COPY . /app
ENTRYPOINT ["python3"]
CMD ["app.py"]
And here is the error.
ERROR: Could not find a version that satisfies the requirement Brlapi==0.8.2 (from versions: none)
ERROR: No matching distribution found for Brlapi==0.8.2
WARNING: You are using pip version 22.0.4; however, version 22.2.2 is available.
You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command.
What is the proper way to fix this error? Should I just manually go through and find which packages don't install properly and just remove them?
I would recommend using a Virtual environment to install packages, but for your situation try reinstalling Brlapi with
pip install --upgrade --force-reinstall Brlapi
and then pip freeze to get your requirements.txt

No matching distribution found for package have "ubuntu" in there name

I am have some problem while install pip package in docker image.
My Dockerfile is like this
....
RUN python -m venv /vir_env
RUN . /vir_env/bin/activate && pip install --upgrade pip
RUN pip install -r ./requirements.txt
....
My requirements.txt file is generate by pip freeze > requirements.txt
But when I run docker build it always error in package have "ubuntu" in there name python-apt==2.0.0+ubuntu0.20.4.6, distro-info===0.23ubuntu1
Error log:
....
#13 5.890 ERROR: No matching distribution found for python-apt==2.0.0+ubuntu0.20.4.6
#13 6.360 WARNING: You are using pip version 21.2.4; however, version 22.0.4 is available.
#13 6.360 You should consider upgrading via the '/vir_env/bin/python3 -m pip install --upgrade pip' command.
------
error: failed to solve: executor failed running [/bin/sh -c . /vir_env/bin/activate && pip3 install -r /requirements.txt]: exit code: 1
....
#13 5.890 ERROR: No matching distribution found for distro-info===0.23ubuntu1
#13 6.360 WARNING: You are using pip version 21.2.4; however, version 22.0.4 is available.
#13 6.360 You should consider upgrading via the '/vir_env/bin/python3 -m pip install --upgrade pip' command.
------
error: failed to solve: executor failed running [/bin/sh -c . /vir_env/bin/activate && pip3 install -r /requirements.txt]: exit code: 1
I already try pip upgrade but not don't work.
Is there any other way to fix or is there any update about this but I missed ?
I still don't know what problem is it.
But I make new ubuntu container and install package manually and try pip freeze > requirements.txt it don't generate any pip package with "ubuntu" in there name.
I think there is some problem with my docker or my pip package.

ModuleNotFoundError: No module named 'versioneer'

I am using the below dockerfile to build an image .
FROM <custom registry>/python:alpine3.7
# Copy local code to the container image.
ENV APP_HOME app
WORKDIR $APP_HOME
COPY . .
#RUN pip install versioneer
RUN pip install Flask google-auth google-cloud-storage numpy datetime pandas sklearn
ENV PORT 8080
CMD ["python", "app_hello.py"]
When I tried to do a docker build it gave me the below error
File "setup.py", line 37, in <module>
import versioneer
ModuleNotFoundError: No module named 'versioneer'
----------------------------------------
Command "/usr/local/bin/python /usr/local/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /tmp/tmp8gvrvde_" failed with error code 1 in /tmp/pip-install-s551_g8p/numpy
I tried to install versioneer as well , but it did not work.
What am I missing here ?
Command "/usr/local/bin/python /usr/local/lib/python3.7/site-packages/pip/_vendor/pep517/in_process.py get_requires_for_build_wheel /tmp/tmp8gvrvde" failed with error code 1 in /tmp/pip-install-s551_g8p/numpy
The error happens when build numpy, and this indicates you need to upgrade pip to make it work:
pip install --upgrade pip
Additional, you need install compiler for build with next:
apk add build-base
With above, a sample workable Dockerfile as next:
FROM python:alpine3.7
RUN pip install --upgrade pip; apk add build-base; pip install numpy
RUN python -c "import numpy; print(numpy.__version__)"
The output:
$ docker build -t abc:1 .
Sending build context to Docker daemon 2.048kB
Step 1/3 : FROM python:alpine3.7
---> 00be2573e9f7
Step 2/3 : RUN pip install --upgrade pip; apk add build-base; pip install numpy
---> Running in bba4eed0d626
Collecting pip
Downloading https://files.pythonhosted.org/packages/8a/d7/f505e91e2cdea53cfcf51f4ac478a8cd64fb0bc1042629cedde20d9a6a9b/pip-21.2.2-py3-none-any.whl (1.6MB)
Installing collected packages: pip
Found existing installation: pip 19.0.1
Uninstalling pip-19.0.1:
Successfully uninstalled pip-19.0.1
Successfully installed pip-21.2.2
...
Collecting numpy
Downloading numpy-1.21.1.zip (10.3 MB)
...
Successfully built numpy
Installing collected packages: numpy
Successfully installed numpy-1.21.1
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
Removing intermediate container bba4eed0d626
---> 6e11968fe036
Step 3/3 : RUN python -c "import numpy; print(numpy.__version__)"
---> Running in 0f4c47db07cd
1.21.1
Removing intermediate container 0f4c47db07cd
---> f189962ad246
Successfully built f189962ad246
Successfully tagged abc:1

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

Unable to install scipy on rhel 7.7 on Dockerfile

I'm unable to install scipy on rhel 7.7 ibm linuxone vm.
my Dockerfile consists of
FROM python:3
RUN pip install pystrich
RUN pip install numpy
RUN pip install pandas
RUN pip install scipy
RUN pip install scikit-learn
Error: The command '/bin/sh -c pip install scipy' returned a non-zero code: 1
but without scipy and sklearn application was successfully building. please help through this one.

Categories