semantic_slam icon indicating copy to clipboard operation
semantic_slam copied to clipboard

Python environment's problem

Open michaelczhou opened this issue 6 years ago • 10 comments

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.

michaelczhou avatar Oct 12 '18 09:10 michaelczhou

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

jsdd25 avatar Feb 11 '19 07:02 jsdd25

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

michaelczhou avatar Feb 11 '19 11:02 michaelczhou

@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

harnix avatar Apr 18 '19 15:04 harnix

@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 avatar Oct 31 '19 14:10 zouyajing

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

zouyajing avatar Oct 31 '19 14:10 zouyajing

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)

codieboomboom avatar Jan 07 '21 15:01 codieboomboom

@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.8 and 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?

reem90 avatar Jan 20 '21 11:01 reem90

@reem90 make a init.py file with nothing inside

codieboomboom avatar Jan 21 '21 10:01 codieboomboom

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

52nogamenolife avatar Nov 08 '21 12:11 52nogamenolife

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

russelldj avatar Jan 26 '22 17:01 russelldj