platformio-core-installer
platformio-core-installer copied to clipboard
Linux: `apt-get install python3-venv`
Solution
Some Linux distributives have a limited Python3 installed by default. Please install the following package and restart the IDE:
sudo apt-get install python3-venv
If you use a custom Python version, then
sudo apt-get install python3.xx-venv
where python3.xx
equals the version of your Python interpreter (check it via python3 --version
). For example, python3.10-venv
for Python 3.10.
Now, please check your Python installation:
python3 -c "import venv; import ensurepip; print('Congrats! Python `venv` is already installed!')"
Finally, Restart VSCode.
%23 Description of problem Leave a comment...
BEFORE SUBMITTING, PLEASE SEARCH FOR DUPLICATES IN
- https://github.com/platformio/platformio-vscode-ide/issues%3Fq=is%3Aissue
%23 Configuration
VSCode: 1.49.0 PIO IDE: v2.0.1 System: Linux, 4.19.0-10-amd64, x64
%23 Exception
Error: Error: Can not install PlatformIO Core due to a missed `distutils` package in your Python installation.
Please install this package manually using the OS package manager. For example:
$ apt-get install python3-distutils
(MAY require administrator access `sudo`)
-> Installer version: 0.3.4
Platform: Linux-4.19.0-10-amd64-x86_64-with-glibc2.28
Python version: 3.7.3 (default, Jul 25 2020, 13:03:44)
[GCC 8.3.0]
Python path: /usr/bin/python3
Creating a virtual environment at /home/yugo/.platformio/penv
at /home/yugo/.vscode/extensions/platformio.platformio-ide-2.0.1/node_modules/platformio-node-helpers/dist/webpack:/platformio-node-helpers/src/proc.js:138:23
at ChildProcess.c (/home/yugo/.vscode/extensions/platformio.platformio-ide-2.0.1/node_modules/platformio-node-helpers/dist/webpack:/platformio-node-helpers/src/proc.js:124:5)
at ChildProcess.emit (events.js:223:5)
at ChildProcess.EventEmitter.emit (domain.js:475:20)
at maybeClose (internal/child_process.js:1021:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
What's the command for MacOS Catalina? When I try to install PlatformIO on MacOS, I get the following errors:
Error: Error: Can not install PlatformIO Core due to a missed `distutils` package in your Python installation.
Please install this package manually using the OS package manager. For example:
$ apt-get install python3-distutils
(MAY require administrator access `sudo`)
-> Installer version: 0.3.5
Platform: macOS-10.15.7
Python version: 3.9.1 (v3.9.1:1e5d33e9b9, Dec 7 2020, 12:10:52)
[Clang 6.0 (clang-600.0.57)]
Python path: /Library/Frameworks/Python.framework/Versions/3.9/bin/python3
Creating a virtual environment at /Users/kstanl27/.platformio/penv
at /Users/kstanl27/.vscode/extensions/platformio.platformio-ide-2.2.1/node_modules/platformio-node-helpers/dist/index.js:1:879275
at Chi...
Error: Error: Can not install PlatformIO Core due to a missed `distutils` package in your Python installation. Please install this package manually using the OS package manager. For example: $ apt-get install python3-distutils (MAY require administrator access `sudo`) -> Installer version: 0.3.5 Platform: macOS-10.15.7 Python version: 3.9.1 (v3.9.1:1e5d33e9b9, Dec 7 2020, 12:10:52) [Clang 6.0 (clang-600.0.57)] Python path: /Library/Frameworks/Python.framework/Versions/3.9/bin/python3 Creating a virtual environment at /Users/kstanl27/.platformio/penv at /Users/kstanl27/.vscode/extensions/platformio.platformio-ide-2.2.1/node_modules/platformio-node-helpers/dist/index.js:1:879275 at Chi...
onDidChangeNotification @ /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:738
/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:60 [Extension Host] Error: Error: Can not install PlatformIO Core due to a missed `distutils` package in your Python installation.Please install this package manually using the OS package manager. For example:$ apt-get install python3-distutils(MAY require administrator access `sudo`) -> Installer version: 0.3.5Platform: macOS-10.15.7Python version: 3.9.1 (v3.9.1:1e5d33e9b9, Dec 7 2020, 12:10:52) [Clang 6.0 (clang-600.0.57)]Python path: /Library/Frameworks/Python.framework/Versions/3.9/bin/python3Creating a virtual environment at /Users/kstanl27/.platformio/penv at /Users/kstanl27/.vscode/extensions/platformio.platformio-ide-2.2.1/node_modules/platformio-node-helpers/dist/index.js:1:879275 at ChildProcess.c (/Users/kstanl27/.vscode/extensions/platformio.platformio-ide-2.2.1/node_modules/platformio-node-helpers/dist/index.js:1:879169) at ChildProcess.emit (events.js:315:20) at maybeClose (internal/child_process.js:1021:16) at Socket.<anonymous> (internal/child_process.js:443:11) at Socket.emit (events.js:315:20) at Pipe.<anonymous> (net.js:674:12)
b @ /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:60
Obviously there is no sudo apt-get install
on mac. :)
Edit: I've already install Python3 via homebrew to no avail.
I have pyenv
with python with distutils
. Why isn't platformio installation recognizes my shell python?
OK, inside the container:
# apt update
# apt install python3-venv
# python3 -c "$(curl -fsSL https://raw.githubusercontent.com/platformio/platformio/master/scripts/get-platformio.py)"
So I had python-nenv installed in the host, but the container needed it installed as well.
So I had python-nenv installed in the host, but the container needed it installed as well.
I thought you installed it. Of course, it will not work without python3.11-venv
in your case.
So, does it work now?
@ivankravets
@patvdleer, does this command work for you?
rm -rf ~/.platformio/penv python3 -m venv ~/.platformio/penv
Same error...
patrick@patrick-Yoga-Slim-7-Pro-14ACH5:~$ rm -rf ~/.platformio/penv
patrick@patrick-Yoga-Slim-7-Pro-14ACH5:~$ python3 -m venv ~/.platformio/penv
### CHECKED VSCODE HERE ###
patrick@patrick-Yoga-Slim-7-Pro-14ACH5:~$ cd ~/.platformio/penv/
patrick@patrick-Yoga-Slim-7-Pro-14ACH5:~/.platformio/penv$ source bin/activate
(penv) patrick@patrick-Yoga-Slim-7-Pro-14ACH5:~/.platformio/penv$ wget https://raw.githubusercontent.com/platformio/platformio/master/scripts/get-platformio.py
--2023-07-27 23:20:43-- https://raw.githubusercontent.com/platformio/platformio/master/scripts/get-platformio.py
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 2606:50c0:8000::154, 2606:50c0:8002::154, 2606:50c0:8003::154, ...
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|2606:50c0:8000::154|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2731 (2,7K) [text/plain]
Saving to: ‘get-platformio.py’
get-platformio.py 100%[=========================================>] 2,67K --.-KB/s in 0s
2023-07-27 23:20:43 (64,1 MB/s) - ‘get-platformio.py’ saved [2731/2731]
(penv) patrick@patrick-Yoga-Slim-7-Pro-14ACH5:~/.platformio/penv$ python3 get-platformio.py check python
The Python 3.10.6 (/home/patrick/.platformio/penv/bin/python3) interpreter is compatible.
(penv) patrick@patrick-Yoga-Slim-7-Pro-14ACH5:~/.platformio/penv$ echo $?
0
@patvdleer , the get-platformio.py
installer MUST BE RUN outside the virtual environment. So, this source bin/activate
is a REDUNDANT step. Try
rm -rf ~/.platformio/penv
python3 get-platformio.py
@patvdleer , the
get-platformio.py
installer MUST BE RUN outside the virtual environment. So, thissource bin/activate
is a REDUNDANT step. Tryrm -rf ~/.platformio/penv python3 get-platformio.py
when i run python3 get-platformio.py i get this error message
Installer version: 1.2.0 Platform: Linux-5.10.0-1014-oem-x86_64-with-glibc2.29 Python version: 3.8.10 (default, May 26 2023, 14:05:08) [GCC 9.4.0] Python path: /usr/bin/python3 Creating a virtual environment at /home/matheus/.platformio/penv Error: Can not install PlatformIO Core due to a missed
venv` module in your Python installation.
Please install this package manually using the OS package manager. For example:
$ apt-get install python3-venv
(MAY require administrator access sudo
)
but when i run python3 get-platformio.py check python it says its all fine
The Python 3.8.10 (/usr/bin/python3) interpreter is compatible.
` also i alreay installed python3-venv
The Python 3.8.10
Have you read the original comment https://github.com/platformio/platformio-core-installer/issues/85#issue-700409072 ?
It must be the following command in your case with default Python 3.8
apt-get install python3.8-venv
The Python 3.8.10
Have you read the original comment #85 (comment) ?
It must be the following command in your case with default Python 3.8
apt-get install python3.8-venv
already used that comand
apt search python3.8 | grep -e venv -e ensurepip
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
python3.8-venv/focal-updates,focal-security,now 3.8.10-0ubuntu1~20.04.8 amd64 [instalado]
Interactive high-level object-oriented language (pyvenv binary, version 3.8)
Please run the following commands and provide output:
rm -rf ~/.platformio/penv
python3 get-platformio.py --verbose
Please run the following commands and provide output:
rm -rf ~/.platformio/penv python3 get-platformio.py --verbose
Installer version: 1.2.0
Platform: Linux-5.10.0-1014-oem-x86_64-with-glibc2.29
Python version: 3.8.10 (default, May 26 2023, 14:05:08)
[GCC 9.4.0]
Python path: /usr/bin/python3
Creating a virtual environment at /home/matheus/.platformio/penv
DEBUG: Current environment PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
DEBUG: Checking a Python candidate /usr/bin/python3.9
DEBUG: Error: The Python 3.9.5 (/usr/bin/python3.9) interpreter is not compatible.
Reason: Could not find Python `venv` module
Error: Can not install PlatformIO Core due to a missed `venv` module in your Python installation.
Please install this package manually using the OS package manager. For example:
$ apt-get install python3-venv
(MAY require administrator access `sudo`)
Traceback (most recent call last):
File "get-platformio.py", line 105, in <module>
sys.exit(main())
File "get-platformio.py", line 101, in main
subprocess.check_call(command)
File "/usr/lib/python3.8/subprocess.py", line 364, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/usr/bin/python3', '/tmp/tmpdzdpyx9p', '--verbose']' returned non-zero exit status 1.
removing python3.9 it worked
We have improved the installer and now it ignores broken Python installations and uses the compatible Pythons. See https://github.com/platformio/platformio-core-installer/releases/tag/v1.2.1
Hope this release will fix the issue on Linux.
PlatformIO IDE for VSCode 3.3.1 is out! https://github.com/platformio/platformio-vscode-ide/releases/tag/v3.3.1