grpc __strdup() not found in python3.6-alpine arm - python-3.6

When using google libraries that require grpc we are running into this error.
The environment is docker arm python3.6-alpine with ...
grpcio>=1.33.2
google-cloud-pubsub>=2.1.0
google-api-python-client>=1.12.5
google-auth>=1.23.0
In our dockerfile we are installing
WORKDIR /tmp
RUN set -ex \
&& apk add --no-cache --virtual .build-deps \
cmake \
curl \
g++ \
gcc \
jpeg-dev \
libffi-dev \
libjpeg \
make \
musl-dev \
postgresql-dev \
python3-dev \
tzdata \
zlib \
zlib-dev
... later on
RUN pip3 install -r requirements.txt
and I even added libc6-compat and tried that.
also I added alpines build-base and alpine-sdk to try to cover all the bases.
Traceback (most recent call last):
File "/usr/local/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/local/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/usr/local/lib/python3.6/site-packages/...", line 48, in <module>
from ... import...
File "/usr/local/lib/python3.6/site-packages/...", line 13, in <module>
from google.cloud import pubsub_v1
File "/usr/local/lib/python3.6/site-packages/google/cloud/pubsub_v1/__init__.py", line 17, in <module>
from google.cloud.pubsub_v1 import types
File "/usr/local/lib/python3.6/site-packages/google/cloud/pubsub_v1/types.py", line 36, in <module>
from google.pubsub_v1.types import pubsub as pubsub_gapic_types
File "/usr/local/lib/python3.6/site-packages/google/pubsub_v1/__init__.py", line 18, in <module>
from .services.publisher import PublisherClient
File "/usr/local/lib/python3.6/site-packages/google/pubsub_v1/services/publisher/__init__.py", line 18, in <module>
from .client import PublisherClient
File "/usr/local/lib/python3.6/site-packages/google/pubsub_v1/services/publisher/client.py", line 27, in <module>
from google.api_core import gapic_v1 # type: ignore
File "/usr/local/lib/python3.6/site-packages/google/api_core/gapic_v1/__init__.py", line 18, in <module>
from google.api_core.gapic_v1 import config
File "/usr/local/lib/python3.6/site-packages/google/api_core/gapic_v1/config.py", line 23, in <module>
import grpc
File "/usr/local/lib/python3.6/site-packages/grpc/__init__.py", line 23, in <module>
from grpc._cython import cygrpc as _cygrpc
ImportError: Error relocating /usr/local/lib/python3.6/site-packages/grpc/_cython/cygrpc.cpython-36m-arm-linux-gnueabihf.so: __strdup: symbol not found
This works fine in x64 alpine. So far we are only having issue in the arm version.
Any idea how to resolve this?

I switched to FROM --platform=linux/arm/v7 python:3.8-alpine and added some deps
RUN set -ex \
&& apk add --no-cache --virtual .build-deps \
cmake \
curl \
g++ \
gcc \
jpeg-dev \
libffi-dev \
libjpeg \
make \
musl-dev \
musl \
postgresql-dev \
python3-dev \
tzdata \
zlib \
zlib-dev \
libc6-compat \
libc-dev \
alpine-sdk \
build-base \
linux-headers \
cython \
c-ares-dev \
gdbm \
libffi
Now it works.
It seems that as ARM becomes more mainstream there will be better support and such.
Multiple times now we have had no issues building on x86_64 but lots of issues with the ARM builds (mostly with the google libraries).
I still don't know what caused the original problem. I only solved this by chance. I kept trying different things.
I found that alpine has py3-grpcio and py3-google-api-core adn others available as an apk.
So I added those.
On inspection of the package I saw it is v1.17.0
py3-google-api-core: Fetching https://distfiles.alpinelinux.org/distfiles/google-api-core-1.17.0.tar.gz
If you look in the google source for the python pubsub you can see in versions <= 1.4.2 (I think):
dependencies = [
# google-api-core[grpc] 1.17.0 causes problems, thus restricting its
# version until the issue gets fixed.
# https://github.com/googleapis/python-pubsub/issues/74
"google-api-core[grpc] >= 1.14.0, < 1.17.0",
"grpc-google-iam-v1 >= 0.12.3, < 0.13dev",
'enum34; python_version < "3.4"',
]
Notice the first comment.
"Of course", I thought. Why would it be working versions.
But in the alpine package source I noticed that it is using python3.8 so that is why I switched our dockerfile from python3.6 to python3.8. So I guess ultimately even though I did not end up using the alpine py3-* packages they did help lead me to a solution :)

