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.26k stars 267 forks source link

missing module cv2 #297

Closed LodeVanB closed 5 years ago

LodeVanB commented 5 years ago

/SLM-Lab/slm_lab/lib/util.py", line 5, in import cv2 ModuleNotFoundError: No module named 'cv2'

To Reproduce

  1. OS used: Ubuntu 18 LTS
  2. SLM-Lab git: git cloned
  3. demo.json not working

Additional context had to add cmake libgcc manually

Error logs (base) l@l-HP-Pavilion-dv7-PC:~/SLM-Lab$ python3 run_lab.py slm_lab/spec/demo.json dqn_cartpole dev Traceback (most recent call last): File "run_lab.py", line 10, in from slm_lab.experiment import analysis, retro_analysis File "/home/l/SLM-Lab/slm_lab/experiment/analysis.py", line 5, in from slm_lab.agent import AGENT_DATA_NAMES File "/home/lr/SLM-Lab/slm_lab/agent/init.py", line 21, in from slm_lab.agent import algorithm, memory File "/home/l/SLM-Lab/slm_lab/agent/algorithm/init.py", line 8, in from .actor_critic import File "/home/l/SLM-Lab/slm_lab/agent/algorithm/actor_critic.py", line 1, in from slm_lab.agent import net File "/home/l/SLM-Lab/slm_lab/agent/net/init.py", line 6, in from slm_lab.agent.net.conv import File "/home/l/SLM-Lab/slm_lab/agent/net/conv.py", line 1, in from slm_lab.agent.net import net_util File "/home/l/SLM-Lab/slm_lab/agent/net/net_util.py", line 3, in from slm_lab.lib import logger, util File "/home/lr/SLM-Lab/slm_lab/lib/logger.py", line 1, in from slm_lab.lib import util File "/home/l*/SLM-Lab/slm_lab/lib/util.py", line 5, in import cv2 ModuleNotFoundError: No module named 'cv2'

kengz commented 5 years ago

Hi @LodeVanB seems like you did not activate the conda environment. Try running conda activate lab before running a lab command

LodeVanB commented 5 years ago

kengz, It doesn't work in (lab) either ... there is no module cv2 and for my ubuntu distro it isn't apparently not available if I try to install it with pip ... rerun now explicit in lab: (lab) l@l-HP-Pavilion-dv7-PC:~/SLM-Lab$ python3 run_lab.py slm_lab/spec/demo.json dqn_cartpole dev ImportError: numpy.core.multiarray failed to import Traceback (most recent call last): File "run_lab.py", line 10, in from slm_lab.experiment import analysis, retro_analysis File "/home/l/SLM-Lab/slm_lab/experiment/analysis.py", line 5, in from slm_lab.agent import AGENT_DATA_NAMES File "/home/l/SLM-Lab/slm_lab/agent/init.py", line 21, in from slm_lab.agent import algorithm, memory File "/home/l/SLM-Lab/slm_lab/agent/algorithm/init.py", line 8, in from .actor_critic import File "/home/l/SLM-Lab/slm_lab/agent/algorithm/actor_critic.py", line 1, in from slm_lab.agent import net File "/home/l/SLM-Lab/slm_lab/agent/net/init.py", line 6, in from slm_lab.agent.net.conv import File "/home/l/SLM-Lab/slm_lab/agent/net/conv.py", line 1, in from slm_lab.agent.net import net_util File "/home/l/SLM-Lab/slm_lab/agent/net/net_util.py", line 3, in from slm_lab.lib import logger, util File "/home/l/SLM-Lab/slm_lab/lib/logger.py", line 1, in from slm_lab.lib import util File "/home/l/SLM-Lab/slm_lab/lib/util.py", line 5, in import cv2 File "/home/l/.local/lib/python3.6/site-packages/cv2/init.py", line 3, in from .cv2 import * ImportError: numpy.core.multiarray failed to import

kengz commented 5 years ago

oh multiarray error. Did u do the extra unity installation? If so, uninstall tensorflow and retry. just activate the environment and run pip uninstall tensorflow

LodeVanB commented 5 years ago

I use tensorflow in other projects, why should I uninstall it?

kengz commented 5 years ago

that's the purpose of using a conda virtual environment, so each project has its own environment. tensorflow causes the multiarray error u saw.

kengz commented 5 years ago

closing as resolved.