Tag Archives: ubuntu

Type error: cannot unpack non Iterable non type object appears when starting Bert server in Ubuntu system

Type error: cannot unpack non Iterable non type object appears when starting Bert server in Ubuntu system

Questions

Enter Bert serving start – model_ dir chinese_ L-12_ H-768_ A-12 -num_ worker 1 -max_ seq_ In the case of len 64, type error: cannot unpack non Iterable non type object is reported

resolvent

    check whether the startup path is correct, – model_ Dir is followed by the downloaded and unzipped corpus model address. The figure below is my path after decompression. You can right-click on the interface and select “open on terminal”

    just re-enter the command. This is the reason for my problem. After re entering the command, no error will be reported
    2. Check your tensorflow version, which is not supported at present. My tensorflow version is 1.15.0. 0

    Finally, it can run without any error

[Solved] Ubuntu18.04 Install pyqt5 error: Command “python setup.py egg_info“ failed with error code 1 in /tmp/pip-build-92

Error in installing pyqt5 on Ubuntu 18.04:
command “Python setup.py egg”_ info” failed with error code 1 in /tmp/pip-build-92ggdywh/PyQt5/

As a result, the version of PIP is too low. The default system version is pip9, so we need to update the PIP version
the update method is as follows:

python3 -m pip install --upgrade pip

Because most of the time, we install python, or apt install Python directly, resulting in the installation of python2.7. If you just want to use a version of python, such as python3, you can uninstall python2. It’s better to uninstall to avoid conflicts.

TypeError: __array__() takes 1 positional argument but 2 were given

Problem Description: BTS code today, all kinds of errors. The amazing thing is that everyone has no problem, only I encounter all kinds of wonderful problems, which are too difficult.


Type error: can’t convert CUDA: 0 device type tensor to numpy. Use tensor. CPU () to copy the tensor to host memory first

The solution to this problem is to copy the GPU data to the CPU first, and then save it. But it doesn’t look like that to me. Some people encountered it before because the torch version was wrong, so I reloaded all kinds of versions and combinations, which were unsuccessful.

Only part of the code will be commented out first, and then take a closer look.

Question 2: typeerror:__ array__() takes 1 positional argument but 2 were given

This problem is even more exotic, the image reading error. It is roughly the following situation:


np.array(img) # OK
np.array(img, dtype=np.float64) # Error

After searching for a long time, I finally found that a big guy proposed that it was a PIL bug, and the version was lowered from 8.3 to 8.2 to solve it

Err:1 http://mirrors.tuna.tsinghua.edu.cn/ros/ubuntu xxxxxx 404 Not Found [IP: 101.6.8.193 80]

Using sudo apt get install ROS melodic TEB local planner
to install the software, this error is reported, and the solution found can not be used
later, it is found that there is this file in the mirror source, but the previous one is all right, and the suffix of the upload date is wrong, which leads to the failure to find the installed package
after searching, it is found that there is a problem with DNS resolution

Solution:
change DNS first https://note.qidong.name/2020/05/resolvconf/
Modify the/etc/resolv.conf file, add 202.106.0.20
this is from Beijing Unicom, and then execute sudo apt get update
to get the result

W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://mirrors.tuna.tsinghua.edu.cn/ros/ubuntu bionic Release: The following signatures were invalid: EXPKEYSIG F42ED6FBAB17C654 Open Robotics <[email protected]>
W: Failed to fetch http://mirrors.tuna.tsinghua.edu.cn/ros/ubuntu/dists/bionic/Release.gpg  The following signatures were invalid: EXPKEYSIG F42ED6FBAB17C654 Open Robotics <[email protected]>
W: Some index files failed to download. They have been ignored, or old ones used instead.

Such an error report
execute sudo apt key adv — KeyServer keyserver.ubuntu.com — recv keys f42ed6fbab17c654
the following key is the key on the error report, just copy it

