Did you use the the Easy Install method for your setup?
Not sure about the error but EOF errors are usually related to incompletely downloaded scripts. Try this:
cd ~/frappe-bench/apps
sudo rm -r erpnext
cd ~/frappe-bench
bench get-app erpnext https://github.com/frappe/erpnext
bench --site <site_name> install-app erpnext