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

TypeError: Error instantiating 'calvin_env.envs.play_table_env.PlayTableSimEnv' : expected str, bytes or os.PathLike object, not NoneType disconnecting id 0 from server #69

Open
LPY1219 opened this issue Feb 13, 2024 · 5 comments

Comments

@LPY1219
Copy link

LPY1219 commented Feb 13, 2024

Hi,
Thanks for your efforts on building such an amazing benchmark! I am trying to use it to validate my RL algorithm, but i met some problems when I tried the RL jupyter you provide in the repository. I can successfully run the script by using google colab, but when i transform it into .py file and install the related packages, it can not work.
I can successfuly load the package by " from calvin_env.envs.play_table_env import PlayTableSimEnv". I do not know why the program will give me the above error when it begins to execute " env = hydra.utils.instantiate(cfg.env) ". Can you help me ?

@lukashermann
Copy link
Collaborator

Hi, @LPY1219,
I did what you described and tried to extract the code from the colab to a .py file:

import hydra
import numpy as np
import cv2
from hydra import initialize, compose

with initialize(config_path="./calvin_env/conf"):
  cfg = compose(config_name="config_data_collection.yaml", overrides=["cameras=static_and_gripper"])
  cfg.env["use_egl"] = False
  cfg.env["show_gui"] = False
  cfg.env["use_vr"] = False
  cfg.env["use_scene_info"] = True
  print(cfg.env)


env = hydra.utils.instantiate(cfg.env)
observation = env.reset()
#The observation is given as a dictionary with different values
print(observation.keys())
for i in range(5):
  # The action consists in a pose displacement (position and orientation)
  action_displacement = np.random.uniform(low=-1, high=1, size=6)
  # And a binary gripper action, -1 for closing and 1 for oppening
  action_gripper = np.random.choice([-1, 1], size=1)
  action = np.concatenate((action_displacement, action_gripper), axis=-1)
  observation, reward, done, info = env.step(action)
  rgb = env.render(mode="rgb_array")[:,:,::-1]
  cv2.imshow("win", rgb)
  cv2.waitKey(1)

It runs without errors on my computer, can you try it yourself?

@LPY1219
Copy link
Author

LPY1219 commented Feb 14, 2024

Thanks for your reply! I have sovled it by adding init file in the "calvin_env" directory. And then the program can successfully find the package.

@lukashermann
Copy link
Collaborator

@LPY1219 Great that you solved your issue! Just out of curiosity, did you follow the installation instructions in our README? calvin_env should get installed with pip in the install.sh script, so you wouldn't neet an init file.

@initial-h
Copy link

@LPY1219 Great that you solved your issue! Just out of curiosity, did you follow the installation instructions in our README? calvin_env should get installed with pip in the install.sh script, so you wouldn't neet an init file.

I installed following README, but still need init.py to solve the same error.

@FutureTwT
Copy link

Perhaps because the calvin_env library is cloned in the current directory, the import process looked for the local path instead of the installation path

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

4 participants