Then execute sudo apt get update
and finally sudo apt get install ROS melody TEB local planner
successfully!

Ffmpeg: How to Solve error initializing filter ‘gltransition’

1: After installing ffmpeg, check whether to install ffmpeg

Implementation: ffmpeg

Here’s the explanation. No problem

root@hroot-virtual-machine:~/ffmpeg-4.2.2# ffmpeg
ffmpeg version 4.2.2 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.3.0-17ubuntu1~20.04)
  configuration: --enable-libx264 --enable-libx265 --enable-libvpx --enable-libfdk-aac --enable-libmp3lame --enable-libopus --enable-nonfree --enable-gpl --enable-opengl --enable-filter=gltransition --extra-libs='-lGLEW -lglfw -ldl'
  libavutil      56. 31.100/56. 31.100
  libavcodec     58. 54.100/58. 54.100
  libavformat    58. 29.100/58. 29.100
  libavdevice    58.  8.100/58.  8.100
  libavfilter     7. 57.100/ 7. 57.100
  libswscale      5.  5.100/ 5.  5.100
  libswresample   3.  5.100/ 3.  5.100
  libpostproc    55.  5.100/55.  5.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

Use -h to get full help or, even better, run 'man ffmpeg'

Check whether the configuration gltransition is installed

root@hroot-virtual-machine:~/ffmpeg-4.2.2# ffmpeg -v 0 -filters | grep gltransition
 T.. gltransition      VV->V      OpenGL blend transitions

Test whether gltransition runs successfully

//Create a file to store the material
?CD/
?MKDIR img
?CD img

root@hroot-virtual-machine:/img# ll
total 1248
drwxr-xr-x  2 root root   4096 Jul   2 11:38 ./
drwxr-xr-x 21 root root   4096 Jul   2 10:05 ../
-rw-r--r--  1 root root 185169 Jul   2 10:05 1.jpg
-rw-r--r--  1 root root  67524 Jul   2 10:05 2.jpg
-rw-r--r--  1 root root 149603 Jul   2 10:05 3.jpg
-rw-r--r--  1 root root 188339 Jul   2 10:05 4.jpg
-rw-r--r--  1 root root 176810 Jul   2 10:05 5.jpg
-rw-r--r--  1 root root 487613 Jul   2 10:53 bgm.m4a

Check out the special effects files we downloaded

