'Install PCL Library on Python/Ubuntu 18.04 LTS

How do you install PCL Library on Python/Ubuntu 18.04 LTS?

I've tried different ways to do so, without luck.

Trying to import pcl results in:

ImportError: libpcl_keypoints.so.1.7: cannot open shared object file: No such file or directory


Solution 1:[1]

Install it as a system-wide library, versus a Python module.

sudo add-apt-repository ppa:sweptlaser/python3-pcl
sudo apt update
sudo apt install python3-pcl

from here

Solution 2:[2]

Thank you for all your answers so far.

I tried so much to solve this problem and surfed all answers on the web. One drawback among the answers is this line code: "sudo apt-get install libpcl-dev -y". If you run this command, it will install libpcl-dev with a higher version which will be conflicted with that libpcl-dev 1.7 you will install later. So please do not do anything and listen to me to solve the problem. here are some steps to hit the problem:

Step 1: find Ubuntu 16 source.list and add one by one of its repositories to your Ubuntu(for example version 20). you can find it in this link: https://gist.github.com/rohitrawat/60a04e6ebe4a9ec1203eac3a11d4afc1

Step 2: run "sudo apt update", now libpcl-dev 1.7 has been installed successfully. you can run this command to see :"apt-cache policy libpcl-dev"

Step 3: run: "python", then "import pcl", you will receive such this error: ImportError: libpcl_keypoints.so.1.7, ok do not worry, copy "libpcl_keypoints.so.1.7" and go to this website and paste within its search box: https://debian.pkgs.org/8/debian-main-amd64, there you will see such this: "sudo apt-get install libpcl-keypoints1.7", run it on the terminal.

Step 4: type "python" on the terminal, then "import pcl". you will see another error for example: "libpcl-outofcore1.7", again search it that website and do as previous step.

Step 5: do step 3 and 4 sometimes till you can import pcl successfully.

I did and worked for me :D

Moreover, I repeated the process to install PCL and also prepared these steps to resolve the problem easily. You can follow these steps to install PCL successfully.

Step1: Add Ubuntu 16 source list

Step2: sudo apt-get update

step3: pip install python-pcl

step4: sudo apt-get install libpcl-keypoints1.7

step5: sudo apt-get install libpcl-outofcore1.7

step6: sudo apt-get install libpcl-people1.7

step7: sudo apt-get install libpcl-recognition1.7

step8: sudo apt-get install libpcl-registration1.7

step9: sudo apt-get install libpcl-segmentation1.7

step10: sudo apt-get install libpcl-surface1.7

Now, if you get error "libpng12-0", do this:

sudo add-apt-repository ppa:linuxuprising/libpng12

sudo apt update

sudo apt-get install libpng12-0

Step11: sudo apt-get install libpcl-tracking1.7

Step12: sudo apt-get install libflann1.8

Step13: sudo apt-get install libpcl-visualization1.7

Step14: python

import pcl

Congratulation : PCL is successfully imported

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 RightmireM
Solution 2