Installation for PCL 1.10.0, python3.8-venv on Ubuntu 20.04
These changes allowed me to install python-pcl using the newest PCL version (sudo apt install libpcl-dev) and import after applying this fix.
-
git clone https://github.com/marcelbrucker/python-pcl.git -
cd python-pcl/ -
python setup.py install

Ran into the problem: AttributeError: module 'pcl' has no attribute 'PointCloud' and eventually solved it by using v0.2.0 instead of v0.3.0 from my forked repo as explained here but with the same changes.
@marcelbrucker Hey,
could you help me with installation on Ubuntu 20.04, Python 3.8.10? I tried your suggestions and from @mrinalsenapati04.
@marcelbrucker Hey,
could you help me with installation on Ubuntu 20.04, Python 3.8.10? I tried your suggestions and from @mrinalsenapati04.
Where exactly are you stuck?
You have to use the ZIP file from here, make similar adjustments than the ones I did in this pull request and finally install from source by python setup.py install.
@marcelbrucker Hey, could you help me with installation on Ubuntu 20.04, Python 3.8.10? I tried your suggestions and from @mrinalsenapati04.
Where exactly are you stuck? You have to use the ZIP file from here, make similar adjustments than the ones I did in this pull request and finally install from source by
python setup.py install.
yes exactly I did these steps and the installation finished successfully, but I try to use PCL via VS Code. So I have updated the PATHS in the provided .json file, but the functions for example pcl::StatisticalOutlierRemoval (I know it's C++), which are given in Introduction are inaccessible.

StatisticalOutlierRemoval

It's likely that IntelliSense does not work properly but still you should be able to use the functions. Can't you replicate for instance these lines without errors?
@marcelbrucker
Hey, can you push your modified v0.2.0 to your forked repo? I tried to modify the setup.py but resulted in errors. Thanks
Yes maybe that's the reason, but I added all the paths to the PCL library, so IntelliSense should found them. Here the requested commands:

I don't get it why, it's not working with VS Code, could you help there?
@marcelbrucker
Hey, can you push your modified v0.2.0 to your forked repo? I tried to modify the setup.py but resulted in errors. Thanks
I made a new commit.
@marcelbrucker it`s working now, I only installed the way you recommended and set the paths in my .json file in VS Code
@marcelbrucker Can u push your pip freeze file? or can u notify me specific version of requirements? Thank you in advance.
@marcelbrucker Can u push your pip freeze file? or can u notify me specific version of requirements? Thank you in advance.
As far as I know there are none. Can you not install?
Ran into the problem:
AttributeError: module 'pcl' has no attribute 'PointCloud'and eventually solved it by using v0.2.0 instead of v0.3.0 from my forked repo as explained here but with the same changes.
I just had a look at this pull request and I believe the first commit #0227ad is working on its own. The commit afterwards (ironically named "Import now works") breaks the import for me. Most of this library's code is natively linked into a library named _pcl, that gets imported into python using from ._pcl import *. By changing this to from pcl import *, this library will not get loaded at all, which likely causes the AttributeError as PointCloud is defined within this library.
Thus, to fix this issue, it should be sufficient to revert the two latest commits (downgrade is not necessary anymore, I suppose). Hope this helps!
Ran into the problem:
AttributeError: module 'pcl' has no attribute 'PointCloud'and eventually solved it by using v0.2.0 instead of v0.3.0 from my forked repo as explained here but with the same changes.I just had a look at this pull request and I believe the first commit #0227ad is working on its own. The commit afterwards (ironically named "Import now works") breaks the import for me. Most of this library's code is natively linked into a library named _pcl, that gets imported into python using
from ._pcl import *. By changing this tofrom pcl import *, this library will not get loaded at all, which likely causes theAttributeErrorasPointCloudis defined within this library. Thus, to fix this issue, it should be sufficient to revert the two latest commits (downgrade is not necessary anymore, I suppose). Hope this helps!
I tried it and ended up with the same error from two months ago. For this reason, I had continued with the two following commits.

Ran into the problem:
AttributeError: module 'pcl' has no attribute 'PointCloud'and eventually solved it by using v0.2.0 instead of v0.3.0 from my forked repo as explained here but with the same changes.
Hi, in python3.6, there is still the problem......

Any updates? It seems that the author has updated the master, so I just cloned the repo and installed from git clone. Still no luck:
$ python
Python 3.8.12 (default, Oct 12 2021, 13:49:34)
[GCC 7.5.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pcl
>>> pcl.load
<function load at 0x7fa40b0b2ca0>
>>> pcl.PointCloud
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'pcl' has no attribute 'PointCloud'
>>> pcl.PointCloud()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'pcl' has no attribute 'PointCloud'
>>>
I'm facing the same problem, are there any updates?
Thanks
I'm facing the same problem, are there any updates? root@roblearn:~# python3 Python 3.8.10 (default, Jun 2 2021, 10:49:15) [GCC 9.4.0] on linux Type "help", "copyright", "credits" or "license" for more information.
import pcl pcl.PointCloud Traceback (most recent call last): File "", line 1, in AttributeError: module 'pcl' has no attribute 'PointCloud'
Thanks
In which IDE you're using the pcl library?
I'm facing the same problem, are there any updates? root@roblearn:~# python3 Python 3.8.10 (default, Jun 2 2021, 10:49:15) [GCC 9.4.0] on linux Type "help", "copyright", "credits" or "license" for more information.
import pcl pcl.PointCloud Traceback (most recent call last): File "", line 1, in AttributeError: module 'pcl' has no attribute 'PointCloud'
Thanks
In which IDE you're using the
pcllibrary?
I'm not using any IDE. I installed pcl library with 'apt install libpcl-dev'
The installation is located here:
I'm facing the same problem, are there any updates? root@roblearn:~# python3 Python 3.8.10 (default, Jun 2 2021, 10:49:15) [GCC 9.4.0] on linux Type "help", "copyright", "credits" or "license" for more information.
import pcl pcl.PointCloud Traceback (most recent call last): File "", line 1, in AttributeError: module 'pcl' has no attribute 'PointCloud'
Thanks
In which IDE you're using the
pcllibrary?I'm not using any IDE. I installed pcl library with 'apt install libpcl-dev' The installation is located here:
Please use this formatter for code
Some code or text
When you try to call a function you get the message that it can't find the module?
I'm facing the same problem, are there any updates? root@roblearn:~# python3 Python 3.8.10 (default, Jun 2 2021, 10:49:15) [GCC 9.4.0] on linux Type "help", "copyright", "credits" or "license" for more information.
import pcl pcl.PointCloud Traceback (most recent call last): File "", line 1, in AttributeError: module 'pcl' has no attribute 'PointCloud'
Thanks
In which IDE you're using the
pcllibrary?I'm not using any IDE. I installed pcl library with 'apt install libpcl-dev' The installation is located here:
Please use this formatter for code
Some code or text When you try to call a function you get the message that it can't find the module?
The only available functions that I have are load and save.
The ones that are on the __init__.py file
use the quote reply only if you want to, when you refer to a comment. So maybe you can add the functions to __init__.py to call pcl.PointCloud.
When you install pcl with pip install use instead the installing from source, seems to be better.
Now I removed the pcl library installed by 'apt install libpcl-dev' and installed the version 1.10.1 by source. Then installed python-pcl using @marcelbrucker instructions but It's still not working:
git clone https://github.com/marcelbrucker/python-pcl.git
cd python-pcl/
python3 setup.py install
It seems is problem of python-pcl library, this is the available functions that I refer yesterday:
Python 3.8.10 (default, Jun 2 2021, 10:49:15)
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pcl
>>> pcl
<module 'pcl' from '/root/python-pcl/pcl/__init__.py'>
>>> pcl.
pcl.load( pcl.save( pcl.sys
>>> pcl.
pcl.load( pcl.save( pcl.sys
>>> pcl.
KeyboardInterrupt
>>>
>>>
>>> pcl.PointCloud
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'pcl' has no attribute 'PointCloud'
>>> pcl.PointCloud()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'pcl' has no attribute 'PointCloud'
>>>
It would be possible to share the version of python-pcl package that worked for you @Petros626 ? Thanks @Petros626 for your effort
@estrellademaralex
I remember, that I installed it locally to work for me, but which version I don't no...
I have no access to this notebook anymore, so I would try to search for python dont recognize package or smth. like that. I only installed it from source and paste the path in VS Code to find the libs and the functions.
I have it working finally!! So what worked for me was:
- Uninstall all installed pcl libraries. Look at /usr/local/lib and remove all versions of pcl library (
rm -R libpcl*) Also I had a package with the same name pcl and I uninstalled it bypip3 uninstall pcl - Install pcl library 1.10.1 by source (https://github.com/PointCloudLibrary/pcl/releases) For installing it by source locate in dowloaded pcl-pcl-1.10.1 folder and execute:
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make -j4
make install
- Install python pcl by
apt install python3-pcl
Python 3.8.10 (default, Jun 2 2021, 10:49:15)
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pcl
>>> pcl.PointCloud()
<PointCloud of 0 points>
>>> p=pcl.PointCloud()
>>>
>>>
>>> import numpy as np
>>>
>>> p.from_array(np.array([[1,2,3],[4,5,6]], dtype=np.float32))
>>> p
<PointCloud of 2 points>
>>> fil = p.make_statistical_outlier_filter()
>>> fil.set_mean_k(50)
>>> fil.set_std_dev_mul_thresh(1.0)
>>> fil.filter
<built-in method filter of pcl._pcl.StatisticalOutlierRemovalFilter object at 0x7f616a39c890>
>>> fil.filter()
<PointCloud of 2 points>
>>>
Thanks @Petros626
Thank you for your contribution, @marcelbrucker . We greatly appreciate your support and would like to continue working with you on this amazing project. You can join the discord channel https://discord.gg/Zjy6ueqM7Z
