Python Forum
python2 python3 messed up : How to fix ?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
python2 python3 messed up : How to fix ?

I've done what you said but still some errors despite I don't see python2 stuff anymore ...

Here is the entire result of what I've done :
[email protected]:~/SBMS_update/electrodacus-esp32$ pip uninstall platformio
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at pip 21.0 will remove support for this functionality.
Found existing installation: platformio 5.0.3
Uninstalling platformio-5.0.3:
  Would remove:
Proceed (y/n)? y
  Successfully uninstalled platformio-5.0.3
[email protected]:~/SBMS_update/electrodacus-esp32$ python3.8 -m pip install -U platformio
Collecting platformio
  Downloading platformio-5.0.4.tar.gz (213 kB)
     |████████████████████████████████| 213 kB 751 kB/s 
Collecting bottle<0.13
  Downloading bottle-0.12.19-py3-none-any.whl (89 kB)
     |████████████████████████████████| 89 kB 392 kB/s 
Collecting click<8,>=5
  Using cached click-7.1.2-py2.py3-none-any.whl (82 kB)
Collecting colorama
  Using cached colorama-0.4.4-py2.py3-none-any.whl (16 kB)
Collecting marshmallow>=2
  Downloading marshmallow-3.10.0-py2.py3-none-any.whl (46 kB)
     |████████████████████████████████| 46 kB 788 kB/s 
Collecting pyelftools<1,>=0.25
  Using cached pyelftools-0.27-py2.py3-none-any.whl (151 kB)
Requirement already satisfied, skipping upgrade: pyserial!=3.3,<4,>=3 in /home/harold/.local/lib/python3.8/site-packages (from platformio) (3.5)
Requirement already satisfied, skipping upgrade: requests<3,>=2.4.0 in /usr/lib/python3/dist-packages (from platformio) (2.22.0)
Collecting semantic_version<3,>=2.8.1
  Using cached semantic_version-2.8.5-py2.py3-none-any.whl (15 kB)
Collecting tabulate<1,>=0.8.3
  Downloading tabulate-0.8.7-py3-none-any.whl (24 kB)
