error: espcomm_upload_mem failed ESP8266 ERROR

Also posted at:
https://electronics.stackexchange.com/q/363251
If you're going to do that then please be considerate enough to add links to the other places you cross posted. This will let us avoid wasting time due to duplicate effort and also help others who have the same questions and find your post to discover all the relevant information. When you post links please always use the chain links icon on the toolbar to make them clickable.