Error in Loading the CityLearn environment

This is how I install

!git clone http://gitlab.aicrowd.com/aicrowd/challenges/citylearn-challenge-2022/citylearn-2022-starter-kit.git
!pip install git+https://github.com/intelligent-environments-lab/CityLearn.git@v1.3.4

Environment setup:

from citylearn.citylearn import CityLearnEnv

env = CityLearnEnv(schema='/content/citylearn-2022-starter-kit/data/citylearn_challenge_2022_phase_1/schema.json')

This gives following error

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-5-62c22b08e860> in <module>()
      1 from citylearn.citylearn import CityLearnEnv
      2 
----> 3 env = CityLearnEnv(schema='/content/citylearn-2022-starter-kit/data/citylearn_challenge_2022_phase_1/schema.json')

9 frames
/usr/local/lib/python3.7/dist-packages/citylearn/citylearn.py in __init__(self, schema, **kwargs)
     35         self.__rewards = None
     36         self.buildings, self.time_steps, self.seconds_per_time_step,\
---> 37             self.reward_function, self.central_agent, self.shared_observations = self.__load()
     38         super().__init__(**kwargs)
     39 

/usr/local/lib/python3.7/dist-packages/citylearn/citylearn.py in __load(self)
    774         reward_function_module = '.'.join(reward_function_type.split('.')[0:-1])
    775         reward_function_name = reward_function_type.split('.')[-1]
--> 776         reward_function_constructor = getattr(importlib.import_module(reward_function_module), reward_function_name)
    777         agent_count = 1 if central_agent else len(buildings)
    778         reward_function = reward_function_constructor(agent_count=agent_count,**reward_function_attributes)

/usr/lib/python3.7/importlib/__init__.py in import_module(name, package)
    125                 break
    126             level += 1
--> 127     return _bootstrap._gcd_import(name[level:], package, level)
    128 
    129 

/usr/lib/python3.7/importlib/_bootstrap.py in _gcd_import(name, package, level)

/usr/lib/python3.7/importlib/_bootstrap.py in _find_and_load(name, import_)

/usr/lib/python3.7/importlib/_bootstrap.py in _find_and_load_unlocked(name, import_)

/usr/lib/python3.7/importlib/_bootstrap.py in _call_with_frames_removed(f, *args, **kwds)

/usr/lib/python3.7/importlib/_bootstrap.py in _gcd_import(name, package, level)

/usr/lib/python3.7/importlib/_bootstrap.py in _find_and_load(name, import_)

/usr/lib/python3.7/importlib/_bootstrap.py in _find_and_load_unlocked(name, import_)

ModuleNotFoundError: No module named 'rewards'

@kingsley_nweye
Any thoughts on this error, Am I missing something. ?

Hi @h90sharma, I think the error is coming from the reference to the reward function type in the schema.json. 2 things to check:

  1. Make sure you have the latest starter-kit cloned.
  2. Make sure you have rewards.user_reward.UserReward as reward function type in your local schema as it is in the starter kit schema.