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

安装baselines3出现错误 #20

Closed
zyian0505 opened this issue Sep 15, 2023 · 3 comments
Closed

安装baselines3出现错误 #20

zyian0505 opened this issue Sep 15, 2023 · 3 comments

Comments

@zyian0505
Copy link

(airsim) C:\Users\Administrator\Desktop\UAV_Navigation_DRL_AirSim\stable-baselines3>pip install -e .
Obtaining file:///C:/Users/Administrator/Desktop/UAV_Navigation_DRL_AirSim/stable-baselines3
Preparing metadata (setup.py) ... done
Collecting gym<0.20,>=0.17 (from stable-baselines3==1.4.1a0)
Downloading gym-0.19.0.tar.gz (1.6 MB)
---------------------------------------- 1.6/1.6 MB 1.4 MB/s eta 0:00:00
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error

× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [1 lines of output]
error in gym setup command: 'extras_require' must be a dictionary whose values are strings or lists of strings containing valid project/version requirement specifiers.
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.


您好,我按您的环境需求配置好了,为什么您环境里面的gym会与baselines3里面要求的gym不一致呢?

Package Version Editable project location


airsim 1.6.0
cloudpickle 2.2.1
gym 0.21.0
gym-env 0.0.1 c:\users\administrator\desktop\uav_navigation_drl_airsim\gym_env
keyboard 0.13.5
msgpack-python 0.5.6
msgpack-rpc-python 0.4.1
numpy 1.24.4
opencv-contrib-python 4.8.0.76
Pillow 10.0.0
pip 23.2.1
PyQt5 5.15.6
PyQt5-Qt5 5.15.2
PyQt5-sip 12.12.2
setuptools 68.0.0
torch 1.10.1+cu113
torchaudio 0.10.1+cu113
torchvision 0.11.2+cu113
tornado 4.5.3
typing_extensions 4.7.1
wheel 0.38.0

@zyian0505
Copy link
Author

我自行修改了baselines3的setup.py文件,将其中 "gym>=0.17,<0.20", 修改成了"gym>=0.17,<=0.21",编译通过了。我认为atari-py对本项目来说不是重要的一部分对吗?我的修改能否运行您的项目呢?期待您的解答

@zyian0505
Copy link
Author

运行start_train_with_plot.py出现如下问题(使用的是config_NH_center_SimpleMultirotor_3D.ini):
init training thread
init airsim-gym-env.
Connected!
Client Ver:1 (Min Req: 1), Server Ver:1 (Min Req: 1)