Related

train_dreambooth.py: error: the following arguments are required:

I'm trying to fit train SD 1.5 with DreamBooth with prior preservation following the steps from https://github.com/huggingface/diffusers/tree/main/examples/dreambooth
But i'm receiving an error:
train_dreambooth.py: error: the following arguments are required: --pretrained_model_name_or_path, --instance_data_dir, --instance_prompt
Traceback (most recent call last):
File "/home/myuser/miniconda3/envs/dbooth/bin/accelerate", line 10, in <module>
sys.exit(main())
File "/home/myuser/miniconda3/envs/dbooth/lib/python3.7/site-packages/accelerate/commands/accelerate_cli.py", line 45, in main
args.func(args)
File "/home/myuser/miniconda3/envs/dbooth/lib/python3.7/site-packages/accelerate/commands/launch.py", line 1104, in launch_command
simple_launcher(args)
File "/home/myuser/miniconda3/envs/dbooth/lib/python3.7/site-packages/accelerate/commands/launch.py", line 567, in simple_launcher
raise subprocess.CalledProcessError(returncode=process.returncode, cmd=cmd)
subprocess.CalledProcessError: Command '['/home/myuser/miniconda3/envs/dbooth/bin/python3.7', 'train_dreambooth.py']' returned non-zero exit status 2.
This is my script.sh for make the training:
#!/bin/bash
export MODEL_NAME="v1-5-pruned.ckpt"
export INSTANCE_DIR="retocadas"
export CLASS_DIR="person_ddim"
export OUTPUT_DIR="salida"
accelerate launch train_dreambooth.py \
--pretrained_model_name_or_path=$MODEL_NAME \
--instance_data_dir=$INSTANCE_DIR \
--class_data_dir=$CLASS_DIR \
--output_dir=$OUTPUT_DIR \
--with_prior_preservation --prior_loss_weight=1.0 \
--instance_prompt="AnUniqueExample" \
--class_prompt="person" \
--resolution=512 \
--train_batch_size=1 \
--gradient_accumulation_steps=2 --gradient_checkpointing \
--use_8bit_adam \
--learning_rate=5e-6 \
--lr_scheduler="constant" \
--lr_warmup_steps=0 \
--num_class_images=200 \
--max_train_steps=800
All files and paths indicated in the header are on the same path as the .sh file.
Someone can help me to find the problem?
It doesn't want a CKPT file it wants a directory with all the components of the model. Go to hugging face and download the models files into a folder and point the training script to that folder.

proto grror when generating gateway protoc-gen-grpc-gateway: program not found or is not executable

