<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def from_project_root(cls, project_root, cli_vars):
 """Create a project from a root directory. Reads in dbt_project.yml and packages.yml, if it exists. :param project_root str: The path to the project root to load. :raises DbtProjectError: If the project is missing or invalid, or if the packages file exists and is invalid. :returns Project: The project, with defaults populated. """

        project_root = os.path.normpath(project_root)
        project_yaml_filepath = os.path.join(project_root, 'dbt_project.yml')

        # get the project.yml contents
        if not path_exists(project_yaml_filepath):
            raise DbtProjectError(
                'no dbt_project.yml found at expected path {}'
                .format(project_yaml_filepath)
            )

        if isinstance(cli_vars, compat.basestring):
            cli_vars = parse_cli_vars(cli_vars)
        renderer = ConfigRenderer(cli_vars)

        project_dict = _load_yaml(project_yaml_filepath)
        rendered_project = renderer.render_project(project_dict)
        rendered_project['project-root'] = project_root
        packages_dict = package_data_from_root(project_root)
        return cls.from_project_config(rendered_project, packages_dict)