Kivy cannot be installed on Ubuntu 18.04 with Python 3.7.2 - kivy

I have followed the instructions on official website of kivy.org to install kivy on my system. But when I type
from kivy.app import App
its showing "no module named 'kivy' ".
I am using ubuntu 18.04 with Python 3.7.2 installed.
Added ppa:
$ sudo add-apt-repository ppa:kivy-team/kivy
Updated package list using your package manager:
$ sudo apt-get update
Install Kivy:
$ sudo apt-get install python3-kivy
Dependencies with legacy PyGame:
sudo apt-get install -y \
python-pip \
build-essential \
mercurial \
git \
python3 \
python3-dev \
ffmpeg \
libsdl-image1.2-dev \
libsdl-mixer1.2-dev \
libsdl-ttf2.0-dev \
libsmpeg-dev \
libsdl1.2-dev \
libportmidi-dev \
libswscale-dev \
libavformat-dev \
libavcodec-dev \
zlib1g-dev
Are there anything else that I need to do? Please help.

Related

GCC compilation within docker with "-j"

I got strange errors while compiling my project within the docker container when I am using -j option of make.
The errors look like this:
/root/projects/obj/linux_debug/src/myos_make/libmyos.a: error adding symbols: Cannot allocate memory
/usr/protobuf-3.9.2/lib/libprotobuf.a: error adding symbols: Bad address
Compiling the same project inside the container without -j and outside the container with -j passes ok.
The Dockerfile :
#
# This docker must be built from projects/src folder as context
#
FROM ubuntu:18.04 as base
# copy the dockerfile to make it possible to keep track of the cntent of the image
COPY ./docker_build/docker_files/Dockerfile.ubuntu18.04-builder $HOME/.
# Disable Prompt During Packages Installation
ARG DEBIAN_FRONTEND=noninteractive
# Update Ubuntu Software repository
RUN apt update -y && apt upgrade -y
# Install base utils
RUN apt install -y \
nano \
wget \
sudo \
curl \
&& apt clean -y
# Install additional packages needed for build.
RUN apt install -y \
nasm \
pkg-config \
bc \
python \
python3 \
python3-pip \
sshpass \
libapr1 \
libapr1-dev \
&& apt clean -y
RUN apt install -y \
rpm \
libaio-dev \
libnuma-dev \
numactl \
valgrind \
openssl \
libssl-dev \
ldap-utils \
libldap2-dev \
libncurses5-dev \
libncursesw5-dev \
uuid-dev \
ncurses-base \
expat \
libfuse-dev \
cmake \
build-essential \
autotools-dev \
autoconf \
automake \
doxygen \
linux-headers-4.15.0-173-generic \
g++-multilib \
lib32z1-dev \
libasan4 \
software-properties-common \
libtool \
unzip \
xsltproc \
&& apt clean -y
RUN ln -s /usr/bin/doxygen /bin/doxygen
# install GCC compiler
RUN add-apt-repository ppa:ubuntu-toolchain-r/test -y \
&& apt update -y\
&& apt install gcc-10 -y \
&& apt install g++-10 -y \
&& apt clean -y && \
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 60 --slave /usr/bin/g++ g++ /usr/bin/g++-10 && \
update-alternatives --config gcc
RUN curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py && \
python get-pip.py
RUN ln -sf /usr/local/bin/pip2 /usr/bin/pip
RUN pip install \
pyyaml \
jinja2 \
gcovr
FROM base as env-prepare
COPY external/protobuf /protobuf
RUN cd protobuf && ./build_proto.sh
FROM base as builder
COPY --from=env-prepare /usr/protobuf-3.9.2/ /usr/protobuf-3.9.2/
COPY --from=env-prepare /usr/protobuf-c-1.3.2/ /usr/protobuf-c-1.3.2/
COPY docker_build/docker-image-release /etc/docker-image-release
ARG UID=1000
USER ${UID}
# This entrypoint is to make everything run inside bash, so the devtools script will alway run before the command
ENTRYPOINT [ "/bin/bash", "-c" ]

Docker openCV installation Issues

