Skip to content
This repository has been archived by the owner on Dec 30, 2023. It is now read-only.
This repository has been archived by the owner on Dec 30, 2023. It is now read-only.

Cannot import pcl #218

Open
xuanvinhilb opened this issue Jul 20, 2018 · 26 comments
Open

Cannot import pcl #218

xuanvinhilb opened this issue Jul 20, 2018 · 26 comments

Comments

@xuanvinhilb
Copy link

I installed python-pcl using python_pcl-0.3-cp35-cp35m-win_amd64.whl.
I have some questions as follows:

  1. Does the wheel contain the source code for PCL? (PCL is significantly larger than wheel file in size)
  2. I successfully install python-pcl using the wheel and check whether the modules is install by using "pip list". There is python-pcl in the list. However, the error arises when I tried to import pcl.

(py35) C:\Users\xuanv\Downloads>python test.py
Traceback (most recent call last):
File "test.py", line 1, in
import pcl
File "C:\Users\xuanv\AppData\Local\conda\conda\envs\py35\lib\site-packages\pcl_init_.py", line 5, in
from ._pcl import *
ImportError: DLL load failed: The specified module could not be found.

Do you have any idea what is going on?

Thanks

@skyline624
Copy link

same for me but works with the msi version on Windows 10 with Python 3.6
no need to install pcl

@xuanvinhilb
Copy link
Author

Hi,