I have found similar posts but they are rather old and they sadly did not solve my issue.
I am trying to add a Gateway for my GoLang GRPC services
PROJ_PATH=${CURDIR}
.PHONY: proto
proto: ## Generate protobuf code
# Compile proto files inside the project.
protoc api.proto --proto_path=${PROJ_PATH}/proto --go_out=. --go-grpc_out=. \
--grpc-gateway_out . \
--grpc-gateway_opt generate_unbound_methods=true \
--openapiv2_out . \
--openapiv2_opt logtostderr=true \
--openapiv2_opt generate_unbound_methods=true
I add the two dependencies
go get github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway
go get github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2
But I still get his error
protoc-gen-grpc-gateway: program not found or is not executable
Please specify a program using absolute path or make sure the program is available in your PATH system variable
--grpc-gateway_out: protoc-gen-grpc-gateway: Plugin failed with status code 1.
make: *** [proto] Error 1
I had to remove the import and gateway options in the GRPC file because this error so it looks like I have the wrong plugin but reading here tells me otherwise.
google/api/annotations.proto: File not found.
api.proto:5:1: Import "google/api/annotations.proto" was not found or had errors.
make: *** [proto] Error 1
syntax = "proto3";
option go_package = "pkg/api";
import "google/api/annotations.proto"; <---- had to remove
service ApiService {
rpc Test(TestRequest) returns (TestResponse){
option (google.api.http) = { <---- had to remove
get: "/v1/test"
body: "*"
};
}
}
Any advice would be greatly appreciated.
---- solved with ------
go install \
github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway#latest \
github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2#latest
then add the path to the proto command
--plugin=protoc-gen-grpc-gateway=${GOPATH}/bin/protoc-gen-grpc-gateway \
full command...
protoc api.proto --proto_path=${PROJ_PATH}/proto --go_out=. --go-grpc_out=. \
--grpc-gateway_out . \
--grpc-gateway_opt generate_unbound_methods=true \
--plugin=protoc-gen-grpc-gateway=${GOPATH}/bin/protoc-gen-grpc-gateway \
--openapiv2_out . \
--openapiv2_opt logtostderr=true \
--openapiv2_opt generate_unbound_methods=true
I had to install the binary like so
go install \
github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway#latest \
github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2#latest
Then update the proto command with the path.
--plugin=protoc-gen-grpc-gateway=${GOPATH}/bin/protoc-gen-grpc-gateway \
Full proto command
PROJ_PATH=${CURDIR}
.PHONY: proto
proto: ## Generate protobuf code
# Compile proto files inside the project.
protoc api.proto --proto_path=${PROJ_PATH}/proto --go_out=. --go-grpc_out=. \
--grpc-gateway_out . \
--grpc-gateway_opt generate_unbound_methods=true \
--plugin=protoc-gen-grpc-gateway=${GOPATH}/bin/protoc-gen-grpc-gateway \
--openapiv2_out . \
--openapiv2_opt logtostderr=true \
--openapiv2_opt generate_unbound_methods=true

Can I completely customize the flags for ./configure in a SPEC file?

My rpmbuild log tells me all the flags used when calling configure:
./configure --build=x86_64-redhat-linux-gnu --host=x86_64-redhat-linux-gnu \
--program-prefix= \
--disable-dependency-tracking \
--prefix=/usr \
--exec-prefix=/usr \
--bindir=/usr/bin \
--sbindir=/usr/sbin \
--sysconfdir=/etc \
--datadir=/usr/share \
--includedir=/usr/include \
--libdir=/usr/lib64 \
--libexecdir=/usr/libexec \
--localstatedir=/var \
--sharedstatedir=/var/lib \
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--prefix=/opt/custom/SENSOR/Qt-5.15.2 \
--confirm-license \
--opensource
My problem is that the 'build' and 'host' flags (plus several others) are unknown commands for this particular configure script. How can I take complete control of the call to configure in my SPEC file? It's obviously not enough to add new flags to the %configure scriptlet, I need to remove flags that rpmbuild is adding by default.
It looks like the answer is to call configure directly instead of using the scriptlet. I.e., replace %configure with:
./configure --prefix=/opt/custom/SENSOR -confirm-license -opensource

Yocto toolchain installation with qscxmlc support