root@hroot-virtual-machine:~/ffmpeg-gl-transition/gl-transitions/transitions# ll
total 320
drwxr-xr-x 2 root root 4096 7月   1 18:22 ./
drwxr-xr-x 6 root root 4096 7月   1 18:22 ../
-rw-r--r-- 1 root root  462 7月   1 18:22 angular.glsl
-rw-r--r-- 1 root root  752 7月   1 18:22 Bounce.glsl
-rw-r--r-- 1 root root 2593 7月   1 18:22 BowTieHorizontal.glsl
-rw-r--r-- 1 root root 2541 7月   1 18:22 BowTieVertical.glsl
-rw-r--r-- 1 root root 1908 7月   1 18:22 BowTieWithParameter.glsl
-rw-r--r-- 1 root root  245 7月   1 18:22 burn.glsl
-rw-r--r-- 1 root root  981 7月   1 18:22 ButterflyWaveScrawler.glsl
-rw-r--r-- 1 root root  485 7月   1 18:22 cannabisleaf.glsl
-rw-r--r-- 1 root root  550 7月   1 18:22 CircleCrop.glsl
-rw-r--r-- 1 root root  422 7月   1 18:22 circle.glsl
-rw-r--r-- 1 root root  408 7月   1 18:22 circleopen.glsl
-rw-r--r-- 1 root root  392 7月   1 18:22 colorphase.glsl
-rw-r--r-- 1 root root  364 7月   1 18:22 ColourDistance.glsl
-rw-r--r-- 1 root root  627 7月   1 18:22 CrazyParametricFun.glsl
-rw-r--r-- 1 root root  623 7月   1 18:22 crosshatch.glsl
-rw-r--r-- 1 root root  228 7月   1 18:22 crosswarp.glsl
-rw-r--r-- 1 root root 2396 7月   1 18:22 CrossZoom.glsl
-rw-r--r-- 1 root root 1738 7月   1 18:22 cube.glsl
-rw-r--r-- 1 root root  361 7月   1 18:22 directional-easing.glsl
-rw-r--r-- 1 root root  315 7月   1 18:22 Directional.glsl
-rw-r--r-- 1 root root  498 7月   1 18:22 directionalwarp.glsl
-rw-r--r-- 1 root root  577 7月   1 18:22 directionalwipe.glsl
-rw-r--r-- 1 root root  533 7月   1 18:22 displacement.glsl
-rw-r--r-- 1 root root 1627 7月   1 18:22 DoomScreenTransition.glsl
-rw-r--r-- 1 root root 1221 7月   1 18:22 doorway.glsl
-rw-r--r-- 1 root root  378 7月   1 18:22 Dreamy.glsl
-rw-r--r-- 1 root root 1163 7月   1 18:22 DreamyZoom.glsl
-rw-r--r-- 1 root root  413 7月   1 18:22 fadecolor.glsl
-rw-r--r-- 1 root root  136 7月   1 18:22 fade.glsl
-rw-r--r-- 1 root root  558 7月   1 18:22 fadegrayscale.glsl
-rw-r--r-- 1 root root 2231 7月   1 18:22 FilmBurn.glsl
-rw-r--r-- 1 root root  522 7月   1 18:22 flyeye.glsl
-rw-r--r-- 1 root root 2242 7月   1 18:22 GlitchDisplace.glsl
-rw-r--r-- 1 root root  607 7月   1 18:22 GlitchMemories.glsl
-rw-r--r-- 1 root root 2300 7月   1 18:22 GridFlip.glsl
-rw-r--r-- 1 root root  356 7月   1 18:22 heart.glsl
-rw-r--r-- 1 root root 1644 7月   1 18:22 hexagonalize.glsl
-rw-r--r-- 1 root root 7518 7月   1 18:22 InvertedPageCurl.glsl
-rw-r--r-- 1 root root  585 7月   1 18:22 kaleidoscope.glsl
-rw-r--r-- 1 root root  647 7月   1 18:22 LeftRight.glsl
-rw-r--r-- 1 root root  682 7月   1 18:22 LinearBlur.glsl
-rw-r--r-- 1 root root  189 7月   1 18:22 luma.glsl
-rw-r--r-- 1 root root 3812 7月   1 18:22 luminance_melt.glsl
-rw-r--r-- 1 root root  390 7月   1 18:22 morph.glsl
-rw-r--r-- 1 root root 1127 7月   1 18:22 Mosaic.glsl
-rw-r--r-- 1 root root  339 7月   1 18:22 multiply_blend.glsl
-rw-r--r-- 1 root root 1444 7月   1 18:22 perlin.glsl
-rw-r--r-- 1 root root  361 7月   1 18:22 pinwheel.glsl
-rw-r--r-- 1 root root  584 7月   1 18:22 pixelize.glsl
-rw-r--r-- 1 root root  464 7月   1 18:22 polar_function.glsl
-rw-r--r-- 1 root root  326 7月   1 18:22 PolkaDotsCurtain.glsl
-rw-r--r-- 1 root root  364 7月   1 18:22 Radial.glsl
-rw-r--r-- 1 root root  444 7月   1 18:22 randomNoisex.glsl
-rw-r--r-- 1 root root  399 7月   1 18:22 randomsquares.glsl
-rw-r--r-- 1 root root  378 7月   1 18:22 ripple.glsl
-rw-r--r-- 1 root root  878 7月   1 18:22 rotate_scale_fade.glsl
-rw-r--r-- 1 root root  348 7月   1 18:22 rotateTransition.glsl
-rw-r--r-- 1 root root  376 7月   1 18:22 SimpleZoom.glsl
-rw-r--r-- 1 root root  771 7月   1 18:22 squareswire.glsl
-rw-r--r-- 1 root root  455 7月   1 18:22 squeeze.glsl
-rw-r--r-- 1 root root 8015 7月   1 18:22 StereoViewer.glsl
-rw-r--r-- 1 root root 1539 7月   1 18:22 swap.glsl
-rw-r--r-- 1 root root  715 7月   1 18:22 Swirl.glsl
-rw-r--r-- 1 root root 4051 7月   1 18:22 tangentMotionBlur.glsl
-rw-r--r-- 1 root root  650 7月   1 18:22 TopBottom.glsl
-rw-r--r-- 1 root root  651 7月   1 18:22 TVStatic.glsl
-rw-r--r-- 1 root root 1399 7月   1 18:22 undulatingBurnOut.glsl
-rw-r--r-- 1 root root  429 7月   1 18:22 WaterDrop.glsl
-rw-r--r-- 1 root root  397 7月   1 18:22 wind.glsl
-rw-r--r-- 1 root root  274 7月   1 18:22 windowblinds.glsl
-rw-r--r-- 1 root root  299 7月   1 18:22 windowslice.glsl
-rw-r--r-- 1 root root  192 7月   1 18:22 wipeDown.glsl
-rw-r--r-- 1 root root  192 7月   1 18:22 wipeLeft.glsl
-rw-r--r-- 1 root root  192 7月   1 18:22 wipeRight.glsl
-rw-r--r-- 1 root root  192 7月   1 18:22 wipeUp.glsl
-rw-r--r-- 1 root root 1073 7月   1 18:22 ZoomInCircles.glsl

