cnlohr / esp82xx

Useful ESP8266 C Environment
Other
288 stars 107 forks source link

issues with instructions and python-serial #98

Closed SimonGolding closed 3 years ago

SimonGolding commented 3 years ago

Hi this is an issue with the Readme.md and the instructions, the section in question is

_``` Prerequisites (Debian, Mint, Ubuntu): sudo apt-get update sudo apt-get install -y make gcc g++ gperf install-info gawk libexpat-dev python-dev python python-serial sed git unzip bash wget bzip2 libtool-bin Note: Some platforms do not have python-serial. If they don't have it, do this:

curl https://bootstrap.pypa.io/get-pip.py --output get-pip.py sudo python2 get-pip.py pip install pyserial



So the issue is python-serial that has been dropped with python2 in most environments, and the second step "Sudo python2 get-pip.py" also did not work. Returning the following compiler error;

`
sudo python2 get-pip.py
Traceback (most recent call last):
  File "get-pip.py", line 24244, in <module>
    main()
  File "get-pip.py", line 199, in main
    bootstrap(tmpdir=tmpdir)
  File "get-pip.py", line 82, in bootstrap
    from pip._internal.cli.main import main as pip_entry_point
  File "/tmp/tmpZgJI7n/pip.zip/pip/_internal/cli/main.py", line 60
    sys.stderr.write(f"ERROR: {exc}")
                                   ^
SyntaxError: invalid syntax
`
I used the following work around "https://github.com/pypa/packaging-problems/issues/433"

`curl https://bootstrap.pypa.io/2.7/get-pip.py | sudo python2`

My final issue after all this (I was setting up a new WSL) was my prerequisites did not completely install due to the error with python-serial, but the environment mostly worked until I was trying to "make burnweb" and GCC could not be found (which was weird as it seemed to pass make all and the ESP8266 was ping-able just couldn't get the web page working)

Going back and reinstalling all the prerequisites just with python-serial removed from the list fixed that issue and I can now build esp8266 projects.

So I suggest the instructions be changed to install python-serial on a separate line and then if it does not work to follow the second instruction with the new work around included.
con-f-use commented 3 years ago

Pip has finally dropped Python 2 support. Python 2 reached its end of life on Jan 1, 2020, over a year ago. Most of the tooling for Python and hosting will drop / delete Python 2 resources.

That is, why you are seeing the traceback with ensurepip. The new version uses the format string syntax in f"ERROR: {exc}", which is a Python-3-only feature. For now, as you mentioned, people can use the old version of get-pip.py to circumvent this: https://github.com/pypa/get-pip/raw/5f38681f7f5872e4032860b54e9cc11cf0374932/get-pip.py

However, this will soon cease to work as Python 2 will not be packaged for most any distribution in the future. The only lasting solution is for all the tools be ported to Python 3.