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

ImportError: cannot import name 'PointType' from partially initialized module 'color_pcl_generator' #39

Open
xhding1997 opened this issue Mar 4, 2021 · 4 comments

Comments

@xhding1997
Copy link

I try to use this command: roslaunch semantic_slam semantic_mapping.launch
And I got some trouble here.

ImportError: cannot import name 'PointType' from partially initialized module 'color_pcl_generator' (most likely due to a circular import) (/home/bie/ros_ws/Sem_SLAM/devel/lib/python3/dist-packages/color_pcl_generator/init.py)
[semantic_cloud-2] process has died [pid 18524, exit code 1, cmd /home/bie/ros_ws/Sem_SLAM/src/semantic_slam/semantic_cloud/src/semantic_cloud.py __name:=semantic_cloud __log:=/home/bie/.ros/log/d5a89544-7cc5-11eb-a228-244bfecec228/semantic_cloud-2.log].
log file: /home/bie/.ros/log/d5a89544-7cc5-11eb-a228-244bfecec228/semantic_cloud-2*.log

A circular import ?
I'm using python3.8, does it matter?

@xhding1997
Copy link
Author

I have tried to set semantic_slam/semantic_cloud/include/color_pcl_generator/init.py to empty, but it doesn't work.

@xhding1997
Copy link
Author

I think I found some key problems.
When using the installation instructions recommended by the ROS official website (sudo apt-get install ros-noetic-desktop-full), Noetic will be installed to python3 at this time. You can find rospkg in the directory /usr/lib/python3/dist-packages.
But rospkg cannot be found in the directory /usr/lib/python2.7/dist-packages.
On another computer using ubuntu16.04, use sudo apt-get install ros-kinetic-desktop-full to install ros. You can find rospkg in the directory /usr/lib/python2.7/dist-packages.
When executing roslunch, the terminal will execute with python2.7, so rospkg cannot be found. When you change the terminal to the default python3 execution, you can find rospkg. But the new problem is that an error "most likely due to a circular import" will be reported. I have deleted the contents of init.py, and now it is a blank file, but it still cannot solve this bug.

Is it because this project cannot be run in the python3 environment?

@ahmadkh1995
Copy link

ahmadkh1995 commented Mar 10, 2021

Hi
before run $ catkin_make just create a filename.txt file and insert below libraries and packages to it and then :

setuptools>=41.0.0
numpy>=1.15
scipy
Pillow
cython
opencv-python==3.3.1.11
matplotlib
scikit-image
tensorflow-gpu==1.13.1
keras==2.0.8
h5py
imageio==2.6.1
imgaug
pandas
future
torch
torchvision
protobuf
IPython[all]

just note than if you don't have gpu on your PC use " tensorflow==1.13.1 " instead.
and then install all of those packages and libraries with this command;

$ pip install filename.txt

This will solve your problem.You don't need to modify any source files of the project...

@MarvinChung
Copy link

MarvinChung commented Dec 17, 2021

I have the same issue. I am using python3 and my rosdistro is noetic.
I solve this by changing the file semantic_slam/semantic_cloud/include/color_pcl_generator/init.py
from

from color_pcl_generator import PointType, ColorPclGenerator

to

from .color_pcl_generator import PointType, ColorPclGenerator

I think that using python2 and older ros version may not have this issue. Otherwise it might be that you forget to deactivate the conda environment which is shown in issue 5: Python environment's problem

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

3 participants