Tag Archives: ubuntu

[Solved] theano-GPU Error: pygpu.gpuarray.GpuArrayException: b‘cuMemAlloc: CUDA_ERROR_OUT_OF_MEMORY: out of memory

Project scenario:

l2t code needs to use theano library and GPU to accelerate calculation

Non root user ubuntu-18.04 + cuda8 0 (you need to downgrade GCC to match, I’ll configure it as 5.3) + cudnn V5 1+theano 1.0.4+pygpu 0.7.6


Problem description

pygpu.gpuarray.GpuArrayException: b'cuMemAlloc: CUDA_ERROR_OUT_OF_MEMORY: out of memory
Training... 2448.24 sec.
Traceback (most recent call last):
  File ".../python3.8/site-packages/theano/compile/function_module.py", line 903, in __call__
    self.fn() if output_subset is None else\
  File "pygpu/gpuarray.pyx", line 689, in pygpu.gpuarray.pygpu_zeros
  File "pygpu/gpuarray.pyx", line 700, in pygpu.gpuarray.pygpu_empty
  File "pygpu/gpuarray.pyx", line 301, in pygpu.gpuarray.array_empty
pygpu.gpuarray.GpuArrayException: b'cuMemAlloc: CUDA_ERROR_OUT_OF_MEMORY: out of memory'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "learn.py", line 535, in <module>
    main()
  File "learn.py", line 531, in main
    trainer.train()
  File "..l2t/lib/python3.8/site-packages/smartlearner-0.1.0-py3.8.egg/smartlearner/trainer.py", line 31, in train
  File ../l2t/lib/python3.8/site-packages/smartlearner-0.1.0-py3.8.egg/smartlearner/trainer.py", line 90, in _learning
  File "..l2t/lib/python3.8/site-packages/theano/compile/function_module.py", line 914, in __call__
    gof.link.raise_with_op(
  File "../l2t/lib/python3.8/site-packages/theano/gof/link.py", line 325, in raise_with_op
    reraise(exc_type, exc_value, exc_trace)
  File "../l2t/lib/python3.8/site-packages/six.py", line 718, in reraise
    raise value.with_traceback(tb)
  File "../l2t/lib/python3.8/site-packages/theano/compile/function_module.py", line 903, in __call__
    self.fn() if output_subset is None else\
  File "pygpu/gpuarray.pyx", line 689, in pygpu.gpuarray.pygpu_zeros
  File "pygpu/gpuarray.pyx", line 700, in pygpu.gpuarray.pygpu_empty
  File "pygpu/gpuarray.pyx", line 301, in pygpu.gpuarray.array_empty
pygpu.gpuarray.GpuArrayException: b'cuMemAlloc: CUDA_ERROR_OUT_OF_MEMORY: out of memory'
Apply node that caused the error: GpuAlloc<None>{memset_0=True}(GpuArrayConstant{[[0.]]}, Elemwise{Composite{((i0 * i1 * i2 * i3) // maximum(i3, i4))}}[(0, 0)].0, Shape_i{3}.0)
Toposort index: 98
Inputs types: [GpuArrayType<None>(float64, (True, True)), TensorType(int64, scalar), TensorType(int64, scalar)]
Inputs shapes: [(1, 1), (), ()]
Inputs strides: [(8, 8), (), ()]
Inputs values: [gpuarray.array([[0.]]), array(2383800), array(100)]
Outputs clients: [[forall_inplace,gpu,grad_of_scan_fn}(Shape_i{1}.0, InplaceGpuDimShuffle{0,2,1}.0, InplaceGpuDimShuffle{0,2,1}.0, InplaceGpuDimShuffle{0,2,1}.0, GpuAlloc<None>{memset_0=True}.0, GpuSubtensor{int64:int64:int64}.0, GpuSubtensor{int64:int64:int64}.0, GpuSubtensor{int64:int64:int64}.0, GpuSubtensor{int64:int64:int64}.0, GpuSubtensor{int64:int64:int64}.0, GpuAlloc<None>{memset_0=True}.0, GpuAlloc<None>{memset_0=True}.0, GpuAlloc<None>{memset_0=True}.0, GpuAlloc<None>{memset_0=True}.0, GpuAlloc<None>{memset_0=True}.0, Shape_i{1}.0, Shape_i{1}.0, Shape_i{1}.0, Shape_i{1}.0, Shape_i{1}.0, Shape_i{1}.0, Shape_i{1}.0, Shape_i{1}.0, Shape_i{1}.0, Shape_i{1}.0, GRU0_W, GRU0_U, GRU0_Uh, GRU1_W, GRU1_U, GRU1_Uh, InplaceGpuDimShuffle{x,0}.0, GpuFromHost<None>.0, GpuElemwise{add,no_inplace}.0, GpuElemwise{add,no_inplace}.0, GpuElemwise{Add}[(0, 1)]<gpuarray>.0, GpuReshape{2}.0, GpuFromHost<None>.0, GpuElemwise{add,no_inplace}.0, GpuElemwise{add,no_inplace}.0, GpuElemwise{Add}[(0, 1)]<gpuarray>.0, GpuReshape{2}.0, GpuFromHost<None>.0, GpuElemwise{add,no_inplace}.0, GpuElemwise{add,no_inplace}.0, GpuElemwise{Add}[(0, 1)]<gpuarray>.0, GpuReshape{2}.0, InplaceGpuDimShuffle{1,0}.0, InplaceGpuDimShuffle{1,0}.0, InplaceGpuDimShuffle{x,0}.0, InplaceGpuDimShuffle{1,0}.0, InplaceGpuDimShuffle{1,0}.0, InplaceGpuDimShuffle{1,0}.0, InplaceGpuDimShuffle{1,0}.0, GpuFromHost<None>.0, InplaceGpuDimShuffle{1,0}.0, GpuAlloc<None>{memset_0=True}.0, GpuFromHost<None>.0, GpuAlloc<None>{memset_0=True}.0, GpuFromHost<None>.0, GpuAlloc<None>{memset_0=True}.0)]]
HINT: Re-running with most Theano optimization disabled could give you a back-trace of when this node was created. This can be done with by setting the Theano flag 'optimizer=fast_compile'. If that does not work, Theano optimizations can be disabled with 'optimizer=None'.
HINT: Use the Theano flag 'exception_verbosity=high' for a debugprint and storage map footprint of this apply node.

 


Solution:

Reduce gpu__preallocate, I reduced it to 0.8, and optimize it with a small amount of graphs according to the hint when the error is reported


type in the codes

Run successfully!

[Solved] supervisor Error: /usr/local/lib/python2.7/dist-packages/pkg_resources/py2_warn.py:22: UserWarning: Setuptools will stop working on Python 2

An error is reported when installing supervisor. The information is as follows

web:~# supervisorctl status
/usr/local/lib/python2.7/dist-packages/pkg_resources/py2_warn.py:22: UserWarning: Setuptools will stop working on Python 2
************************************************************
You are running Setuptools on Python 2, which is no longer
supported and
>>> SETUPTOOLS WILL STOP WORKING <<<
in a subsequent release (no sooner than 2020-04-20).
Please ensure you are installing
Setuptools using pip 9.x or later or pin to `setuptools<45`
in your environment.
If you have done those things and are still encountering
this message, please comment in
https://github.com/pypa/setuptools/issues/1458
about the steps that led to this unsupported combination.
************************************************************
  sys.version_info < (3,) and warnings.warn(pre + "*" * 60 + msg + "*" * 60)

Solution:
uninstall and reinstall pip, setuptools and wheel to return them to the version corresponding to the system Python
python3 reference:

python3 -m pip uninstall pip setuptools wheel
sudo apt-get --reinstall install  python3-setuptools python3-wheel python3-pip

Python2 reference:

python -m pip uninstall pip setuptools wheel
sudo apt-get --reinstall install python-setuptools python-wheel python-pip 

[Solved] Ubuntu 20.04.3 Fail to Start sshd Error: Failed to start OpenBSD Secure Shell server

Environmental Science:

Ubuntu 20.04.3-live-server
Hyper-V virtual environment

Problem Description:

Ubuntu 20.04.3 fails to start sshd with error: failed to start OpenBSD secure shell server
sshd – T
prompt sshd: no hostkeys available – exiting.

Solution:

1. Check whether the SSH service is enabled
PS - e | grep ssh

No response

2. Install ssh

 apt update
apt-get install openssh-server openssh-client

Prompt installed

3. Implementation

/etc/init.d/ssh start

fail to start

Continue to execute ssh-keygen -A
Restart successfully

[Solved] NVIDIA-SMI has failed because it couldn‘t communicate with the NVIDIA driver

environment

– notebook model: Dell precision 5520
– graphics card model: M1200
– system: Ubuntu 20.04

 

Question

After installing the N card driver, execute NVIDIA SMI , and an error is reported:

NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running.

 

Solution:

Method 1

Cause: the system kernel is upgraded, resulting in the mismatch between the new version of kernel and the original graphics card driver
solution: use DKMS to generate the corresponding kernel file

View driver version

ls /usr/src | grep nvidia

For example, my result is nvidia-470.103.01

matching

sudo apt-get install dkms
sudo dkms install -m nvidia -v 470.103.01

Method 2

Reason: the same as scheme 1
solution: log in using the kernel. Then set the default to start with the kernel.

Method 3 (work for me)

Reason: the secure boot of the BIOS is in the enable state
Solution: enter the BIOS (generally press F2 when starting up) and turn off secure boot
it is strongly recommended that even if your secure boot is already in disable, it is recommended to execute it once: enable, restart, disable, and then restart. (this is my situation, so confused!!)

hb set Error: OHOS ERROR] Invalid vendor path: /home/openharmony/vendor (openharmony Compile ubuntu20.04 official document)

ubuntu20.04 hb set error: OHOS ERROR] Invalid vendor path: /home/openharmony/vendor

Compilation error

View environment

View version

Try to delete the ohos_config.json file in the project root directory, and then execute the “hb set” command, it still reports an error

Solution:

Uninstall this one: pip3 uninstall ohos-build
and then execute three lines of code in the source code path

 pythom3 -m  pip install build/lite

 pythom3 -m  pip install ohos-build 

pip3 install build/lite

Nginx Error: SSL: error:140AB18F:SSL routines:SSL_CTX_use_certificate:ee key too small


ubuntu20.04 nginx startup error:

root@ubuntu:/etc/nginx/conf.d# nginx -s reload
nginx: [warn] the “ssl” directive is deprecated, use the “listen … ssl” directive instead in /etc/nginx/conf.d/xx.conf:12
nginx: [emerg] SSL_CTX_use_certificate("/etc/nginx/conf.d/crt/server.crt") failed (SSL: error:140AB18F:SSL routines:SSL_CTX_use_certificate:ee key too small)

 

Solution: When generating the secret key, the command is as follows
openssl genrsa -des3 -out server.key 1024
Modify to
openssl genrsa -des3 -out server.key 2048

COLMAP Install Error: Undefined reference to libtiff4.0 [Solved]

At Ubuntu 20 When installing colmap under 04 system, run under /colmap/build folder

make -j

The following errors are reported:

/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libfreeimage.so: undefined reference to `TIFFReadEncodedStrip@LIBTIFF_4.0'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libfreeimage.so: undefined reference to `TIFFReadEXIFDirectory@LIBTIFF_4.0'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libfreeimage.so: undefined reference to `TIFFFieldReadCount@LIBTIFF_4.0'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libfreeimage.so: undefined reference to `TIFFSetTagExtender@LIBTIFF_4.0'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libfreeimage.so: undefined reference to `TIFFCurrentDirectory@LIBTIFF_4.0'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libfreeimage.so: undefined reference to `TIFFReadTile@LIBTIFF_4.0'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libfreeimage.so: undefined reference to `TIFFSetDirectory@LIBTIFF_4.0'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libfreeimage.so: undefined reference to `TIFFClientOpen@LIBTIFF_4.0'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libfreeimage.so: undefined reference to `TIFFSetField@LIBTIFF_4.0'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libfreeimage.so: undefined reference to `TIFFScanlineSize@LIBTIFF_4.0'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libfreeimage.so: undefined reference to `TIFFWriteDirectory@LIBTIFF_4.0'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libfreeimage.so: undefined reference to `TIFFTileRowSize@LIBTIFF_4.0'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libfreeimage.so: undefined reference to `TIFFWriteScanline@LIBTIFF_4.0'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libfreeimage.so: undefined reference to `TIFFGetFieldDefaulted@LIBTIFF_4.0'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libfreeimage.so: undefined reference to `TIFFReadDirectory@LIBTIFF_4.0'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libfreeimage.so: undefined reference to `TIFFIsTiled@LIBTIFF_4.0'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libfreeimage.so: undefined reference to `TIFFFieldDataType@LIBTIFF_4.0'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libfreeimage.so: undefined reference to `TIFFSwabArrayOfLong@LIBTIFF_4.0'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libfreeimage.so: undefined reference to `TIFFMergeFieldInfo@LIBTIFF_4.0'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libfreeimage.so: undefined reference to `TIFFLastDirectory@LIBTIFF_4.0'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libfreeimage.so: undefined reference to `_TIFFDataSize@LIBTIFF_4.0'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libfreeimage.so: undefined reference to `TIFFSetSubDirectory@LIBTIFF_4.0'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libfreeimage.so: undefined reference to `TIFFFieldPassCount@LIBTIFF_4.0'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libfreeimage.so: undefined reference to `TIFFFieldWithTag@LIBTIFF_4.0'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libfreeimage.so: undefined reference to `TIFFReadRGBAImage@LIBTIFF_4.0'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libfreeimage.so: undefined reference to `TIFFClose@LIBTIFF_4.0'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libfreeimage.so: undefined reference to `TIFFGetTagListCount@LIBTIFF_4.0'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libfreeimage.so: undefined reference to `TIFFDefaultStripSize@LIBTIFF_4.0'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libfreeimage.so: undefined reference to `TIFFFieldTag@LIBTIFF_4.0'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libfreeimage.so: undefined reference to `TIFFGetTagListEntry@LIBTIFF_4.0'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libfreeimage.so: undefined reference to `TIFFComputeStrip@LIBTIFF_4.0'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libfreeimage.so: undefined reference to `TIFFDataWidth@LIBTIFF_4.0'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libfreeimage.so: undefined reference to `TIFFFieldName@LIBTIFF_4.0'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libfreeimage.so: undefined reference to `TIFFIsByteSwapped@LIBTIFF_4.0'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libfreeimage.so: undefined reference to `TIFFGetField@LIBTIFF_4.0'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libfreeimage.so: undefined reference to `TIFFTileSize@LIBTIFF_4.0'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libfreeimage.so: undefined reference to `TIFFStripSize@LIBTIFF_4.0'
collect2: error: ld returned 1 exit status
src/mvs/CMakeFiles/normal_map_test.dir/build.make:163: recipe for target 'src/mvs/normal_map_test' failed
make[2]: *** [src/mvs/normal_map_test] Error 1

Conduct in-depth investigation and find that there is a Warning in the previous cmake…:

runtime library [libgmp.so.10] in /usr/lib/x86_64-linux-gnu may be hidden by files in: /home/damon/anaconda2/lib

It turns out that anaconda’s Qt is used, so add the following fields to Cmakelist.txt in the colmap folder to force the switch to system Qt

SET(CMAKE_PREFIX_PATH "/usr/lib/x86_64-linux-gnu/cmake")

Re-execute make – j and it will be OK!

Note: If you have previously made and failed, you need to delete all the files in the build folder and then make -j again, otherwise it will still fail

[Solved] Ubuntu pip Install Error: which is not on PATH

First, let’s take a look at the warning information

  WARNING: The script normalizer is installed in '/home/llxy/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.

Solution: Configure environment variables

gedit ~/.bashrc
# Add the path at the end of the file, which comes from the warning issued when installing pip in the first step
export PATH=/home/llxy/.local/bin:$PATH
source ~/.bashrc

[Solved] rs_to_velodyne-master compile Error: POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PPFRGBSignature

rs_to_velodyne-master compile Error:

/usr/include/pcl-1.10/pcl/point_types.h:574:1: error: ‘plus’ is not a member of ‘pcl::traits’
  574 | POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::CPPFSignature,

/usr/include/pcl-1.10/pcl/point_types.h:588:1: error: ‘plusscalar’ is not a member of ‘pcl::traits’
  588 | POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PPFRGBSignature,

/usr/include/pcl-1.10/pcl/point_types.h:588:1: error: ‘type’ is not a member of ‘pcl::traits::datatype<pcl::PPFRGBSignature, pcl::fields::f4>::decomposed’ {aka ‘pcl::traits::decomposeArray<float>’}

/usr/include/pcl-1.10/pcl/point_types.h:588:1: error: ‘plusscalar’ is not a member of ‘pcl::traits’
  588 | POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PPFRGBSignature,
......

 



 
解决方法:
在对应程序包的CMakeLists.txt中加入一行代码即可顺利编译。

Solution:
Add the following line in CMakeLists.txt of the corresponding program package:
set(CMAKE_CXX_STANDARD 14)

You can also use the same method when compiling other packages with the same error!

[Solved] error: (-2:Unspecified error) The function is not implemented. Rebuild the library with Windows,

Error return

terminate called after throwing an instance of 'cv::Exception'
  what():  OpenCV(3.4.3) /home/chen/Downloads/opencv-3.4.3/modules/highgui/src/window.cpp
  :632: error: (-2:Unspecified error) The function is not implemented. Rebuild the library 
  with Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian, install 
  libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function 
  'cvShowImage'

Aborted (core dumped)

Error resolution

Execute the command according to the solution given by the system

sudo apt-get install libgtk2.0-dev
sudo apt-get install pkg-config

It doesn’t solve the problem

Cause of problem

The problem is that there is a problem with the compilation configuration when installing opencv
I execute cmake…
and the correct command is

cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D WITH_QT=ON -D WITH_OPENGL=ON ..

Solution:

Locate the folder where opencv is installed

cd /home/chen/Downloads/opencv-3.4.3
mkdir release
cd release
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D WITH_QT=ON -D WITH_OPENGL=ON ..
sudo make
sudo make install 

Problem-solving…

[rospack] Error: no such package beginner_tutorials

[rospack] Error: no such package beginner_tutorials
I found this error during the process, and after pouring in the path, I couldn’t solve it, so I checked the workspace and found the beginner_tutorials file, so the problem is in the execution

catkin_create_pkg beginner_tutorials std_msgs rospy roscpp

The CD is not inside the src.
So if you find this problem, you can check the location of beginner_tutorials.
Solution: Just delete the beginner_tutorials and re-execute it.