unitreerobotics / unitree_rl_gym

BSD 3-Clause "New" or "Revised" License
85 stars 19 forks source link

ModuleNotFoundError: No module named “legged_gym” #3

Open lupinjia opened 3 months ago

lupinjia commented 3 months ago

Background

I followed the doc to configure the example, but encountered ModuleNotFoundError: No module named “legged_gym” as I tried to run python3 train.py --task=go2.

Analysis

I doublechecked the sys.path.append() line and ensured that I put my local path of unitree_rl_gym/legged_gym, but it still threw this error. I'm not sure if this is only my case.

I referred to legged_gym, rearranged the file structure and added a setup.py. After pip install -e, the code could run normally.

The file structure is as follows:

|—— legged_gym
    |—— envs
    |—— scripts
    |—— utils
|—— resources
|—— setup.py

By the way, I think the version of rsl_rl(1.0.2) should be noted in the doc, cauz the newer version is not compatible with this repo

lupinjia commented 3 months ago

I have showed the solution in the issue

On Wed, Apr 3, 2024 at 4:20 PM xdd7561 @.***> wrote:

Hi, were you able to solve this problem? I have same error.

— Reply to this email directly, view it on GitHub https://github.com/unitreerobotics/unitree_rl_gym/issues/3#issuecomment-2033881954, or unsubscribe https://github.com/notifications/unsubscribe-auth/BC47LZ76CONTFO4CTJXOMGTY3O3TRAVCNFSM6AAAAABFFW2WS2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMZTHA4DCOJVGQ . You are receiving this because you authored the thread.Message ID: @.***>

HuangDou228 commented 1 month ago

well, there is a simple way to solve this problem. First, I run python train.py --task=go2 instead of python3 train.py --task=go2 in unitree_rl_gym/legged_gym. After that, it reported an error saying that the go2 task is not registered. Then, I just simply copy unitree_rl_gym/legged_gym/envs/go2 to legged_gym/legged_gym/envs/and unitree_rl_gym/resources/robots/go2 to legged_gym/resources/robots/ and succeed.