haarnoja / softqlearning

Reinforcement Learning with Deep Energy-Based Policies
https://arxiv.org/abs/1702.08165
411 stars 94 forks source link

Should I add path in order to run example script? #1

Closed forhaoliu closed 7 years ago

forhaoliu commented 7 years ago

I installed rllab correctly and cloned softqlearning into a different folder. When I was trying to run an example file e.g. python softqlearning/scripts/learn_swimmer.py I was told that

File "softqlearning/scripts/learn_swimmer.py", line 10, in from rllab.tf.envs.base import TfEnv ImportError: No module named 'rllab.tf'

It seems that I need to add some path?

forhaoliu commented 7 years ago

Even after I use export PYTHONPATH=path_to_softqlearning:$PYTHONPATH, it still reports the same error.

haarnoja commented 7 years ago

Are you using python 2 or python 3? You will need python 3.

forhaoliu commented 7 years ago

Following instructions of rlllab, I created a Python 3 environment. I am using this environment to run softqlearning

forhaoliu commented 7 years ago

To verify the following steps are correct, I have even tried rllabplusplus and can run both rllab and rllab++ correctly,

haarnoja commented 7 years ago

I see. You don't need to install rllab for this to work. All dependencies are already included in the rllab/ folder (it's slightly customized version of the actual rllab, that's why it is included in this repo). Make sure rllab refers to the right package.

forhaoliu commented 7 years ago

Cool, I will use anaconda to create a new Python 3 environment instead of run this in the rllab environment. Do you mean I need to add path of this rllab/ to PYTHONPATH?

haarnoja commented 7 years ago

You don't need to add it at all, if you add path to softqlearning root to your PYTHONPATH. Or you can have PYTHONPATH=. and run everything from the root.

forhaoliu commented 7 years ago

I see, thanks. I can run it in a new python 3 environment after adding PYTHONPATH. A wield thing is that in rllab3 environment, even after I use export PYTHONPATH=path_to_softqlearning:$PYTHONPATH, it still can not find the path.

haarnoja commented 7 years ago

Cool. It probably fails because rllab can then be found in two different locations, and python looks into the wrong one which does not have the required module, and it thus fails.

phaniram-sayapaneni commented 5 years ago

I'm having similar problem importing rllab.

  1. Couldn't import rllab?
  2. Also could we do, export PYTHONPATH={$PYTHONPATH}:(pwd) to append path, instead of changing it to pwd

How I have installed:

  1. created custom_path as "softq"
  2. cloned rllab, entered rllab and did export pythonpath
  3. copied all mj files
  4. cloned softqlearning in the path "softq"
  5. activated sql and ran the python example command

Any help would be very much appreciated

phaniram-sayapaneni commented 5 years ago

In rllab directory, there is another rllab. Not sure if it is causing the confusion to import

phaniram-sayapaneni commented 5 years ago

If anyone is still looking at this thread use: python3 while creating the environment, it will work.