Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: module 'pypcd' has no attribute 'PointCloud' #12

Open
MahdiSMIDA opened this issue May 9, 2018 · 25 comments
Open

AttributeError: module 'pypcd' has no attribute 'PointCloud' #12

MahdiSMIDA opened this issue May 9, 2018 · 25 comments

Comments

@MahdiSMIDA
Copy link

image

@aliray
Copy link

aliray commented May 19, 2018

i have the same problem? did you address this problem?

@Andymash
Copy link

Andymash commented May 27, 2018

I have the same problem too. Anyone knows how to fix it?
I am using python 3.5 in windows.

@Yuoto
Copy link

Yuoto commented May 30, 2018

try using
from pypcd import pypcd
it works for me

@Broto8
Copy link

Broto8 commented Aug 6, 2018

This solution didn't work here. Anyone else could help?
Python 3.6.5 :: Anaconda on Ubuntu 16.04

edit:
solved adding the line " from pypcd import * " and calling "python2 myscript.py" instead of "python myscript.py".

@mhwasil
Copy link

mhwasil commented Aug 8, 2018

Use python 2 instead of python 3. If you use anaconda, create environment for python 2 if your default is on python 3.

conda create -n env_name python=2.7

To enter your environment:
source activate env_name

Full tutorial about conda environment:
https://conda.io/docs/user-guide/tasks/manage-environments.html

This works for me.

@chowkamlee81
Copy link

Iam using python3.6... Whether it works only for python2?

@chowkamlee81
Copy link

How to make it to work for python3.6? Kindly help

@klintan
Copy link

klintan commented Oct 29, 2018

this PR makes it py3 compatible #9

@mbouhallel
Copy link

mbouhallel commented Jan 21, 2019

Got the same issue, tried using from pypcd import * and calling python2 instead of python, but CloudPoint is still not recognizable
( Using python2.7 on Ubuntu 16.04 )

@mhwasil
Copy link

mhwasil commented Jan 22, 2019

Got the same issue, tried using from pypcd import * and calling python2 instead of python, but CloudPoint is still not recognizable
( Using python2.7 on Ubuntu 16.04 )

Can you do this in your code?

import sys 
print sys.version

And post what it prints

@mbouhallel
Copy link

Got the same issue, tried using from pypcd import * and calling python2 instead of python, but CloudPoint is still not recognizable
( Using python2.7 on Ubuntu 16.04 )

Can you do this in your code?

import sys 
print sys.version

And post what it prints

2.7.12 (default, Nov 12 2018, 14:36:49)
[GCC 5.4.0 20160609]

@mhwasil
Copy link

mhwasil commented Jan 22, 2019

Got the same issue, tried using from pypcd import * and calling python2 instead of python, but CloudPoint is still not recognizable
( Using python2.7 on Ubuntu 16.04 )

Can you do this in your code?

import sys 
print sys.version

And post what it prints

2.7.12 (default, Nov 12 2018, 14:36:49)
[GCC 5.4.0 20160609]

can you post your code and the error?

@mbouhallel
Copy link

mbouhallel commented Jan 22, 2019

Got the same issue, tried using from pypcd import * and calling python2 instead of python, but CloudPoint is still not recognizable
( Using python2.7 on Ubuntu 16.04 )

Can you do this in your code?

import sys 
print sys.version

And post what it prints

2.7.12 (default, Nov 12 2018, 14:36:49)
[GCC 5.4.0 20160609]

can you post your code and the error?

from pypcd import * pc2 = pypcd.PointCloud.from_path("test.pcd")

Obviously test.pcd is in the same folder as the python script.

Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python2.7/dist-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 699, in runfile execfile(filename, namespace) File "/usr/lib/python2.7/dist-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 81, in execfile builtins.execfile(filename, *where) File "/home/laer1/Desktop/msbouhallel/projet-kinect/pypcd.py", line 1, in <module> from pypcd import * File "pypcd.py", line 3, in <module> pc2 = pypcd.PointCloud.from_path("test.pcd") NameError: name 'pypcd' is not defined

@mhwasil
Copy link

mhwasil commented Jan 22, 2019

Got the same issue, tried using from pypcd import * and calling python2 instead of python, but CloudPoint is still not recognizable
( Using python2.7 on Ubuntu 16.04 )

