kengz / SLM-Lab

Modular Deep Reinforcement Learning framework in PyTorch. Companion library of the book "Foundations of Deep Reinforcement Learning".
https://slm-lab.gitbook.io/slm-lab/
MIT License
1.23k stars 263 forks source link

ModuleNotFoundError: No module named 'cv2' #495

Closed luckywlj closed 2 years ago

luckywlj commented 2 years ago

When I want to run SLM lab commands according to Page 193 in Chinese version, there is an error information as follows:

(lab) myhost@luckywlj:~/SLM-Lab$ python run_lab.py slm_lab/spec/benchmark/a2c/a2c_nstep_pong.json a2c_ntep_pong search Traceback (most recent call last): File "run_lab.py", line 4, in from slm_lab.experiment import search File "/home/luckywlj/SLM-Lab/slm_lab/experiment/search.py", line 2, in from slm_lab.lib import logger, util File "/home/luckywlj/SLM-Lab/slm_lab/lib/logger.py", line 1, in from slm_lab.lib import util File "/home/luckywlj/SLM-Lab/slm_lab/lib/util.py", line 7, in import cv2 ModuleNotFoundError: No module named 'cv2'

I don't know what is the cv2 package, so I try to "pip3 install cv2" and failed. Could you please tell me how to solve the problem? thank you !

kengz commented 2 years ago

Hi it's likely that your environment setup failed halfway. Could you show the output from:

conda activate lab
conda list
luckywlj commented 2 years ago

2021-12-05 09-51-21 的屏幕截图

kengz commented 2 years ago

yep it's missing a lot of dependencies. Could you run this from the SLM Lab folder: conda env update -f environment.yml That should set things up. Then you should be able to use it.

luckywlj commented 2 years ago

yep it's missing a lot of dependencies. Could you run this from the SLM Lab folder: conda env update -f environment.yml That should set things up. Then you should be able to use it.

thank you so much! I try it now.