Building wheels for collected packages: platformio
  Building wheel for platformio ( ... done
  Created wheel for platformio: filename=platformio-5.0.4-py3-none-any.whl size=330216 sha256=fc52785df23e5866c2eb04abd16a0f8bfbd7f55ecc3a724a6569d8ec053842d1
  Stored in directory: /home/harold/.cache/pip/wheels/8b/47/20/da5c76c9353dc81a701902be6c783f4242f4e470d309ad96ea
Successfully built platformio
Installing collected packages: bottle, click, colorama, marshmallow, pyelftools, semantic-version, tabulate, platformio
Successfully installed bottle-0.12.19 click-7.1.2 colorama-0.4.4 marshmallow-3.10.0 platformio-5.0.4 pyelftools-0.27 semantic-version-2.8.5 tabulate-0.8.7
[email protected]:~/SBMS_update/electrodacus-esp32$ platformio update
Please wait while upgrading PlatformIO...
PlatformIO has been successfully upgraded to 5.0.4!

If you like PlatformIO, please:
- follow us on Twitter to stay up-to-date on the latest project news >
- star it on GitHub >
- try PlatformIO IDE for embedded development >

Platform Manager
Platform espressif32
Updating git+ 2.1.0+sha.a58a358                  [Up-to-date]
Updating platformio/toolchain-esp32ulp        1.22851.191205 @ ~1.22851.0        [Up-to-date]
Updating platformio/tool-esptoolpy            1.30000.201119 @ ~1.30000.0        [Up-to-date]
Updating platformio/tool-openocd-esp32        2.1000.20201202 @ ~2.1000.0        [Up-to-date]
Updating platformio/tool-mkspiffs             2.230.0 @ ~2.230.0                 [Up-to-date]
Updating platformio/tool-cmake                3.16.4 @ ~3.16.0                   [Up-to-date]
Updating platformio/tool-ninja                1.7.1 @ ^1.7.0                     [Up-to-date]
Tool Manager: Removing framework-arduinoespressif32 @ 0.0.0+sha.d011dd7
Tool Manager: framework-arduinoespressif32 @ 0.0.0+sha.d011dd7 has been removed!
Tool Manager: Removing framework-espidf @ 3.40001.200521
Tool Manager: framework-espidf @ 3.40001.200521 has been removed!
Tool Manager: Removing toolchain-xtensa32 @ 2.80200.200827
Tool Manager: toolchain-xtensa32 @ 2.80200.200827 has been removed!

Library Manager
Library Storage: /home/harold/.platformio/lib
[email protected]:~/SBMS_update/electrodacus-esp32$ platformio run
Processing serial (platform:; board: nodemcu-32s; framework: arduino, espidf)
Tool Manager: Installing platformio/toolchain-xtensa32 @ ~2.80200.0
Unpacking  [####################################]  100%          
Tool Manager: toolchain-xtensa32 @ 2.80200.200827 has been installed!
Tool Manager: Installing git+
git version 2.25.1
Clonage dans '/home/harold/.platformio/.cache/tmp/pkg-installing-k028okry'...
remote: Enumerating objects: 2369, done.
remote: Counting objects: 100% (2369/2369), done.
remote: Compressing objects: 100% (1704/1704), done.
remote: Total 2369 (delta 515), reused 1578 (delta 454), pack-reused 0
Réception d'objets: 100% (2369/2369), 48.58 Mio | 771.00 Kio/s, fait.
Résolution des deltas: 100% (515/515), fait.
Tool Manager: framework-arduinoespressif32 @ 0.0.0+sha.d011dd7 has been installed!
Tool Manager: Installing platformio/framework-espidf @ ~3.40001.0
Unpacking  [####################################]  100%          
Tool Manager: framework-espidf @ 3.40001.200521 has been installed!
Tool Manager: Installing platformio/tool-scons @ ~4.40001.0
Downloading  [####################################]  100%
Tool Manager: tool-scons @ 4.40001.0 has been installed!
Tool Manager: Removing tool-scons @ 2.20501.191222
Tool Manager: tool-scons @ 2.20501.191222 has been removed!
Verbose mode can be enabled via `-v, --verbose` option
PLATFORM: Espressif 32 (2.1.0+sha.a58a358) > NodeMCU-32S
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (esp-prog) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
 - framework-arduinoespressif32 0.0.0+sha.d011dd7 
 - framework-espidf 3.40001.200521 (4.0.1) 
 - tool-cmake 3.16.4 
 - tool-esptoolpy 1.30000.201119 (3.0.0) 
 - tool-ninja 1.7.1 
 - tool-openocd-esp32 2.1000.20201202 (10.0) 
 - toolchain-esp32ulp 1.22851.191205 (2.28.51) 
 - toolchain-xtensa32 2.80200.200827 (8.2.0)
Traceback (most recent call last):
  File "", line 2, in <module>
    raise RuntimeError(sys.path)
RuntimeError: ['/home/harold/SBMS_update/electrodacus-esp32', '/home/harold/.local/lib/python3.8/site-packages', '/usr/lib/', '/usr/lib/python3.8', '/usr/lib/python3.8/lib-dynload', '/usr/local/lib/python3.8/dist-packages', '/usr/lib/python3/dist-packages', '/usr/lib/python3.8/dist-packages']
OSError: 'python' exited 1:
  File "/home/harold/.local/lib/python3.8/site-packages/platformio/builder/", line 170:
  File "/home/harold/.platformio/packages/tool-scons/scons-local-4.0.1/SCons/Script/", line 598:
    return _SConscript(self.fs, *files, **subst_kw)
  File "/home/harold/.platformio/packages/tool-scons/scons-local-4.0.1/SCons/Script/", line 287:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "/home/harold/.platformio/platforms/espressif32/builder/", line 224:
    target_elf = env.BuildProgram()
  File "/home/harold/.platformio/packages/tool-scons/scons-local-4.0.1/SCons/", line 219:
    return self.method(*nargs, **kwargs)
  File "/home/harold/.local/lib/python3.8/site-packages/platformio/builder/tools/", line 61:
  File "/home/harold/.platformio/packages/tool-scons/scons-local-4.0.1/SCons/", line 219:
    return self.method(*nargs, **kwargs)
  File "/home/harold/.local/lib/python3.8/site-packages/platformio/builder/tools/", line 124:
  File "/home/harold/.platformio/packages/tool-scons/scons-local-4.0.1/SCons/", line 219:
    return self.method(*nargs, **kwargs)
  File "/home/harold/.local/lib/python3.8/site-packages/platformio/builder/tools/", line 222:
  File "/home/harold/.platformio/packages/tool-scons/scons-local-4.0.1/SCons/", line 219:
    return self.method(*nargs, **kwargs)
  File "/home/harold/.local/lib/python3.8/site-packages/platformio/builder/tools/", line 185:
    for key, value in env.ParseFlags(str(raw)).items():
  File "/home/harold/.platformio/packages/tool-scons/scons-local-4.0.1/SCons/", line 815:
  File "/home/harold/.platformio/packages/tool-scons/scons-local-4.0.1/SCons/", line 681:
    arg = self.backtick(arg[1:])
  File "/home/harold/.platformio/packages/tool-scons/scons-local-4.0.1/SCons/", line 599:
    raise OSError("'%s' exited %d" % (command, status))
====================================================================== [FAILED] Took 91.43 seconds ======================================================================

Environment    Status    Duration
-------------  --------  ------------
serial         FAILED    00:01:31.427
================================================================= 1 failed, 0 succeeded in 00:01:31.427 =================================================================
You simply forgot to remove the two lines that we added in !
Ok, I thought that the 2 line would only give some more information without disturbing the process.

Without these 2 lines, it seems to work.

I have another blockage, but connecting to ESP32 now. So I"ll check this on my side.

Thank you very much for sorting this problem out.
Gribouillis likes this post
Just 1 more question :
Was this error because of the setup of my computer or because of something in the procedure I followed at ?
I don't know this python-is-python3 package that you installed. Obviously it changed your default python command from python 2 to python 3, which is good, but it should also have changed the default pip command to work for python 3.

It means that when a site tells you to use the pip command you should use python -m pip instead or perhaps pip3 or even python3.8 -m pip as we did here to make sure that the package is installed for python 3 instead of python 2.

The problem in your case is that the command also installed another command platformio and this command uses python. As you installed it for python 2, it was unable to handle the fact that the python command now runs a different interpreter.
As I see you're a moderator ..
I ticked the "Subscribe and receive email notification of new replies" but never get advised of any new answer on that thread !

Possibly Related Threads…
Thread Author Replies Views Last Post
  Migration of Python2 and Python3 using Modernize and Future Rakshan 4 1,355 Feb-21-2022, 08:26 PM
Last Post: Gribouillis
  Text Order is Kinda Messed Up? Prithak 0 673 Feb-03-2022, 04:00 PM
Last Post: Prithak
  Getting a small Python2 prog to run in Python3 steve140 4 2,696 Apr-19-2020, 09:27 AM
Last Post: steve140
  output mismatching when porting a python from python2 env to python3 env prayuktibid 2 1,982 Jan-21-2020, 04:41 AM
Last Post: prayuktibid
  python3 decoding problem but python2 OK mesbah 0 1,386 Nov-30-2019, 04:42 PM
Last Post: mesbah
  Gnuradio python3 is not compatible python3 xmlrpc library How Can I Fix İt ? muratoznnnn 3 3,994 Nov-07-2019, 05:47 PM
Last Post: DeaD_EyE
  Trying to run a python2 script dagamer1991 3 1,881 Aug-12-2019, 12:33 PM
Last Post: buran
  I think I messed up python.... XavPro_QC 7 10,365 Aug-02-2019, 09:02 PM
Last Post: XavPro_QC
  python2.7 executables thus the system python2.7 was erroring utility.execute()? vivekm 1 1,419 May-20-2019, 11:24 AM
Last Post: vivekm
  Matplotlib is all messed up! 64humans 1 2,928 Mar-16-2019, 08:04 PM
Last Post: libervurto

Forum Jump:

User Panel Messages

Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020