python-pcl icon indicating copy to clipboard operation
python-pcl copied to clipboard

Cannot import pcl

Open xuanvinhilb opened this issue 6 years ago • 26 comments

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 avatar Jul 20 '18 16:07 xuanvinhilb

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

skyline624 avatar Jul 24 '18 11:07 skyline624

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,

xuanvinhilb avatar Aug 12 '18 18:08 xuanvinhilb

@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.

medakk avatar Jan 18 '19 09:01 medakk

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)

xuanvinhilb avatar Jan 18 '19 09:01 xuanvinhilb

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

Ajay1207 avatar Jan 18 '19 09:01 Ajay1207

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/)

xuanvinhilb avatar Jan 18 '19 09:01 xuanvinhilb

@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

Ajay1207 avatar Jan 18 '19 09:01 Ajay1207

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

xuanvinhilb avatar Jan 18 '19 10:01 xuanvinhilb

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

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

medakk avatar Jan 18 '19 10:01 medakk

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

Ajay1207 avatar Jan 24 '19 11:01 Ajay1207

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...

FelipeDelgadoR avatar Feb 01 '19 09:02 FelipeDelgadoR

What is your python version?

On Fri, 1 Feb 2019, 3:00 pm noxferatus, [email protected] 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 .

Ajay1207 avatar Feb 01 '19 16:02 Ajay1207

Python 3.4 PCL 16

FelipeDelgadoR avatar Feb 02 '19 16:02 FelipeDelgadoR

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, [email protected] 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 .

Ajay1207 avatar Feb 03 '19 03:02 Ajay1207

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

wedesoft avatar Mar 01 '19 13:03 wedesoft

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.

Bastiiiiii avatar May 16 '19 12:05 Bastiiiiii

@Bastiiiiii how did you do it ?

lonlonago avatar May 29 '19 14:05 lonlonago

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

zhouenbo avatar Jul 09 '19 22:07 zhouenbo

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.

kathanvyas avatar Sep 03 '19 07:09 kathanvyas

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'

sevenandseven avatar Apr 10 '20 11:04 sevenandseven

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.

renezurbruegg avatar Apr 13 '20 14:04 renezurbruegg

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

mastrogiorgis avatar Jun 19 '20 13:06 mastrogiorgis

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

aravindsairam avatar Sep 29 '20 13:09 aravindsairam

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 avatar Dec 06 '20 19:12 lavalmsc

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?

lavalmsc avatar Dec 06 '20 20:12 lavalmsc

@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

ghost avatar Aug 13 '21 00:08 ghost