Get absolute path

root@hroot-virtual-machine:~/ffmpeg-gl-transition/gl-transitions/transitions# pwd
/root/ffmpeg-gl-transition/gl-transitions/transitions

--------Then go back to the material folder where
cd /img

Start the test

ffmpeg \
-t 1 -loop 1 -i 1.jpg \
-t 1 -loop 1 -i 2.jpg \
-filter_complex \
"gltransition=offset=0.5:duration=0.5:source=/root/ffmpeg-gl-transition/gl-transitions/transitions/crosswarp.glsl" \
-y out.mp4

Source: followed by the absolute path of the special effects file

The results showed that: 1

root@hroot-virtual-machine:/img# ffmpeg \
> -t 1 -loop 1 -i 1.jpg \
> -t 1 -loop 1 -i 2.jpg \
> -filter_complex \
> "gltransition=offset=0.5:duration=0.5:source=/root/ffmpeg-gl-transition/gl-transitions/transitions/crosswarp.glsl" \
> -y out.mp4
ffmpeg version 4.2.2 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.3.0-17ubuntu1~20.04)
  configuration: --enable-libx264 --enable-libx265 --enable-libvpx --enable-libfdk-aac --enable-libmp3lame --enable-libopus --enable-nonfree --enable-gpl --enable-opengl --enable-filter=gltransition --extra-libs='-lGLEW -lglfw -ldl'
  libavutil      56. 31.100/56. 31.100
  libavcodec     58. 54.100/58. 54.100
  libavformat    58. 29.100/58. 29.100
  libavdevice    58.  8.100/58.  8.100
  libavfilter     7. 57.100/ 7. 57.100
  libswscale      5.  5.100/ 5.  5.100
  libswresample   3.  5.100/ 3.  5.100
  libpostproc    55.  5.100/55.  5.100
Input #0, image2, from '1.jpg':
  Duration: 00:00:00.04, start: 0.000000, bitrate: 37033 kb/s
    Stream #0:0: Video: mjpeg (Baseline), yuvj444p(pc, bt470bg/unknown/unknown), 400x400 [SAR 1:1 DAR 1:1], 25 fps, 25 tbr, 25 tbn, 25 tbc