Can you do this in your code?

import sys 
print sys.version

And post what it prints

2.7.12 (default, Nov 12 2018, 14:36:49)
[GCC 5.4.0 20160609]

can you post your code and the error?

from pypcd import * pc2 = pypcd.PointCloud.from_path("test.pcd")

Obviously test.pcd is in the same folder as the python script.

Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python2.7/dist-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 699, in runfile execfile(filename, namespace) File "/usr/lib/python2.7/dist-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 81, in execfile builtins.execfile(filename, *where) File "/home/laer1/Desktop/msbouhallel/projet-kinect/pypcd.py", line 1, in <module> from pypcd import * File "pypcd.py", line 3, in <module> pc2 = pypcd.PointCloud.from_path("test.pcd") NameError: name 'pypcd' is not defined

You have already imported everything with *, which means it will load all the functions of pypcd, if you want to keep it like that, the code should be:

from pypcd import * 
pc2 = PointCloud.from_path("test.pcd")

or you can do like the following

import pypcd
pc2 = pypcd.PointCloud.from_path("test.pcd")

@mbouhallel
Copy link

Got the same issue, tried using from pypcd import * and calling python2 instead of python, but CloudPoint is still not recognizable
( Using python2.7 on Ubuntu 16.04 )

Can you do this in your code?

import sys 
print sys.version

And post what it prints

2.7.12 (default, Nov 12 2018, 14:36:49)
[GCC 5.4.0 20160609]

can you post your code and the error?

from pypcd import * pc2 = pypcd.PointCloud.from_path("test.pcd")
Obviously test.pcd is in the same folder as the python script.
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python2.7/dist-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 699, in runfile execfile(filename, namespace) File "/usr/lib/python2.7/dist-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 81, in execfile builtins.execfile(filename, *where) File "/home/laer1/Desktop/msbouhallel/projet-kinect/pypcd.py", line 1, in <module> from pypcd import * File "pypcd.py", line 3, in <module> pc2 = pypcd.PointCloud.from_path("test.pcd") NameError: name 'pypcd' is not defined

You have already imported everything with *, which means it will load all the functions of pypcd, if you want to keep it like that, the code should be:

from pypcd import * 
pc2 = PointCloud.from_path("test.pcd")

or you can do like the following

import pypcd
pc2 = pypcd.PointCloud.from_path("test.pcd")

I tried it of course, if I sent it it's because I tried every possible way of using PointCloud.

Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python2.7/dist-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 699, in runfile execfile(filename, namespace) File "/usr/lib/python2.7/dist-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 81, in execfile builtins.execfile(filename, *where) File "/home/laer1/Desktop/msbouhallel/projet-kinect/pypcd.py", line 1, in <module> from pypcd import * File "pypcd.py", line 2, in <module> pc2 = PointCloud.from_path("test.pcd") NameError: name 'PointCloud' is not defined

@mhwasil
Copy link

mhwasil commented Jan 22, 2019

Got the same issue, tried using from pypcd import * and calling python2 instead of python, but CloudPoint is still not recognizable
( Using python2.7 on Ubuntu 16.04 )

Can you do this in your code?

import sys 
print sys.version

And post what it prints

2.7.12 (default, Nov 12 2018, 14:36:49)
[GCC 5.4.0 20160609]

can you post your code and the error?

from pypcd import * pc2 = pypcd.PointCloud.from_path("test.pcd")
Obviously test.pcd is in the same folder as the python script.
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python2.7/dist-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 699, in runfile execfile(filename, namespace) File "/usr/lib/python2.7/dist-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 81, in execfile builtins.execfile(filename, *where) File "/home/laer1/Desktop/msbouhallel/projet-kinect/pypcd.py", line 1, in <module> from pypcd import * File "pypcd.py", line 3, in <module> pc2 = pypcd.PointCloud.from_path("test.pcd") NameError: name 'pypcd' is not defined

You have already imported everything with *, which means it will load all the functions of pypcd, if you want to keep it like that, the code should be:

from pypcd import * 
pc2 = PointCloud.from_path("test.pcd")

or you can do like the following

import pypcd
pc2 = pypcd.PointCloud.from_path("test.pcd")

