Undefined function wp_set_password

When your plugin loads, pluggable functions aren’t loaded yet, in fact a lot of stuff is not loaded yet, this what actions are for. Hook your function to an action, like plugins_loaded or init, when the WP environment is loaded and initialized:

add_action( 'init', 'wpa80246_init' );

function wpa80246_init(){
    wp_set_password( 'newpass', $user_id );
}