Reward type: reward_final
C:\Users\Administrator\anaconda3\envs\airsim\lib\site-packages\gym\spaces\box.py:73: UserWarning: WARN: Box bound precision lowered by casting to float32
logger.warn(
wandb: Currently logged in as: zyian0505. Use wandb login --relogin to force relogin
wandb: Tracking run with wandb version 0.15.10
wandb: Run data is saved locally in C:\Users\Administrator\Desktop\UAV_Navigation_DRL_AirSim\scripts\wandb\run-20230919_153059-iuoppoqj
wandb: Run wandb offline to turn off syncing.
wandb: Syncing run NH-SM-TD3-M1-algo-compare
wandb: View project at https://wandb.ai/zyian0505/NH_center
wandb: View run at https://wandb.ai/zyian0505/NH_center/runs/iuoppoqj
run training thread
algo: TD3
Using cuda device
Wrapping the env with a Monitor wrapper
Wrapping the env in a DummyVecEnv.
start training model
Traceback (most recent call last):
File "C:\Users\Administrator\Desktop\UAV_Navigation_DRL_AirSim\scripts\utils\thread_train.py", line 249, in run
model.learn(
File "C:\Users\Administrator\Desktop\UAV_Navigation_DRL_AirSim\stable-baselines3\stable_baselines3\td3\td3.py", line 244, in learn
return super(TD3, self).learn(
File "C:\Users\Administrator\Desktop\UAV_Navigation_DRL_AirSim\stable-baselines3\stable_baselines3\common\off_policy_algorithm.py", line 340, in learn
total_timesteps, callback = self._setup_learn(
File "C:\Users\Administrator\Desktop\UAV_Navigation_DRL_AirSim\stable-baselines3\stable_baselines3\common\off_policy_algorithm.py", line 316, in _setup_learn
return super()._setup_learn(
File "C:\Users\Administrator\Desktop\UAV_Navigation_DRL_AirSim\stable-baselines3\stable_baselines3\common\base_class.py", line 435, in _setup_learn
self._last_obs = self.env.reset() # pytype: disable=annotation-type-mismatch
File "C:\Users\Administrator\Desktop\UAV_Navigation_DRL_AirSim\stable-baselines3\stable_baselines3\common\vec_env\dummy_vec_env.py", line 62, in reset
self._save_obs(env_idx, obs)
File "C:\Users\Administrator\Desktop\UAV_Navigation_DRL_AirSim\stable-baselines3\stable_baselines3\common\vec_env\dummy_vec_env.py", line 92, in _save_obs
self.buf_obs[key][env_idx] = obs
ValueError: could not broadcast input array from shape (1,8) into shape (1,28)
Traceback (most recent call last):
File "C:\Users\Administrator\Desktop\UAV_Navigation_DRL_AirSim\scripts\utils\thread_train.py", line 249, in run
model.learn(
File "C:\Users\Administrator\Desktop\UAV_Navigation_DRL_AirSim\stable-baselines3\stable_baselines3\td3\td3.py", line 244, in learn
return super(TD3, self).learn(
File "C:\Users\Administrator\Desktop\UAV_Navigation_DRL_AirSim\stable-baselines3\stable_baselines3\common\off_policy_algorithm.py", line 340, in learn
total_timesteps, callback = self._setup_learn(
File "C:\Users\Administrator\Desktop\UAV_Navigation_DRL_AirSim\stable-baselines3\stable_baselines3\common\off_policy_algorithm.py", line 316, in _setup_learn
return super()._setup_learn(
File "C:\Users\Administrator\Desktop\UAV_Navigation_DRL_AirSim\stable-baselines3\stable_baselines3\common\base_class.py", line 435, in _setup_learn
self._last_obs = self.env.reset() # pytype: disable=annotation-type-mismatch
File "C:\Users\Administrator\Desktop\UAV_Navigation_DRL_AirSim\stable-baselines3\stable_baselines3\common\vec_env\dummy_vec_env.py", line 62, in reset
self._save_obs(env_idx, obs)
File "C:\Users\Administrator\Desktop\UAV_Navigation_DRL_AirSim\stable-baselines3\stable_baselines3\common\vec_env\dummy_vec_env.py", line 92, in _save_obs
self.buf_obs[key][env_idx] = obs
ValueError: could not broadcast input array from shape (1,8) into shape (1,28)


config_NH_center_SimpleMultirotor_3D.ini如下:
[options]
env_name = NH_center
dynamic_name = SimpleMultirotor

navigation_3d = True
using_velocity_state = False
reward_type = reward_final

;depth, lgmd, vector
perception = vector

algo = TD3
total_timesteps = 200000

policy_name = mlp
net_arch = [64, 32, 16]
activation_function = tanh
cnn_feature_num = 25

keyboard_debug = False
generate_q_map = False
q_map_save_steps = 1000

use_wandb = True

[wandb]
name = NH-SM-TD3-M1-algo-compare
notes = none

[environment]
max_depth_meters = 15
screen_height = 60
screen_width = 90

crash_distance = 1
accept_radius = 2

[multirotor]
dt = 0.1
acc_xy_max = 2.0
v_xy_max = 5
v_xy_min = 0.5
v_z_max = 2.0
yaw_rate_max_deg = 30.0

; configs for DRL algorithms
[DRL]
gamma = 0.99
learning_rate = 1e-3
learning_starts = 2000
buffer_size = 50000
batch_size = 1280
train_freq = 500
gradient_steps = 500
action_noise_sigma = 0.1

@zyian0505
Copy link
Author

把cnn_feature_num = 25换成cnn_feature_num = 5解决了

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

1 participant