I tried it of course, if I sent it it's because I tried every possible way of using PointCloud.

Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python2.7/dist-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 699, in runfile execfile(filename, namespace) File "/usr/lib/python2.7/dist-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 81, in execfile builtins.execfile(filename, *where) File "/home/laer1/Desktop/msbouhallel/projet-kinect/pypcd.py", line 1, in <module> from pypcd import * File "pypcd.py", line 2, in <module> pc2 = PointCloud.from_path("test.pcd") NameError: name 'PointCloud' is not defined

so both did not work? The first one should also work, I just tried it. See the following line from the log

 File "/home/laer1/Desktop/msbouhallel/projet-kinect/pypcd.py"

Try the second one, and try the following

import pypcd
print pypcd.__file__

Maybe it's something to do with the installation.

If you want to install from source, follow the installation procedure in Readme.md (remember to download data asset), otherwise you can install it via pip.

@pmsmall
Copy link

pmsmall commented Apr 26, 2019

Change

import pypcd.PointCloud

To

import pypcd.pypcd.PointCloud

This problem could be resovled

@pmsmall
Copy link

pmsmall commented Apr 26, 2019

Edit Lib\site-packages\pypcd_init_.py could solve the problem
Change

from pypcd import *

To

from .pypcd import *

This error may be caused by the same name--'pypcd', of the module and source file.

@mtshikomba
Copy link

I am currently experiencing the same issue and none of the solutions below worked for me.

I am using anaconda with python 3.7.

@shujonnaha
Copy link

I am currently experiencing the same issue and none of the solutions below worked for me.

I am using anaconda with python 3.7.

You can try this one https://github.com/weidezhang/pypcd_python3.6/tree/ebd6096e9c0778e5cd159430b2ef7335b2e55660

@carltondaniel
Copy link

"""https://blog.pollithy.com/python/numpy/pointcloud/tutorial-pypcd"""
install using the below command its a sure fix.
python3.6 -m pip install --user git+https://github.com/DanielPollithy/pypcd.git

@Guan23
Copy link

Guan23 commented Apr 29, 2022

这个包不大,建议直接下载,然后大家也不要纠结究竟要import多少个pypcd,只要看看源码就明白了。Pointcloud类的位置在pypcd/pypcd/pypcd.py里面,大家找到这个位置,然后按照相对路径import即可。

是否python setup.py install都无所谓,install了,就import pypcd.pypcd.pypcd as pypcd(第一个是父文件夹pypcd,第二个是子文件夹pypcd,第三个是pypcd.py),然后就可以pypcd.Pointcloud了。

哪怕没有python setup.py install,直接把这个包下载到你的工程目录里,自己照着相对路径import即可。原理同上,重要的是在源码里找到你要调用的那个类或者那个函数的具体位置。

其他的类或者函数也是如此,作者在大部分py开头写了__all__列表,大家看看那个列表,里面有的,就代表可以import的,没有的八成是一些只在当前脚本内有用的函数,那个函数也没必要对外使用。上述方法python2或python3都可运行。

@YeetSama543
Copy link

I had this issue too. For me, I was using the wrong Python interpreter.

@Diantelope
Copy link

这个包不大,建议直接下载,然后大家也不要纠结究竟要import多少个pypcd,只要看看源码就明白了。Pointcloud类的位置在pypcd/pypcd/pypcd.py里面,大家找到这个位置,然后按照相对路径import即可。

是否python setup.py install都无所谓,install了,就import pypcd.pypcd.pypcd as pypcd(第一个是父文件夹pypcd,第二个是子文件夹pypcd,第三个是pypcd.py),然后就可以pypcd.Pointcloud了。

哪怕没有python setup.py install,直接把这个包下载到你的工程目录里,自己照着相对路径import即可。原理同上,重要的是在源码里找到你要调用的那个类或者那个函数的具体位置。

其他的类或者函数也是如此,作者在大部分py开头写了__all__列表,大家看看那个列表,里面有的,就代表可以import的,没有的八成是一些只在当前脚本内有用的函数,那个函数也没必要对外使用。上述方法python2或python3都可运行。

太感谢了!靠这个方法终于解决了!!!

@Guan23
Copy link

Guan23 commented Apr 23, 2024 via email

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

No branches or pull requests