Error when installing python packages in dockerfile (qt5, pyqt5) - docker

I am trying to install some packages into my docker environment so I can use them inside a container. But when I am running my Dockerfile I am getting the following error:
ERROR: Could not find a version that satisfies the requirement qt5 (from versions: none)
ERROR: No matching distribution found for qt5
Can someone please help me with this problem?
My Dockerfile:
FROM python:latest
WORKDIR /usr/src/app
RUN python3 -m pip install --upgrade pip
RUN pip3 install qt5
RUN pip3 install pyqt5
COPY ./server.py /app/
COPY ./hinto.py /app/
Note: I already have those packages successfully running on my host machine (Macbook m1)

From
https://pypi.org/project/PyQt5/
The GPL version of PyQt5 can be installed from PyPI:
Install it using:
pip3 install PyQt5

Related

Pypy datascience docker image

I have some datascience projects running in docker containers (I use k8s). I am trying to speed up my code by using pypy as my interpreter, but this has been a nightmare.
My OS is ubuntu 20.04
The main libraries I need are:
SQLAlchemy
SciPy
gRPC
For grpc I'm using grpclib, and for SciPy I'm installing it using the miniconda docker image.
My final hurdle is installing psycopg2cffi to make SQLAlchemy work, but after a couple of all-nighters I still haven't managed to make this work. I can install it, but when I run I get a SCRAM authentication problem that I've seen others also get.
Is there a pypy docker file someone has already created that has datascience libraries in it? Doesn't seem like it would be something no one has tried to be before..
Here's by dockerfile so far:
FROM conda/miniconda3 as base
# Setp conda env with pypy3 as the interpreter
RUN conda create -c conda-forge -n pypy-env pypy python=3.8 -y
ENV PATH="/usr/local/envs/pypy-env/bin:$PATH"
RUN pypy -m ensurepip
RUN apt-get -y update && \
apt-get -y install build-essential g++ python3-dev libpq-dev
# Install big/annoying libraries first
RUN pip install psycopg2cffi -y
RUN conda install scipy -y
RUN pip install numpy
WORKDIR /home
COPY ./core/requirements/requirements.txt .
COPY ./core/requirements/basic_requirements.txt .
RUN pip install -r ./requirements.txt
FROM python:3.8-slim as final
WORKDIR /home
COPY --from=base /usr/lib/x86_64-linux-gnu/libpq* /usr/lib/x86_64-linux-gnu/
COPY --from=base /usr/local/envs/pypy-env /usr/local/envs/pypy-env
ENV PATH="/usr/local/envs/pypy-env/bin:$PATH"
COPY .env .env
COPY .src/ .

Can't install wheels on docker for numpy

this is my first time running Docker and I am having issues creating the image. This is the code inside my docker file
FROM alpine:latest
ENV PATH /usr/local/bin:$PATH
RUN apk add --no-cache python3 py3-pip
RUN apk add py3-pip && pip3 install --upgrade pip
WORKDIR /backend
COPY . /backend
RUN pip3 install wheel
RUN pip3 install numpy
RUN pip3 --no-cache-dir install -r requirements.txt
Under requirements.txt, I have numpy==1.23.1.
The relevant error codes are
#12 8.606 Building wheel for numpy (pyproject.toml): started
#12 22.30 Building wheel for numpy (pyproject.toml): finished with status 'error'
#12 22.34 ERROR: Could not build wheels for numpy, which is required to install pyproject.toml-based projects
------
executor failed running [/bin/sh -c pip3 install numpy]: exit code: 1
I tried searching for solutions but they mentioned that once you upgraded PIP, things should install fine. In this case, they still do not work well.
Do give any advice!
Try pip3 install --extra-index-url https://alpine-wheels.github.io/index numpy isntead. Does that work? If so, I can explain in an answer
The above comment by FlyingTeller provided a solution for the problem.

How to run jupyter notebook using docker with ubuntu?

I am very new to docker and could not figure out how to search google to answer my question.
I am using windows OS
I've created docker image using
FROM python:3
RUN apt-get update && apt-get install -y python3-pip
COPY requirements.txt .
RUN pip install -r requirements.txt
RUN pip3 install jupyter
RUN useradd -ms /bin/bash demo
USER demo
WORKDIR /home/demo
ENTRYPOINT ["jupyter", "notebook", "--ip=0.0.0.0"]
and it worked fine. Now I've tried to create it again but with different libraries in requirements.txt it fails to build, it outputs ERROR: Could not find a version that satisfies requirement apturl==0.5.2. When I search what apturl is, I think we need ubuntu OS to install it.
So my question is how do you create a jupyter notebook server using docker with ubuntu libraries? (I am using Windows OS). Thanks!
try upgrading pip.
RUN pip install -U pip
RUN pip3 install -r requirements.txt

Docker multistage build

My dockerfile looks as below :
FROM python:2.7 as builder
RUN pip install pika
RUN pip install requests
RUN pip install simplejson
RUN pip install datetime
RUN pip install grequests
RUN pip install urllib
RUN pip install pandas
COPY Action.py ./Action.py
COPY UtilFunctions.py ./UtilFunctions.py
WORKDIR /app
COPY . .
FROM apline
WORKDIR /app
COPY --from=builder /app /app
CMD [ "python","-u","./Action.py" ]
While building -> sudo docker build --rm -t rule1-test .
Gives following error ->
Step 1 : FROM python:2.7 as builder
Error parsing reference: "python:2.7 as builder" is not a valid repository/tag
Docker version is as below :
Docker version 1.12.6, build 88a4867/1.12.6
Is multistage not supported on this version
I have installed docker on centos machine using
yum install docker
Multi-stage builds are a new feature in Docker 17.05, so you have to update your Docker version to 17.05 or a newer version.

pip cannot install websocket-server python packge

I am inside my docker container, which is running centos6.6.1, and cannot seem to install the python package websocket-server.
pip install websocket-server
Could not find a version that satisfies the requirement websocket-server (from versions: )
I managed to get around this issue with the following command:
pip install git+http://github.com/Pithikos/python-websocket-server
but I don't like having to clone the repo in order to install the package. Any ideas how I can avoid this work around and get the first pip install to work?
I have the same problem with python package influxdb!
First what You need to do inside docker is upgrade pip and setuptools packages:
pip install -U setuptools pip
Do it inside virtualenv (if You use it).

Resources