floatlazer / semantic_slam

Real time semantic slam in ROS with a hand held RGB-D camera
GNU General Public License v3.0
647 stars 179 forks source link

Python environment's problem #5

Open michaelczhou opened 6 years ago

michaelczhou commented 6 years ago

Hi: Your job looks like awesome.When I run "roslaunch semantic_slam semantic_mapping.launch",I met some wrong.

[ INFO] [1539334068.008475645]: Semantic octomap generator [max fusion]
Traceback (most recent call last):
  File "/home/zc/catkin_car/src/semantic_slam-master/semantic_cloud/src/semantic_cloud.py", line 21, in <module>
    from color_pcl_generator import PointType, ColorPclGenerator
  File "/home/zc/catkin_car/devel/lib/python2.7/dist-packages/color_pcl_generator/__init__.py", line 35, in <module>
    exec(__fh.read())
  File "<string>", line 1, in <module>
ImportError: cannot import name 'PointType'

Thanks.

jsdd25 commented 5 years ago

@michaelczhou , Hi, I have the same problem as you. Did you fix it? Thanks!

michaelczhou commented 5 years ago

@jsdd25 make sure your python's environment is belong to ROS ,my mistake is forgetting to close annoconda. if this can't work ,you can try to reinstall ROS.

harnix commented 5 years ago

@jsdd25 I ran into the same issue because I had multiple python versions installed. This was solved by specifying the right python version to run the code within semantic_cloud.py ros node. Hope that helps

zouyajing commented 5 years ago

@jsdd25 make sure your python's environment is belong to ROS ,my mistake is forgetting to close annoconda. if this can't work ,you can try to reinstall ROS.

Hi. I have both python2.7 and 3.5. I have tried two ways but both not work for me.

  1. !/usr/bin/env python2.7 or 3.5

  2. catkin build --cmake-args -DPYTHON_VERSION=3.5 Can you tell me more details about solving this problem ?
zouyajing commented 5 years ago

@harnix Sorry. can you tell me more detail about avoiding this error ? I am a little confused about the python environment. Thanks.

codieboomboom commented 3 years ago

For whoever running into the same problem, pls try delete the content of the color_pcl_generator/init.py in the include folder (make it empty .py file)

reem90 commented 3 years ago

@AnhTuDo1990 What do you mean by empty? the content of the file or the name of the file? @all I am using python 3.8, I changed the first line in the semantic_labelling.py to be #!/usr/bin/env python3.8and I got the following error

ImportError: cannot import name 'PointType' from partially initialized module 'color_pcl_generator' (most likely due to a circular import) (/home/hme/catkin_ws/devel/lib/python3/dist-packages/color_pcl_generator/__init__.py)

did any one solve it?

codieboomboom commented 3 years ago

@reem90 make a init.py file with nothing inside

52nogamenolife commented 3 years ago

@michaelczhou I have the same importerror , how did you solve it? I have tried to make an empty init.py, but i didn't work File "/home/lx/work/semantic_slam-master/slam/src/semantic_cloud/src/semantic_cloud.py", line 22, in from color_pcl_generator import PointType, ColorPclGenerator ImportError: cannot import name 'PointType' what should I do? Many thanks!

russelldj commented 2 years ago

I'm lacking context, but for future reference, I believe the correct file is __init__.py not init.py.