Error while installing numpy in alpine image - numpy

Error :
ERROR: Command "/usr/local/bin/python -u -c 'import setuptools, tokenize;file='"'"'/tmp/pip-install-2u_c2pqi/numpy/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /tmp/pip-record-gfsn5nsl/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-2u_c2pqi/numpy/
This is the error I am getting in my travis build of my dockerfile.
RUN echo "http://dl-8.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories \
24 && apk --no-cache --update-cache add postgresql-dev musl-dev linux-headers g++ gfortran py-pip build-base bash libpng-dev openblas-dev w get freetype-dev gcc \
25 && ln -s /usr/include/locale.h /usr/include/xlocale.h \
26 && pip3 install setuptools wheel \
27 && pip3 install numpy pyyaml`
I am installing numpy using the above commands

Some issues have been found in your Dockerfile:
python3-dev and py3-pip packages should be installed to install numpy.
g++ already has gcc and musl-dev in dependencies, so we can simplify a package list.
The final Dockerfile is:
FROM alpine:latest
RUN echo "http://dl-8.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories \
&& apk --no-cache --update-cache add postgresql-dev g++ linux-headers gfortran build-base bash libpng-dev openblas-dev wget freetype-dev python3-dev py3-pip \
&& ln -s /usr/include/locale.h /usr/include/xlocale.h \
&& pip3 install setuptools wheel \
&& pip3 install numpy pyyaml

Related

Build tensorflow: name 'json' is not defined