Input #1, image2, from '2.jpg':
  Duration: 00:00:00.04, start: 0.000000, bitrate: 13504 kb/s
    Stream #1:0: Video: mjpeg (Baseline), yuvj444p(pc, bt470bg/unknown/unknown), 400x400 [SAR 1:1 DAR 1:1], 25 fps, 25 tbr, 25 tbn, 25 tbc
[AVFilterGraph @ 0x565112acce40] Error initializing filter 'gltransition' with args 'offset=0.5:duration=0.5:source=/root/ffmpeg-gl-transition/gl-transitions/transitions/crosswarp.glsl'
Error initializing complex filters.
Operation not permitted

Error initializing filter ‘gltransition’ is a problem

The solution is as follows:

Install xvfb (skip if installed)

sudo apt-get -y install xvfb

Then start xvfb (thread blocking)

Xvfb :1 -screen 0 1280x1024x16

Then call xvfb to execute the special effect

env DISPLAY=:1  ffmpeg 命令

For example, the sentence that just reported an error:

env DISPLAY=:1 ffmpeg \
	-t 1 -loop 1 -i 1.jpg \
	-t 1 -loop 1 -i 2.jpg \
	-filter_complex \
	"gltransition=offset=0.5:duration=0.5:source=/root/ffmpeg-gl-transition/gl-transitions/transitions/crosswarp.glsl" \
	-y out1.mp4

If the instructions are not saved after execution, let’s check:

root@hroot-virtual-machine:/img# ll
	total 1336
	drwxr-xr-x  2 root root   4096 7月   2 11:49 ./
	drwxr-xr-x 21 root root   4096 7月   2 10:05 ../
	-rw-r--r--  1 root root 185169 7月   2 10:05 1.jpg
	-rw-r--r--  1 root root  67524 7月   2 10:05 2.jpg
	-rw-r--r--  1 root root 149603 7月   2 10:05 3.jpg
	-rw-r--r--  1 root root 188339 7月   2 10:05 4.jpg
	-rw-r--r--  1 root root 176810 7月   2 10:05 5.jpg
	-rw-r--r--  1 root root 487613 7月   2 10:53 bgm.m4a
	-rw-r--r--  1 root root  89138 7月   2 11:49 out1.mp4	(Our picture plus special effects composite video)

Video add special effects, no EGL must install xvfb, with xvfb to add special effects

Env display =: 1 this must be added before executing the command

Ubuntu: How to deal with the fatal: the remote end hung up unexpected error of GIT clone Android kernel

Questions

Use git command to clone Android kernel from Tsinghua open source software image station in Ubuntu, but the following error is reported:

$ git clone https://aosp.tuna.tsinghua.edu.cn/kernel/goldfish
Cloning into 'goldfish'...
remote: Enumerating objects: 116, done.
remote: Counting objects: 100% (116/116), done.
remote: Compressing objects: 100% (69/69), done.
error: RPC failed; curl 56 GnuTLS recv error (-9): Error decoding the received TLS packet.
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed

Treatment method

After querying some blogs, this error is summed up as the reason why the file is too large

According to the method of the first problem in reference 1, execute the following commands respectively to solve the problem:

Set git minimum speed
$ git config --global http.lowSpeedLimit 0
$ git config --global http.lowSpeedTime 999999
Set http cache
$ git config --global http.postBuffer 1048576000

Among them, postbuffer is used to set HTTP cache, which can be set larger, such as 1g: git config — global http.postbuffer 1048576000, or 3G 3194304000

[Solved] UnicodeEncodeError: ‘ascii‘ codec can‘t encode characters in position 3-9: ordinal not in range(128)

linux django UnicodeEncodeError: ‘ascii’ codec can’t encode characters in position 36-45: ordinal not in range(128)
error:

UnicodeEncodeError: 'ascii' codec can't encode characters in position 36-45: ordinal not in range(128)

Solution:

vi ~/.bashrc
export LC_ALL=C.UTF-8
source ~/.bashrc

How to Solve Turtle_tf Error in ROS

Software configuration

Operating system: Ubuntu 16.04
ROS version: kinetic
Python version: python2.7, python3.5, python3.8

Function package and routine

Refer to “ROS robot development and practice” section 4.2.3 using turtle simulator routine turtle_ TF, execute the command:

roslaunch turtle_tf turtle_tf_demo.launch

report errors

Traceback (most recent call last):
   File "/opt/ros/kinetic/lib/turtle_tf/turtle_tf_broadcaster.py", line 37, in <module>
        import tf   
   File "/opt/ros/kinetic/lib/python2.7/dist-packages/tf/__init__.py", line 28, in <module>
        from tf2_ros import TransformException as Exception, ConnectivityException, LookupException, ExtrapolationException
   File "/opt/ros/kinetic/lib/python2.7/dist-packages/tf2_ros/__init__.py", line 38, in <module>     
        from tf2_py import *   
   File "/opt/ros/kinetic/lib/python2.7/dist-packages/tf2_py/__init__.py", line 38, in <module>     
        from ._tf2 import * ImportError: dynamic module does not define module export function (PyInit__tf2) Traceback (most recent call last):   
   File "/opt/ros/kinetic/lib/turtle_tf/turtle_tf_broadcaster.py", line 37, in <module>     
        import tf   
   File "/opt/ros/kinetic/lib/python2.7/dist-packages/tf/__init__.py", line 28, in <module>    
        from tf2_ros import TransformException as Exception, ConnectivityException, LookupException, ExtrapolationException   
   File "/opt/ros/kinetic/lib/python2.7/dist-packages/tf2_ros/__init__.py", line 38, in <module>     
        from tf2_py import *  
   File "/opt/ros/kinetic/lib/python2.7/dist-packages/tf2_py/__init__.py", line 38, in <module>     
        from ._tf2 import * ImportError: dynamic module does not define module export function (PyInit__tf2) 
Traceback (most recent call last):   
   File "/opt/ros/kinetic/lib/turtle_tf/turtle_tf_listener.py", line 37, in <module>     
        import tf   
   File "/opt/ros/kinetic/lib/python2.7/dist-packages/tf/__init__.py", line 28, in <module>     
        from tf2_ros import TransformException as Exception, ConnectivityException, LookupException, ExtrapolationException  
   File "/opt/ros/kinetic/lib/python2.7/dist-packages/tf2_ros/__init__.py", line 38, in <module>     
        from tf2_py import *   
   File "/opt/ros/kinetic/lib/python2.7/dist-packages/tf2_py/__init__.py", line 38, in <module>     
        from ._tf2 import * ImportError: dynamic module does not define module export function (PyInit__tf2) 

find by hard and thorough search

At the beginning, try the methods mentioned on the Internet, such as modifying the python version and soft link, and input on the terminal:

python --version

After getting python2.7, the running routine still reports an error, so I want to find the reason according to the error

Find the error report file from the first line of the error report:

/opt/ros/kinetic/lib/turtle_tf/turtle_tf_broadcaster.py

Turn on Turbo_ tf_ After editing the broadcast.py file, it is found that the first line of the file states:

#!/usr/bin/env python

Input in the terminal:

/usr/bin/env python

It shows the python version pointed by the python variable in the environment variable, which is different from the routine’s requirement of python2.7.

Problem solving: modify Python in environment variables

//Modify the priority of different python versions
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 100
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 150

//Manual priority selection
sudo update-alternatives --config python

*Remember to input “/ usr/bin/env Python” in the terminal to check whether the modification is successful.

After the modification is successful, run the routine again to see two little turtles. The little turtle at the bottom moves towards the little turtle at the center.