I'm currently trying to run an application using Docker but get the following error message when I start the application:
error while loading shared libraries: libopencv_highgui.so.4.4: cannot open shared object file: No such file or directory
I assume that something is going wrong in the docker file and that the installation is not complete or correct. Therefore I have added the section about OpenCV at the end of the post.
Did I miss an important step or an error in the dockerfile?
FROM nvidia/cuda:10.2-devel-ubuntu18.04 as TOOLKITS
RUN apt-get update && apt-get install -y apt-utils
# Install additional packages
RUN apt-get install -y \
build-essential \
bzip2 \
checkinstall \
cmake \
curl \
gcc \
gfortran \
git \
pkg-config \
python3-pip \
python3-dev \
python3-numpy \
nano \
openexr \
unzip \
wget \
yasm
FROM TOOLKITS as GIT_PULLS
WORKDIR /
RUN git clone https://github.com/opencv/opencv.git
RUN git clone https://github.com/opencv/opencv_contrib.git
FROM GIT_PULLS as OPENCV_PREPERATION
RUN apt-get install -y \
libgtk-3-dev \
libavcodec-dev \
libavformat-dev \
libswscale-dev \
libv4l-dev \
libxvidcore-dev \
libx264-dev \
libjpeg-dev \
libpng-dev \
libtiff-dev \
libatlas-base-dev \
libtbb2 \
libtbb-dev \
libdc1394-22-dev
FROM OPENCV_PREPERATION as OPENCV_CMAKE
WORKDIR /
RUN mkdir /opencv/build
WORKDIR /opencv/build
RUN cmake \
-DCMAKE_BUILD_TYPE=RELEASE \
-DCMAKE_INSTALL_PREFIX=/usr/local \
-DINSTALL_C_EXAMPLES=ON \
-DINSTALL_PYTHON_EXAMPLES=ON \
-DWITH_TBB=ON \
-DWITH_V4L=ON \
-DOPENCV_GENERATE_PKGCONFIG=ON \
-DWITH_OPENGL=ON \
-DOPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules \
-DOPENCV_PC_FILE_NAME=opencv.pc \
-DBUILD_EXAMPLES=ON ..
FROM OPENCV_CMAKE as BUILD_OPENCV_MAKE
RUN make -j $(nproc)
RUN make install
FROM TOOLKITS
COPY --from=XXX /opencv /opencv
COPY --from=XXX /opencv_contrib /opencv_contrib
I was facing the same issue before when installing OpenCV in Docker with Python image. You probably don't need this much dependencies but it's an option. I will have a lightweight version that fits my case. Please give a try for the following code:
Heavy-loaded version:
FROM python:3.7
RUN apt-get update \
&& apt-get install -y \
build-essential \
cmake \
git \
wget \
unzip \
yasm \
pkg-config \
libswscale-dev \
libtbb2 \
libtbb-dev \
libjpeg-dev \
libpng-dev \
libtiff-dev \
libavformat-dev \
libpq-dev \
&& rm -rf /var/lib/apt/lists/*
RUN pip install numpy
WORKDIR /
ENV OPENCV_VERSION="4.1.1"
# install opencv-python from its source
RUN wget https://github.com/opencv/opencv/archive/${OPENCV_VERSION}.zip \
&& unzip ${OPENCV_VERSION}.zip \
&& mkdir /opencv-${OPENCV_VERSION}/cmake_binary \
&& cd /opencv-${OPENCV_VERSION}/cmake_binary \
&& cmake -DBUILD_TIFF=ON \
-DBUILD_opencv_java=OFF \
-DWITH_CUDA=OFF \
-DWITH_OPENGL=ON \
-DWITH_OPENCL=ON \
-DWITH_IPP=ON \
-DWITH_TBB=ON \
-DWITH_EIGEN=ON \
-DWITH_V4L=ON \
-DBUILD_TESTS=OFF \
-DBUILD_PERF_TESTS=OFF \
-DCMAKE_BUILD_TYPE=RELEASE \
-DCMAKE_INSTALL_PREFIX=$(python3.7 -c "import sys; print(sys.prefix)") \
-DPYTHON_EXECUTABLE=$(which python3.7) \
-DPYTHON_INCLUDE_DIR=$(python3.7 -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())") \
-DPYTHON_PACKAGES_PATH=$(python3.7 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())") \
.. \
&& make install \
&& rm /${OPENCV_VERSION}.zip \
&& rm -r /opencv-${OPENCV_VERSION}
RUN ln -s \
/usr/local/python/cv2/python-3.7/cv2.cpython-37m-x86_64-linux-gnu.so \
/usr/local/lib/python3.7/site-packages/cv2.so
RUN apt-get --fix-missing update && apt-get --fix-broken install && apt-get install -y poppler-utils && apt-get install -y tesseract-ocr && \
apt-get install -y libtesseract-dev && apt-get install -y libleptonica-dev && ldconfig && apt install -y libsm6 libxext6 && apt install -y python-opencv
Lightweight version:
FROM python:3.7
RUN apt-get update -y
RUN apt-update && apt install -y libsm6 libxext6
For my case, I ended up using the heavy-loaded version just to save some hassle and both versions should work fine. For your reference, please also see this link and thanks to Neo Anderson's great help.
I also had lots of issues in this process, and found this repository:
https://github.com/janza/docker-python3-opencv
Clone or download this and add the additional dependencies and files according to your requirement.
apt-get update -y
apt install -y libsm6 libxext6
apt update
pip install pyglview
apt install -y libgl1-mesa-glx

the command ... returned a non-zero code 100 docker

I'm trying to install OpenVino on my Raspberry using Docker.
I have this Dockerfile:
FROM raspbian/stretch
ARG INSTALL_DIR="/opt/intel/inference_engine_vpu_arm"
RUN apt-get -y update \
&& DEBIAN_FRONTEND=noninteractive && apt-get -y upgrade && apt-get autoremove && \
apt-get install -y \
apt-transport-https \
build-essential \
cmake \
cpio \
lsb-release \
pciutils \
python3.5 \
python3.5-dev \
python3-pip \
python3-setuptools \
ffmpeg \
libjpeg-dev \
libtiff5-dev \
libjasper-dev \
libpng12-dev \
libavcodec-dev \
libavformat-dev \
libswscale-dev \
libv4l-dev \
libxvidcore-dev \
libx264-dev \
libgtk2.0-dev \
libgtk-3-dev \
libatlas-base-dev \
gfortran \
libgstreamer1.0-0 \
libgstreamer-plugins-base1.0-0
RUN usermod -a -G users "$(whoami)"
COPY inference_engine_vpu_arm $INSTALL_DIR
RUN sed -i "s|<INSTALLDIR>|$INSTALL_DIR|" $INSTALL_DIR/bin/setupvars.sh && \
echo "source $INSTALL_DIR/bin/setupvars.sh" >> $HOME/.bashrc
RUN ["/bin/bash", "-c", "source $INSTALL_DIR/bin/setupvars.sh && /bin/bash $INSTALL_DIR/install_dependencies/install_NCS_udev_rules.sh"]
RUN pip3 install numpy
RUN apt autoremove -y && \
rm -rf /var/lib/apt/lists/*
CMD ["/bin/bash"]
But I have this error when I try to build:
E: Unable to correct problems, you have held broken packages.
The command '/bin/sh -c apt-get -y update..... returned a non-zero code: 100
Do you have any idea?
Thanks
After a some google search it seems the error happens because the apt daemon is not able to connect to the configured repositories. This is likely since the base image was not updated for a while as i can see on docker hub.
If you not familiar with the available repositories you can generate them easily with online tools such as: https://debgen.simplylinux.ch/index.php?generate
You can put them into the docker image with a simple COPY command like
COPY sources.list /etc/apt/sources.list
where the first argument refers to a local file, the second to the docker image

I need some guidance with Docker returning a non-zero code 100

I'm trying to run a Docker build that's worked before, only now I'm on Ubuntu instead of Mac OSX.
I've tried changing the code, adding -y after apt-get update, commenting out part of code, but still get the same result.
This is my Docker file:
FROM nodesource/trusty:5.6.0
RUN locale-gen en_US.UTF-8 && \
apt-get update && \
apt-get upgrade -y && \
apt-get install -y software-properties-common
RUN LC_ALL=en_US.UTF-8 add-apt-repository -y ppa:ondrej/php && \
apt-get update && \
apt-get install -y gcc \
nginx \
php5.6 \
php5.6-common \
php5.6-cli \
php5.6-cgi \
php5.6-fpm \
php5.6-apcu \
php5.6-dev \
php5.6-mysqlnd \
php5.6-gd \
php5.6-gmp \
php5.6-imap \
php5.6-curl \
curl \
libsqlite3-dev \
ruby1.9.1-dev \
sqlite3 \
unzip \
php-pear \
php5.6-xsl \
php5.6-sqlite \
openssh-client \
php5.6-mcrypt \
php5.6-mbstring
RUN ln -sfn /usr/bin/php5.6 /usr/bin/php
RUN /usr/bin/curl -sS https://getcomposer.org/installer | /usr/bin/php -- --install-dir=/usr/bin --filename=composer --version=1.0.0
RUN npm install -g gulp bower
This is the error:
Removing intermediate container 07a0c4bb3da2
The command '/bin/sh -c LC_ALL=en_US.UTF-8 add-apt-repository -y ppa:ondrej/php && apt-get update -y && apt-get install -y gcc nginx php5.6 php5.6-common php5.6-cli php5.6-cgi php5.6-fpm php5.6-apcu php5.6-dev php5.6-mysqlnd php5.6-gd php5.6-gmp php5.6-imap php5.6-curl curl libsqlite3-dev ruby1.9.1-dev sqlite3 unzip php-pear php5.6-xsl php5.6-sqlite openssh-client php5.6-mcrypt php5.6-mbstring' returned a non-zero code: 100```
It appears that the PPA ppa:ondrej/php no longer supports Ubuntu Trusty and no longer contains any packages for it (which makes sense, as Trusty became end-of-life in April 2019). You need to update your Docker image to be based on a more recent Ubuntu version, such as Bionic, currently the most recent LTS version.

Install dependencies of PHP extensions

I've started learning Docker and now I'm building my own container with PHP7 and Apache.
I have to enable some PHP extensions, but I would like to know how do you know what packages(dependencies) should be installed before installing the extension.
This is my Dockerfile at the moment:
FROM php:7.0-apache
RUN apt-get update && apt-get install -y libpng-dev
RUN docker-php-ext-install gd
In this case, to enable gd extension, I googled the error returned on building step and I found that it requires the package libpng-dev, but it's annoying to do these steps for every single extension that I want to install.
How do you manage this kind of problem?
The process is indeed annoying and very much something that could be done by a computer. Luckily someone wrote a script to do exactly that: docker php extension installer
Your example can then be written as:
FROM php:7.0-apache
#get the script
ADD https://raw.githubusercontent.com/mlocati/docker-php-extension-installer/master/install-php-extensions /usr/local/bin/
#install the script
RUN chmod uga+x /usr/local/bin/install-php-extensions && sync
#run the script
RUN install-php-extensions gd
Here is what i do, install php and some php extensions and tools. Things that I usual need...
# Add the "PHP 7" ppa
RUN add-apt-repository -y \
ppa:ondrej/php
#Install PHP-CLI 7, some PHP extentions and some useful Tools with apt
RUN apt-get update && apt-get install -y --force-yes \
php7.0-cli \
php7.0-common \
php7.0-curl \
php7.0-json \
php7.0-xml \
php7.0-mbstring \
php7.0-mcrypt \
php7.0-mysql \
php7.0-pgsql \
php7.0-sqlite \
php7.0-sqlite3 \
php7.0-zip \
php7.0-memcached \
php7.0-gd \
php7.0-fpm \
php7.0-xdebug \
php7.1-bcmath \
php7.1-intl \
php7.0-dev \
libcurl4-openssl-dev \
libedit-dev \
libssl-dev \
libxml2-dev \
xz-utils \
sqlite3 \
libsqlite3-dev \
git \
curl \
vim \
nano \
net-tools \
pkg-config \
iputils-ping
# remove load xdebug extension (only load on phpunit command)
RUN sed -i 's/^/;/g' /etc/php/7.0/cli/conf.d/20-xdebug.ini
Creating your own Dockerfiles involves trial and error - or building on and tweaking the work of others.
If you haven't already found this, take a look: https://hub.docker.com/r/chialab/php/
This image appears to have extensions added on top of the official base image. If you don't need all of the extensions in this image, you could look at the source of this image and tweak it to your liking.

Resources