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

MINIWOB_BASE_URL environment variable not defined #2

Closed
3rdCore opened this issue May 29, 2023 · 5 comments
Closed

MINIWOB_BASE_URL environment variable not defined #2

3rdCore opened this issue May 29, 2023 · 5 comments

Comments

@3rdCore
Copy link

3rdCore commented May 29, 2023

Hello,

After installing the different required packages, I tried to run an experiment on the choose-list environment using the command line you provided :

python main.py --env choose-list --llm chatgpt --num-episodes 1 --irci 1 --sgrounding

And I got the following error :

(RCI-agent) PS C:\Users\Tom\Desktop\rci-agent> python main.py --env choose-list --llm chatgpt --num-episodes 1 --irci 1 --sgrounding
INFO:root:Starting WebDriver Instance 0
C:\Users\Tom\miniconda3\envs\RCI-agent\lib\site-packages\gym\utils\passive_env_checker.py:20: UserWarning: WARN: It seems a Box observation space is an image but the `dtype` is not `np.uint8`, actual type: int32. If the Box observation space is not an image, we recommend flattening the observation to have only a 1D vector.
  logger.warn(
C:\Users\Tom\miniconda3\envs\RCI-agent\lib\site-packages\gym\utils\passive_env_checker.py:174: UserWarning: WARN: Future gym versions will require that `Env.reset` can be passed a `seed` instead of using `Env.seed` for resetting the environment random number generator.
  logger.warn(
C:\Users\Tom\miniconda3\envs\RCI-agent\lib\site-packages\gym\utils\passive_env_checker.py:187: UserWarning: WARN: Future gym versions will require that `Env.reset` can be passed `options` to allow the environment initialisation to be passed additional information.
  logger.warn(
INFO:selenium.webdriver.common.selenium_manager:Applicable driver not found; attempting to install with Selenium Manager (Beta)

DevTools listening on ws://127.0.0.1:51802/devtools/browser/6802c38e-d0ec-42dd-b55b-0574baaefc72
ERROR:root:Page did not load properly. Wrong MINIWOB_BASE_URL?
INFO:root:Closed instance 0
Exception in thread Thread-1:
Traceback (most recent call last):
  File "C:\Users\Tom\miniconda3\envs\RCI-agent\lib\threading.py", line 980, in _bootstrap_inner
    self.run()
  File "c:\users\tom\desktop\rci-agent\computergym\computergym\miniwob\miniwob_interface\instance.py", line 128, in run
    self.create_driver()
  File "c:\users\tom\desktop\rci-agent\computergym\computergym\miniwob\miniwob_interface\instance.py", line 200, in create_driver
    raise e
        (No symbol) [0x0034A304]
        (No symbol) [0x0035C482]
        (No symbol) [0x0034A0B6]
        (No symbol) [0x00327E08]
        (No symbol) [0x00328F2D]
        GetHandleVerifier [0x006C8E3A+2540266]
        GetHandleVerifier [0x00708959+2801161]
        GetHandleVerifier [0x0070295C+2776588]
        GetHandleVerifier [0x004F2280+612144]
        (No symbol) [0x00404F6C]
        (No symbol) [0x004011D8]
        (No symbol) [0x004012BB]
        (No symbol) [0x003F4857]
        BaseThreadInitThunk [0x76C97D59+25]
        RtlInitializeExceptionChain [0x77C9B74B+107]
        RtlClearBits [0x77C9B6CF+191]

I tried to run the file environment.py and got the same issue. The reason is that the environment variable MINIWOB_BASE_URL is not defined.

debug console :

import os 
base_url=os.environ.get("MINIWOB_BASE_URL")
print(base_url)
None

Am I supposed to define this environment variable myself?

PS : I'm running on Windows 11, Python 3.9.16, and I use a conda env.

@3rdCore
Copy link
Author

3rdCore commented May 29, 2023

I might have found some informations here : https://github.com/stanfordnlp/wge

From the associated README.md :

MiniWoB setup

  • There are 2 ways to access MiniWoB tasks:
    1. Use the file:// protocol (Recommended):
      Open miniwob-sandbox/html/ in the browser,
      and then export the URL to the MINIWOB_BASE_URL environment variable:
    export MINIWOB_BASE_URL='file:///path/to/miniwob-sandbox/html/'
    
    1. Run a simple server: go to miniwob-sandbox/html/ and run the supplied http-serve.
    • The tasks should now be accessible at http://localhost:8080/miniwob/
    • To use a different port (say 8765), run http-serve 8765, and then
      export the following to the MINIWOB_BASE_URL environment variable:
    export MINIWOB_BASE_URL='http://localhost:8765/'
    
  • Once you've followed one of the steps above, test MiniWoBEnvironment by running
    pytest wge/tests/miniwob/test_environment.py -s
    

Am I supposed to run a server in parallel on which queries will be made?

@3rdCore
Copy link
Author

3rdCore commented May 29, 2023

Update : the error is Windows related. This makes sense, as miniWoB is not officially supported on Windows. I was able to run the code almost out of the box with WSL, I just had to change the executable path for the chromedriver (this is specific for WSL) :

/usr/bin/chromedriver to /usr/local/bin/chromedriver

@3rdCore 3rdCore closed this as completed May 29, 2023
@posgnu
Copy link
Owner

posgnu commented Jun 2, 2023

Thanks for reporting this :)

@RajNS02
Copy link

RajNS02 commented Jul 11, 2023

@3rdCore I have downloaded and unzipped chromedriver outside this repo's directory and also provided its path to PATH environment variable. But I am still getting this error.
PS: I'm running on Windows 10, Python 3.9.4, and using python base env. Also, I am just running this on VSCode since I don't have WSL installed on my machine.

Any help would be greatly appreciated! Thanks!

@RajNS02
Copy link

RajNS02 commented Jul 11, 2023

Update: Figured out the solution using Bard :)

Steps:

  1. Change self.driver = webdriver.Chrome(chrome_options=options) to self.driver = webdriver.Chrome(options=options) on line 179 in instance.py as per latest documentation. Do the same thing for line 118 in main.py

  2. As stated in the exception, the main problem is fetching the value of MINIWOB_BASE_URL environment variable.
    So, hardcode the value of base_url at line 1134 in fields.py and line 186 in environment.py as file:///this_repo_path/computergym/computergym/miniwob/miniwob_interface/html/

  3. If you still get the error, change the line 101 in instance.py from
    self.url = urlparse.urljoin(base_url, "miniwob/{}.html".format(subdomain)) to
    self.url = urlparse.urljoin(base_url, "{}.html".format(subdomain))
    Reason: An extra miniwob is appearing before /{subdomain}.html
    Eg - file:///this_repo_path/computergym/computergym/miniwob/miniwob_interface/html/miniwob/miniwob/click_list.html

Just to be safe, comment out line 87 in instance.py (Only if you don't want to work with flight tasks). Have to do more digging to resolve this issue for flight tasks.

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

3 participants