Hej Folks.
I try to implement a yocto and QT5 based project for a variscite board with QtSCXML support. I got everything run on QtCreator for my Hostmachine (Ubuntu 64-bit, 18.04), so I know my project has to be kinda right. For the yocto part, I used the installtion guide by variscite itself (Ref_1 and Ref_2). As targetmachine I use the VAR-SOM-6UL.
So my toolchain building process is the following:
$ sudo apt-get install gawk wget git diffstat unzip texinfo gcc-multilib \
build-essential chrpath socat cpio python python3 python3-pip python3-pexpect \
xz-utils debianutils iputils-ping libsdl1.2-dev xterm
$ sudo apt-get install autoconf libtool libglib2.0-dev libarchive-dev python-git \
sed cvs subversion coreutils texi2html docbook-utils python-pysqlite2 \
help2man make gcc g++ desktop-file-utils libgl1-mesa-dev libglu1-mesa-dev \
mercurial automake groff curl lzop asciidoc u-boot-tools dos2unix mtd-utils pv \
libncurses5 libncurses5-dev libncursesw5-dev libelf-dev zlib1g-dev bc rename
$ mkdir ~/bin (this step may not be needed if the bin folder already exists)
$ curl https://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
$ export PATH=~/bin:$PATH
$ mkdir ~/var-fslc-yocto && cd ~/var-fslc-yocto
$ repo init -u https://github.com/varigit/variscite-bsp-platform.git -b dunfell
$ repo sync -j$(nproc)
$ MACHINE=imx6ul-var-dart DISTRO=fslc-x11 . setup-environment build_x11
Now I change the local.conf file in ~/var-fslc-yocto/build_x11/conf/. As default the connectivity check fails, so a diffrent url is deposited. The virtualization is only activated to suppress warning messages. To "include" the qtscxml, its append to the IMAGE as the nativesdk-qtscxml is append for the host toolchain.
But see for yourself:
MACHINE ??= 'imx6ul-var-dart'
DISTRO ?= 'fslc-x11'
PACKAGE_CLASSES ?= 'package_rpm'
EXTRA_IMAGE_FEATURES ?= "debug-tweaks"
USER_CLASSES ?= "buildstats image-mklibs image-prelink"
PATCHRESOLVE = "noop"
BB_DISKMON_DIRS ??= "\
STOPTASKS,${TMPDIR},1G,100K \
STOPTASKS,${DL_DIR},1G,100K \
STOPTASKS,${SSTATE_DIR},1G,100K \
STOPTASKS,/tmp,100M,100K \
ABORT,${TMPDIR},100M,1K \
ABORT,${DL_DIR},100M,1K \
ABORT,${SSTATE_DIR},100M,1K \
ABORT,/tmp,10M,1K"
PACKAGECONFIG_append_pn-qemu-system-native = " sdl"
CONF_VERSION = "1"
DL_DIR ?= "${BSPDIR}/downloads/"
ACCEPT_FSL_EULA = "1"
#check connectivity using google
CONNECTIVITY_CHECK_URIS = "https://www.google.com/"
#enable virtualization to disable warning
DISTRO_FEATURES_append = " virtualization"
#image extra
EXTRA_IMAGE_FEATURES = " \
qtcreator-debug \
ssh-server-openssh \
debug-tweaks \
tools-debug \
"
#use systemd
DISTRO_FEATURES_append = " systemd"
DISTRO_FEATURES_BACKFILL_CONSIDERED_append = " sysvinit"
VIRTUAL-RUNTIME_init_manager = "systemd"
VIRTUAL-RUNTIME_initscripts = ""
IMX_DEFAULT_DISTRO_FEATURES_append = " systemd"
#image install
IMAGE_INSTALL_append = " \
qtscxml \
"
#toolchain host
TOOLCHAIN_HOST_TASK += "qtscxml \
nativesdk-qtscxml \
"
Now comes the happy building part and the Problems beginn!
I will just type what i'm doing:
$ bitbake -c populate_sdk fsl-image-qt5
$ . ~/var-fslc-yocto/build_x11/tmp/deploy/sdk/fslc-x11-glibc-x86_64-fsl-image-qt5-cortexa7t2hf-neon-imx6ul-var-dart-toolchain-3.1.sh
$ . /opt/fslc-x11/3.1/environment-setup-cortexa7t2hf-neon-fslc-linux-gnueabi
$ cd ~/TestProject
$ mkdir build
$ qmake -makefile -o build/MakeFile test.pro
$ make -C build/
And now the error message i receive ..
make: Entering directory '/home/yocto/TestProject/build'
make: *** No rule to make target '/opt/fslc-x11/3.1/sysroots/x86_64-fslcsdk-linux/usr/bin/qscxmlc', needed by 'custom_statemachine.h'. Stop.
make: Leaving directory '/home/yocto/TestProject/build'
(custom_statemachine.h isn't written by me, I only generated custom_statemachine.scxml)
Do i missed something? Why is Qts SCXML Compiler qscxmlc missing?
Thanks to everyone how read this far, thanks for every suggestions and sorry for every grammatical mistake.

How to solve the CSScomb error in PhpStorm?

I wanted to install on PhpStorm 8.0.1 CSScomb.js
I do everything as it is written on a page on github. Established CSScomb globally and locally (so sure). Prescribed ways and...
...run and out this error:
Error running CSScomb: Can not run program "C: \ Users \ Kanat \
AppData \ Roaming \ npm \ node_modules \ csscomb \ bin \ csscomb" (in
directory "D: \ OpenServer \ domains \ LPDevplate \ src \ scss \
modules"): CreateProcess error = 193% 1 is not a valid Win32
application
Someone faced with this error and help solve it?
the same error "Error running 'CSScomb': Cannot run program"

Resources