Thank for your reply. I managed to install Python-PCL already. The above error is due to the missing of necessary path to libraries in the PATH environment.
In addition, I would like to compute normal vector for each point using normal estimation (http://pointclouds.org/documentation/tutorials/normal_estimation.php).
Do you support for the computation of normal estimation including OpenMP for acceleration?

Thanks,

@medakk
Copy link

medakk commented Jan 18, 2019

@xuanvinhilb Did you figure out how to compute normal estimates? I'm trying but it keeps failing:

# X is a numpy array
P = pcl.PointCloud(X[:,:3])
ne = pcl.NormalEstimation(P)
ne.set_SearchMethod(pcl.KdTree())
ne.set_RadiusSearch(0.3)
n = ne.compute()

It fails saying [pcl::NormalEstimation::initCompute] Init failed.

@xuanvinhilb
Copy link
Author

Hi medakk,

Can you try the code below? Just changing the cloud and test if it work.

Thanks,


-- coding: utf-8 --

"""
Created on Wed Aug 15 19:21:54 2018

@author: xuanv
"""
import pandas as pd
import numpy as np
import time
import pcl
import os

fileName = 'ValeroTK324_Cropped_2millionspoints.pcd'
start_time = time.time()
print('Step 1: Load PCD file ... ')
inputPointCloud = pcl.load(fileName)
searching_neighbour= {'knn_search': 25}
print(" - number of point",inputPointCloud.repr())
feat = inputPointCloud.make_NormalEstimation()
if 'range_search' in searching_neighbour.keys():
# Range search
searching_para = searching_neighbour['range_search'] if searching_neighbour['range_search'] > 0 else 0.1
feat.setRadiusSearch(searching_para)
elif 'knn_search' in searching_neighbour.keys():
# kNN search
searching_para = int(searching_neighbour['knn_search']) if int(searching_neighbour['knn_search']) > 5 else 20
tree = inputPointCloud.make_kdtree()
feat.set_SearchMethod(tree)
feat.set_KSearch(searching_para)
else:
print('Define researching method does not support')
start_time = time.time()
normals = feat.compute()
print(" - compute normal vectors in ",time.time() - start_time)

@Ajay1207
Copy link

Ajay1207 commented Jan 18, 2019

Hi,

I installed python-pcl-0.3.win-amd64-py3.5.msi

after installing I am facing this issue

from ._pcl import *
ImportError: No module named 'pcl._pcl'

This the content of pcl directory after installing. am I missing anything here?

image

@xuanvinhilb
Copy link
Author

The above error is probably due to the missing of necessary path to libraries in the PATH environment. You can use dependency walker to find which library is missing (http://www.dependencywalker.com/)

@Ajay1207
Copy link

Ajay1207 commented Jan 18, 2019

@xuanvinhilb Thanks for replying. I have followed the steps mentioned in https://github.com/strawlab/python-pcl#set-before-environment-variable

I installed the PCL 1.6.0 All-In-One Installer

and I have copied these path

pcl_path

@xuanvinhilb
Copy link
Author

It is usually because of missing Xerces-C. I strongly recommend you to use dependency walker to find exactly which library is missing.

@medakk
Copy link

medakk commented Jan 18, 2019

@xuanvinhilb
Thank you very much!! Your code works for me!

One small correction:
feat.setRadiusSearch(searching_para) should be feat.set_RadiusSearch(searching_para).

@Ajay1207
Copy link

Ajay1207 commented Jan 24, 2019

Hi,

I installed python-pcl-0.3.win-amd64-py3.5.msi

after installing I am facing this issue

from ._pcl import *
ImportError: No module named 'pcl._pcl'

This the content of pcl directory after installing. am I missing anything here?

image

I solved the issue by following the steps below.

  1. Uninstalled anaconda
  2. Installed python 3.5.2
  3. Installed PCL 1.9.0
  4. Ensured all the path are correct ref https://github.com/strawlab/python-pcl
  5. Installed python-pcl 0.3 for python 3.5
  6. Now I was able to import pcl succesfully
  7. Still pcl.visualization was creating problems so I edited:
    pcl/init.py (uncomment .pcl_visualization import * ln 7)
  8. After this I was able to use pcl and visualization properly.
    lidar_windows_small

@FelipeDelgadoR
Copy link

FelipeDelgadoR commented Feb 1, 2019

Hi, I'm also having troubles with this and I'm pretty sure that's because of the environment variables...
I don't know why but they don't seem to work as they should ($(OPEN_NI_ROOT) nor $(VTK_ROOT) are there)

image

Any help please...

@Ajay1207
Copy link

Ajay1207 commented Feb 1, 2019 via email

@FelipeDelgadoR
Copy link

Python 3.4
PCL 16

@Ajay1207
Copy link

Ajay1207 commented Feb 3, 2019 via email

@wedesoft
Copy link

wedesoft commented Mar 1, 2019

I had to add C:\\Program Files\OpenNI2\Redist to the system PATH to get it to work under Windows.

@Bastiiiiii
Copy link

I had the same issue and had to download OpenNI2 and add the OpenNI2.dll from the Tools folder of OpenNI to the PATH.
I use Windows 10 Python 3.6 and installed python-pcl through the wheel file.

@lonlonago
Copy link

@Bastiiiiii how did you do it ?

@zhouenbo
Copy link

zhouenbo commented Jul 9, 2019

I got the same problem. How to solve the import problem mentioned above? Could you please give some detail explanation?

@kathanvyas
Copy link

I installed python-pcl using python_pcl-0.3-cp35-cp35m-win_amd64.whl.
I have some questions as follows:

  1. Does the wheel contain the source code for PCL? (PCL is significantly larger than wheel file in size)
  2. I successfully install python-pcl using the wheel and check whether the modules is install by using "pip list". There is python-pcl in the list. However, the error arises when I tried to import pcl.

(py35) C:\Users\xuanv\Downloads>python test.py
Traceback (most recent call last):
File "test.py", line 1, in
import pcl
File "C:\Users\xuanv\AppData\Local\conda\conda\envs\py35\lib\site-packages\pcl__init__.py", line 5, in
from ._pcl import *
ImportError: DLL load failed: The specified module could not be found.

Do you have any idea what is going on?

Thanks

@xuanvinhilb were you able to solve this error? I have tried everything but seems nothing works.

@sevenandseven
Copy link

can you tell me how to slove this question?I installed python-pcl-0.3.win-amd64-py3.5.msi

after installing I am facing this issue

from ._pcl import *
ImportError: No module named 'pcl._pcl'

@renezurbruegg
Copy link

Had the same error.

Adding "C:\Program Files\OpenNI2\Redist" and "C:\Program Files\OpenNI2\Samples\Bin" to the path fixed it.

I am using Windows10, python 3.7.3 and PCL 1.9.1.

@mastrogiorgis
Copy link

I also get the same error. Will this be resolved?

@aravindsairam
Copy link

Works for both python2 and python3 (mention python3 if needed)

  • $ sudo pip install cython==0.25.2
  • clone this repo https://github.com/udacity/RoboND-Perception-Exercises
  • $ cd RoboND-Perception-Exercises/python-pcl
  • $ python setup.py build -i
  • $ sudo python setup.py install
  • $ sudo apt-get install pcl-tools
  • export PYTHONPATH=$PYTHONPATH:/usr/local/lib (This is my python path)

If importing pcl outside this directory still give the same error, then uninstall the existing pcl.

  • pip uninstall pcl

@lavalmsc
Copy link

lavalmsc commented Dec 6, 2020

I had the same issue and had to download OpenNI2 and add the OpenNI2.dll from the Tools folder of OpenNI to the PATH.
I use Windows 10 Python 3.6 and installed python-pcl through the wheel file.

I had to add C:\\Program Files\OpenNI2\Redist to the system PATH to get it to work under Windows.

I added all the above-mentioned locations to the system path but still got the same error. any idea? tnx

@lavalmsc
Copy link

lavalmsc commented Dec 6, 2020

The above error is probably due to the missing of necessary path to libraries in the PATH environment. You can use dependency walker to find which library is missing (http://www.dependencywalker.com/)

I am very new to all these issues and I have the same problem. could you explain how to use dependency walker for this special case?

@ghost
Copy link

ghost commented Aug 13, 2021

@xuanvinhilb Thanks for replying. I have followed the steps mentioned in https://github.com/strawlab/python-pcl#set-before-environment-variable

I installed the PCL 1.6.0 All-In-One Installer

and I have copied these path

pcl_path

That was easy and helpfull thanks buddy

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests