解决:error: subprocess-exited-with-error 的问题
系统和配置:
ubuntu20.04
python3.10
torch2.5.1
pip install时报错如下
(实际指令是:pip3 install -r drl_grasping/python_requirements.txt
)
Collecting python-xlib>=0.17 (from pynput==1.7.6->-r drl_grasping/python_requirements.txt (line 6))Downloading python_xlib-0.33-py2.py3-none-any.whl.metadata (6.2 kB)
Collecting gym<0.20,>=0.17 (from stable-baselines3==1.4.0->stable-baselines3[extra]==1.4.0->-r drl_grasping/python_requirements.txt (line 10))Downloading gym-0.19.0.tar.gz (1.6 MB)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.6/1.6 MB 1.3 MB/s eta 0:00:00Preparing metadata (setup.py) ... errorerror: 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.
错误解决方法:网上说是升setuptools的版本
pip install --upgrade setuptools
但我把setuptools从69.5.1升级到75.6.0以后还是报错。。
pip install --upgrade setuptools
Requirement already satisfied: setuptools in /home/xj/anaconda3/envs/py310/lib/python3.10/site-packages (69.5.1)
Collecting setuptoolsUsing cached setuptools-75.6.0-py3-none-any.whl.metadata (6.7 kB)
Using cached setuptools-75.6.0-py3-none-any.whl (1.2 MB)
Installing collected packages: setuptoolsAttempting uninstall: setuptoolsFound existing installation: setuptools 69.5.1Uninstalling setuptools-69.5.1:Successfully uninstalled setuptools-69.5.1
Successfully installed setuptools-75.6.0
正确解决方法:降setuptools的版本到58.0.0
pip install setuptools==58
pip install setuptools==58
Collecting setuptools==58Downloading setuptools-58.0.0-py3-none-any.whl.metadata (4.9 kB)
Downloading setuptools-58.0.0-py3-none-any.whl (816 kB)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 816.3/816.3 kB 1.7 MB/s eta 0:00:00
Installing collected packages: setuptoolsAttempting uninstall: setuptoolsFound existing installation: setuptools 75.6.0Uninstalling setuptools-75.6.0:Successfully uninstalled setuptools-75.6.0
Successfully installed setuptools-58.0.0
没问题了
Collecting python-xlib>=0.17 (from pynput==1.7.6->-r drl_grasping/python_requirements.txt (line 6))Using cached python_xlib-0.33-py2.py3-none-any.whl.metadata (6.2 kB)
Collecting gym<0.20,>=0.17 (from stable-baselines3==1.4.0->stable-baselines3[extra]==1.4.0->-r drl_grasping/python_requirements.txt (line 10))Using cached gym-0.19.0.tar.gz (1.6 MB)Preparing metadata (setup.py) ... done
Requirement already satisfied: torch>=1.8.1 in /home/xj/anaconda3/envs/py310/lib/python3.10/site-packages (from stable-baselines3==1.4.0->stable-baselines3[extra]==1.4.0->-r drl_grasping/python_requirements.txt (line 10)) (2.5.1)
Requirement already satisfied: cloudpickle in /home/xj/anaconda3/envs/py310/lib/python3.10/site-packages (from stable-baselines3==1.4.0->stable-baselines3[extra]==1.4.0->-r drl_grasping/python_requirements.txt (line 10)) (3.1.0)
Requirement already satisfied: setuptools in /home/xj/anaconda3/envs/py310/lib/python3.10/site-packages (from trimesh==3.9.35->-r drl_grasping/python_requirements.txt (line 12)) (58.0.0)
Requirement already satisfied: opencv-python in /home/xj/anaconda3/envs/py310/lib/python3.10/site-packages (from stable-baselines3[extra]==1.4.0->-r drl_grasping/python_requirements.txt (line 10)) (4.10.0.84)