tomasvr / turtlebot3_drlnav

A ROS2-based framework for TurtleBot3 DRL autonomous navigation
128 stars 18 forks source link

No module named 'torch' error when opening the second terminal #8

Open liwenshulws opened 9 months ago

liwenshulws commented 9 months ago

Hello, excuse me, I encountered an error while running the second terminal‘’ros2 run turtlebot3_drl gazebo_goals ‘’as follows: Traceback (most recent call last): File "/home/h3c/turbobot3_drlnav/install/turbobot3_drl/lib/turbobot3_drl/gazebogoals", line 11, in Load Entry_ Point ('turblebot3 drl ',' console_scripts', 'gazebo_goals') () File "/usr/lib/python3/dist packages/pkgresources/init. py", line 490, in load Entry Point Return get Distribution (dist). load Entry Point (group, name) File "/usr/lib/python3/dist packages/pkgresources/init. py", line 2854, in load Entry_ Point Return ep. load() File "/usr/lib/python3/dist packages/pkg_resources/init. py", line 2445, in load Return self. resolve () File "/usr/lib/python3/dist packages/pkg_resources/init. py", line 2451, in resolve Module= Import (self. module_name, from list=['name '], level=0) File "/home/h3c/turbobot3_drlnav/build/tourlebot3_drl/tourlebot3_drl/drl_gazebo/drlgazebo. py", line 35, in From DRL Environment.drl Environment import ARENA LENGTH, ARENA WIDTH, ENABLE DYNAMIC_ GOALS File "/home/h3c/turbobot3_drlnav/build/turbobot3_drl/turbobot3_drl/drl_environment/drl_environment. py", line 36, in From Common import utilities as util File "/home/h3c/turbobot3_drlnav/build/turbobot3_drl/turbobot3_drl/common/utilities. py", line 8, in Import torch ModuleNotFoundError: No module named 'torch' Why does this error still occur when I have installed Pytorch?

liwenshulws commented 9 months ago

Also, when installing pip3 install matplotlib pandas pyqtgraph=0.12.4 PyQt5=5.14.1 torch=1.10.0+cu113- f https://download.pytorch.org/whl/cu113/torch_stable.html This command will display the following error: ERROR: pip's dependency resolution does not currently take into account all the packages that are installed This behavior is the source of the following dependency conflicts

Torchaudio 0.12.0+cu116 requires torch=1.12.0, but you have torch 1.10.0+cu113 which is incompatible

Torchvision 0.13.0+cu113 requires torch=1.12.0, but you have torch 1.10.0+cu113 which is incompatible

Are these two errors related? How to solve it?

tomasvr commented 7 months ago

Are you using virtual environments? What does pip3 show torch output?

It would be a lot easier to use the docker image I provided, then you won't need to go through installing all of the dependencies yourself. I have provided instructions on how to get started with docker.

NazishT commented 5 months ago

try pip3 install torchvision==0.11.1