When building tensorflow from sources with bazel I have got error:
io_bazel_rules_go/go/private/sdk.bzl:337:12: name 'json' is not defined
How to add the dependency or import json library?
The code looks like python source, so I have tried to import json, which does not work.
clone tensorflow repo:
git clone https://github.com/tensorflow/tensorflow.git
configure
PYTHON_VERSION=python3.10
PYTHON_BIN_PATH=$(which $PYTHON_VERSION) \
PYTHON_LIB_PATH=$($PYTHON_VERSION -c "import pip; print(pip.__path__[0].rstrip('/pip'))") \
TF_NEED_CUDA=0 \
TF_NEED_ROCM=0 \
TF_DOWNLOAD_CLANG=0 \
CC_OPT_FLAGS="-march=native -Wno-sign-compare -mnoavx" \
TF_SET_ANDROID_WORKSPACE=0 \
TF_ENABLE_XLA=1 \
TF_NEED_OPENCL_SYCL=0 \
TF_NEED_MPI=0 \
./configure
and build
bazel build
My environment:
Ubuntu 22.04 LTS (all installed packages are up-to-date)
bazel 3.5.1- (#non-git)
tensorflow branch r2.11
As stated above, 3.5 is too old.
sudo dpkg -P bazel-bootstrap
sudo npm install -g #bazel/bazelisk

Call to undefined function Intervention\Image\Gd\imagecreatefromjpeg() Laravel 8 + Docker desktop 4.4.4

This is my docker file:
FROM php:8.0-fpm-buster
# Arguments defined in docker-compose.yml
ARG user
ARG uid
# Install system dependencies
RUN apt-get update && apt-get install -y \
build-essential \
git \
curl \
libpng-dev \
libjpeg-dev \
libfreetype6-dev \
libjpeg62-turbo-dev \
jpegoptim optipng pngquant gifsicle \
libonig-dev \
libxml2-dev \
zip \
sudo \
unzip \
npm \
nodejs \
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install -j$(nproc) gd
# Clear cache
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
# Install PHP extensions
RUN docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd
but I have an error
Call to undefined function Intervention\Image\Gd\imagecreatefromjpeg()
when i try to upload a jpg image.Even I change it to:
docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ --with-gd --with-freetype --with-jpeg \
but I have below error when I build and the above error in Laravel
configure: error: unrecognized options: --with-freetype-dir,
--with-jpeg-dir, --with-gd
------ failed to solve: rpc error: code = Unknown desc = executor failed running [/bin/sh -c apt-get update && apt-get install -y
build-essential git curl libpng-dev libjpeg-dev
libfreetype6-dev libjpeg62-turbo-dev jpegoptim optipng
pngquant gifsicle libonig-dev libxml2-dev zip sudo
unzip npm nodejs && docker-php-ext-configure gd
--with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ --with-gd --with-freetype --with-jpeg && docker-php-ext-install -j$(nproc) gd]: exit code: 1
how can I fix this?
I fix it by enabling the GD lib,
here is my Dockerfile configs:
FROM php:8.0-fpm-buster
# Arguments defined in docker-compose.yml
ARG user
ARG uid
# Install system dependencies
RUN apt-get update && apt-get install -y \
build-essential \
git \
curl \
libpng-dev \
libjpeg-dev \
libfreetype6-dev \
libjpeg62-turbo-dev \
libmcrypt-dev \
libgd-dev \
jpegoptim optipng pngquant gifsicle \
libonig-dev \
libxml2-dev \
zip \
sudo \
unzip \
npm \
nodejs
# Clear cache
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
# Install PHP extensions
RUN docker-php-ext-configure gd --enable-gd --with-freetype --with-jpeg
RUN docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd

How do I install a module (RDKIT) permanently in Colab

How do I install a library permanently in Colab?
I followed the accepted answer from this thread
How do I install a library permanently in Colab?
# first install gcsfuse
%%capture
!echo "deb http://packages.cloud.google.com/apt gcsfuse-bionic main" > /etc/apt/sources.list.d/gcsfuse.list
!curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
!apt update
!apt install gcsfuse
%%writefile /key.json
{
"type": "service_account",
"project_id": "kora-id",
"private_key_id": "xxxxxxx",
"private_key": "-----BEGIN PRIVATE KEY-----\nxxxxxxx==\n-----END PRIVATE KEY-----\n",
"client_email": "colab-7#kora-id.iam.gserviceaccount.com",
"client_id": "100380920993833371482",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/colab-7%40kora-id.iam.gserviceaccount.com"
}
%env GOOGLE_APPLICATION_CREDENTIALS=/key.json
!mkdir /content/my-bucket
!gcsfuse my-bucket /content/my-bucket
import sys
nb_path = '/content/my-bucket'
sys.path.insert(0, nb_path)
# Do this just once
!pip install --target=$nb_path jdc
RDKIT installation I followed https://www.youtube.com/watch?v=ERvUf_lNopo
# Install RDKit. Takes 2-3 minutes
!wget -c https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
!chmod +x Miniconda3-latest-Linux-x86_64.sh
!time bash ./Miniconda3-latest-Linux-x86_64.sh -b -f -p /usr/local
!time conda install -q -y -c anaconda python=3.7
!time conda install -q -y -c conda-forge rdkit
You can use this code, which avoid conda and can install rdkit in 6 seconds
url = 'https://anaconda.org/rdkit/rdkit/2018.09.1.0/download/linux-64/rdkit-2018.09.1.0-py36h71b666b_1.tar.bz2'
!curl -L $url | tar xj lib
!mv lib/python3.6/site-packages/rdkit /usr/local/lib/python3.6/dist-packages/
x86 = '/usr/lib/x86_64-linux-gnu'
!mv lib/*.so.* $x86/
!ln -s $x86/libboost_python3-py36.so.1.65.1 $x86/libboost_python3.so.1.65.1
Update: I made a custom tarball that we can just extract them. Taking only 1.7s to install
!curl -L bit.ly/rdkit-colab | tar xz -C /
You can also use my kora library.
!pip install kora
import kora.install.rdkit

How to install openERP 7.0.1 on centOS 6.5

Can you please give me the steps of how to install openERP 7.0.1 version in my centOS 6.5 version. I was searching for this for quit a while but dint find anything. Can you please help me out ?
#!/bin/sh
# Modified script from Carlos E. Fonseca Zorrilla
# http://forum.openerp.com/forum/topic36094.html
yum -y install wget unzip
rpm -ivh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
rpm -ivh http://yum.pgrpms.org/9.2/redhat/rhel-6-i386/pgdg-centos92-9.2-6.noarch.rpm
yum -y install python-psycopg2 python-lxml PyXML python-setuptools libxslt-python pytz \
python-matplotlib python-babel python-mako python-dateutil python-psycopg2 \
pychart pydot python-reportlab python-devel python-imaging python-vobject \
hippo-canvas-python mx python-gdata python-ldap python-openid \
python-werkzeug python-vatnumber pygtk2 glade3 pydot python-dateutil \
python-matplotlib pygtk2 glade3 pydot python-dateutil python-matplotlib \
python python-devel python-psutil python-docutils make\
automake gcc gcc-c++ kernel-devel byacc flashplugin-nonfree poppler-utils pywebdav\
yum -y install postgresql92-libs postgresql92-server postgresql92
service postgresql-9.2 initdb
chkconfig postgresql-9.2 on
service postgresql-9.2 start
su - postgres -c "createuser --superuser openerp"
cd /tmp
wget http://gdata-python-client.googlecode.com/files/gdata-2.0.17.zip
unzip gdata-2.0.17.zip
rm -rf gdata-2.0.17.zip
cd gdata*
python setup.py install
cd /tmp
adduser openerp
DIR="/var/run/openerp /var/log/openerp"
for NAME in $DIR
do
if [ ! -d $NAME ]; then
mkdir $NAME
chown openerp.openerp $NAME
fi
done
rm -rf openerp*
wget http://nightly.openerp.com/7.0/nightly/src/openerp-7.0-latest.tar.gz
tar -zxvf openerp-7.0-latest.tar.gz --transform 's!^[^/]\+\($\|/\)!openerp\1!'
cd openerp
python setup.py install
rm -rf /usr/local/bin/openerp-server
cp openerp-server /usr/local/bin
cp install/openerp-server.init /etc/init.d/openerp
cp install/openerp-server.conf /etc
chown openerp:openerp /etc/openerp-server.conf
chmod u+x /etc/init.d/openerp
chkconfig openerp on
service openerp start
it's almost same as Ubuntu here you can follow these steps
Install and configure the database server, PostgreSQL
sudo yum install postgresql
Then configure the OpenERP user on postgres:
First change to the postgres user so we have the necessary privileges to configure the database.
sudo su - postgres
Now create a new database user. This is so OpenERP has access rights to connect to PostgreSQL and to create and drop databases. Remember what your choice of password is here; you will need it later on:
createuser --createdb --username postgres --no-createrole --no-superuser --pwprompt openerp Enter password for new role: * Enter it again: *
Finally exit from the postgres user account:
exit
Install the necessary Python libraries for the server
sudo yum install python-dateutil python-docutils python-feedparser python-gdata \ python-jinja2 python-ldap python-libxslt1 python-lxml python-mako python-mock python-openid \ python-psycopg2 python-psutil python-pybabel python-pychart python-pydot python-pyparsing \ python-reportlab python-simplejson python-tz python-unittest2 python-vatnumber python-vobject \ python-webdav python-werkzeug python-xlwt python-yaml python-zsi
and you can also use pip and easy_install to install python packages
Download Openerp Server
and extract the file than run the openerp-server

Simple Hello World in Objective-C with clang and gnustep does not compile

System:
64bit Ubuntu Lucid
GNUStep
clang/LLVM
test.m
#import <Foundation/Foundation.h>
int main(int argc, char * argv[]){
NSLog(#"Hello world!\n");
return 0;
}
compile command line:
clang -fobjc-gc -I /usr/lib/gcc/x86_64-linux-gnu/4.4.3/include -I /usr/include/GNUstep/ -I /usr/lib/gcc/x86_64-linux-gnu/4.4.3/include-fixed/ -L /usr/lib/GNUstep/ -L /usr/lib64/ -fconstant-string-class=NSConstantString -rpath /usr/lib64 -Xlinker -lgnustep-base test.m -o Test
error:
/usr/bin/ld: /usr/lib64//libgnustep-base.so: undefined reference to symbol '__objc_exec_class'
/usr/bin/ld: note: '__objc_exec_class' is defined in DSO /usr/lib64/libobjc.so.2 so try adding it to the linker command line
/usr/lib64/libobjc.so.2: could not read symbols: Invalid operation
clang: error: linker command failed with exit code 1 (use -v to see invocation)
While using GCC, it compiles fine, but clang does not.
On a fresh install of Ubuntu 12.10 I installed the following packages:
$ sudo apt-get install build-essential
$ sudo apt-get install clang
$ sudo apt-get install gnustep
$ sudo apt-get install gnustep-make
$ sudo apt-get install gnustep-devel
$ sudo ln -s /usr/lib/gcc/i686-linux-gnu/4.7/include/objc /usr/local/include/objc
(the final symlink is required to properly locate the objc.h header)
Then I compiled the test.m file as follows:
$ clang -o test test.m -I `gnustep-config --variable=GNUSTEP_SYSTEM_HEADERS` \
-L `gnustep-config --variable=GNUSTEP_SYSTEM_LIBRARIES` \
-lgnustep-base -fconstant-string-class=NSConstantString \
-D_NATIVE_OBJC_EXCEPTIONS \
-lobjc
tux#ubuntu:~/Desktop$ ./test
2012-11-20 11:02:08.184 test[11856] Hello world!
* EDIT
On a fresh 10.04-64bit this allows to compile just fine:
$ sudo apt-get install build-essential
$ sudo apt-get install clang
$ sudo apt-get install gnustep-devel
$ sudo ln -s /usr/lib/gcc/x86_64-linux-gnu/4.4.3/include/objc/ /usr/local/include/objc