PaddlePaddle / PARL

A high-performance distributed training framework for Reinforcement Learning
https://parl.readthedocs.io/
Apache License 2.0
3.27k stars 822 forks source link

xparl文件夹无法正常导入 #903

Closed HAOGUOKAI closed 2 years ago

HAOGUOKAI commented 2 years ago

您好,我在使用xparl的时候会出现文件夹中的py文件不能import的情况,但是当我关闭xparl的时候便不会出现该问题。 我的部分代码如下:

from utils.space import Space
from utils.discrete import Discrete

其中utils文件如下: image 但是提示错误信息为:No module named 'utils.space'; 'utils' is not a package

部分错误信息如下: Traceback (most recent call last): File "D:\DevTools\Anaconda3-5.2.0\envs\ray\lib\threading.py", line 932, in _bootstrap_inner self.run() File "D:\DevTools\Anaconda3-5.2.0\envs\ray\lib\threading.py", line 870, in run self._target(*self._args, **self._kwargs) File "D:\DevTools\Anaconda3-5.2.0\envs\ray\lib\site-packages\parl\remote\future_mode\proxy_wrapper_nowait.py", line 92, in _run_object_in_backend raise e File "D:\DevTools\Anaconda3-5.2.0\envs\ray\lib\site-packages\parl\remote\future_mode\proxy_wrapper_nowait.py", line 82, in _run_object_in_backend self._xparl_remote_wrapper_obj = remote_wrapper( File "D:\DevTools\Anaconda3-5.2.0\envs\ray\lib\site-packages\parl\remote\remote_wrapper.py", line 107, in init raise RemoteError('init', traceback_str) parl.remote.exceptions.RemoteError: [PARL remote error when calling function __init__]: No module named 'utils.discrete'; 'utils' is not a package traceback: Traceback (most recent call last): File "D:\DevTools\Anaconda3-5.2.0\envs\ray\lib\site-packages\parl\remote\job.py", line 297, in wait_for_connection cls = load_remote_class(message[1]) File "D:\DevTools\Anaconda3-5.2.0\envs\ray\lib\site-packages\parl\remote\remote_class_serialization.py", line 234, in load_remote_class mod = import(module_name, globals(), locals(), [class_name], 0) File "C:\Users\HGK\AppData\Local\Temp\tmpq_k6l7ai\xparl_27936actor.py", line 12, in from Decode import Decoder, incode2Football File "C:\Users\HGK\AppData\Local\Temp\tmpq_k6l7ai\Decode.py", line 7, in from utils.discrete import Discrete ModuleNotFoundError: No module named 'utils.discrete'; 'utils' is not a package

TomorrowIsAnOtherDay commented 2 years ago

hello,你需要分发utils文件夹才可以import的,可以看下这个文档: https://github.com/PaddlePaddle/PARL/blob/develop/docs/zh_CN/xparl/distribute_files.md

HAOGUOKAI commented 2 years ago

这效率也太高了把,两分钟就回复了,已经把问题解决了。