strawlab / python-pcl

Python bindings to the pointcloud library (pcl)
http://strawlab.github.com/python-pcl/
Other
2.02k stars 700 forks source link

Cannot import pcl #218

Open xuanvinhilb opened 6 years ago

xuanvinhilb commented 6 years ago

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 commented 6 years ago

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

xuanvinhilb commented 6 years ago

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 commented 5 years ago

@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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

@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 commented 5 years ago

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

medakk commented 5 years ago

@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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

What is your python version?

On Fri, 1 Feb 2019, 3:00 pm noxferatus, notifications@github.com wrote:

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)

Any help please...

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/strawlab/python-pcl/issues/218#issuecomment-459661093, or mute the thread https://github.com/notifications/unsubscribe-auth/AWMxZ3Z6_UrPBRMmc1YZoIycmXUIKCmVks5vJAk2gaJpZM4VYTXt .

FelipeDelgadoR commented 5 years ago

Python 3.4 PCL 16

Ajay1207 commented 5 years ago

I suggest use pcl 1.8.1 or 1.9 as python-pcl latest build are for these.

On Sat, 2 Feb 2019, 9:45 pm noxferatus, notifications@github.com wrote:

Python 3.4 PCL 16

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/strawlab/python-pcl/issues/218#issuecomment-459977415, or mute the thread https://github.com/notifications/unsubscribe-auth/AWMxZ-cNRvyV_ZduMuMvShlpgXllXB7vks5vJbm-gaJpZM4VYTXt .

wedesoft commented 5 years ago

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

Bastiiiiii commented 5 years ago

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 commented 5 years ago

@Bastiiiiii how did you do it ?

zhouenbo commented 5 years ago

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

kathanvyas commented 5 years ago

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\pclinit.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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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

aravindsairam commented 4 years ago

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

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

lavalmsc commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

@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