Cannot install platform espressif32 on docker ubuntu:rolling. PIO 4.3.4-1

apt install --no-install-recommends -y make platformio g++

Maybe the PlatformIO version in the repo is a bit outdated? What if you call platform upgrade --dev after installing it?

The espressif32 platform shouldn’t be missing in the repo, that would be disastrous.

$ platformio upgrade --dev
Error: You can't upgrade with this command because PlatformIO
        was installed from debian package. If needed please uninstall first
        with "apt remove" and follow link bellow to install manually

* Upgrade using `pip install -U platformio`
* Try different installation/upgrading steps:
  https://docs.platformio.org/page/installation.html

I’m looking for an alternative installation method, but it’s still a bit extreme that the latest package from such a wildely used distribution cannot be used. Should I look into opening an issue in the package bug tracker?

I just checked the log again and

Get:64 http://archive.ubuntu.com/ubuntu groovy/universe amd64 platformio all 4.3.4-1 [581 kB]

4.x is what I’d consider as legacy, the 5.x core is the latest. There have been changes to the PlatformIO package repository since 4.x. I would say that that is probably the most likely issue source.

Per platformio · PyPI 4.3.4 is from May 2020, as opposed to 5.1.1 (latest stable) from March 2021. Ubuntu seems really behind the times here.

The installation methods are listed at Redirecting.... There is a helper script, or just install python3-pip and then sudo -H pip3 install platformio.

Thanks for the reply. I’ve opened a bug in launchpad. In the meantime, I tested using python3-pip and then pip3 install platformio solves our immediate issue.

How can the distribution package team know when a version is no longer supported?

New major and minor releases are always announced in Release Notes — PlatformIO latest documentation.

But, the migration guide also says they should be backwards compatible…

Maybe @ivankravets knows why it has apparenently broke for Espressif32 platforms since 2 days?

Migrating to version 5.1.1 (installed using pip) seems to have broken the native environment.

Upon running pio test -v -e native, the CI fails with error Error: Unknown development platform 'native'.

Edit: I can run the same command on my system (NixOS unstable, PIO 5.0.4). Maybe I’m missing something? The exact build commands of the failing build are available here.

On the latest dev version I don’t have such problem.

Using a src\test1.cpp of

#include <unity.h>

void TrivialTestCase(void)
{
    TEST_ASSERT_EQUAL(32, 32);
}

int main() {
    UNITY_BEGIN();
    RUN_TEST(TrivialTestCase);
    UNITY_END();
    return 0;
}

with

[env:native]
platform = native
> pio test -e native
Verbose mode can be enabled via `-v, --verbose` option
Collected 1 items

Processing * in native environment
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Building...
Testing...
test\test1.cpp:10:TrivialTestCase       [PASSED]

-----------------------
1 Tests 0 Failures 0 Ignored
OK
=============== [PASSED] Took 1.08 seconds =============== 

can you check if this is a bug in 5.1.1 by executing a pio upgrade --dev after installation to get to the latest version?

Logs from my local docker build:

<snip, pip3 install platformio...>
Building wheels for collected packages: platformio
  Building wheel for platformio (setup.py) ... done
  Created wheel for platformio: filename=platformio-5.1.1-py3-none-any.whl size=332815 sha256=17a483fd66562d8409385537c628950b7e55bc537eec854a5ed050211efd2822
  Stored in directory: /root/.cache/pip/wheels/2f/63/89/c2dada8b07ccffcb202706137906675e8ae40262183ff173c5
Successfully built platformio
Installing collected packages: aiofiles, ajsonrpc, bottle, click, colorama, marshmallow, pyelftools, pyserial, urllib3, idna, certifi, chardet, requests, semantic-version, starlette, tabulate, h11, uvicorn, wsproto, ifaddr, zeroconf, platformio
Successfully installed aiofiles-0.6.0 ajsonrpc-1.1.0 bottle-0.12.19 certifi-2020.12.5 chardet-4.0.0 click-7.1.2 colorama-0.4.4 h11-0.12.0 idna-2.10 ifaddr-0.1.7 marshmallow-3.10.0 platformio-5.1.1 pyelftools-0.27 pyserial-3.5 requests-2.25.1 semantic-version-2.8.5 starlette-0.14.2 tabulate-0.8.9 urllib3-1.26.4 uvicorn-0.13.4 wsproto-1.0.0 zeroconf-0.28.8
root@b5b6d79e0b19:/# cd /work/
root@b5b6d79e0b19:/work# pio test -v -e native
*********************************************************************************************************************************************
<snip, PlatformIO social banner>
*********************************************************************************************************************************************

Collected 2 items

Processing native in native environment
---------------------------------------------------------------------------------------------------------------------------------------------
Error: Unknown development platform 'native'
root@b5b6d79e0b19:/work# pio upgrade --dev
Please wait while upgrading PlatformIO ...
PlatformIO has been successfully upgraded to 5.2.0a3
Release notes: https://docs.platformio.org/en/latest/history.html
root@b5b6d79e0b19:/work# pio test -v -e native
Please wait while upgrading PlatformIO...
PlatformIO has been successfully upgraded to 5.2.0a3!

******************************************************************************************************************************************************************************************************************************************************************************************
<snip, PlatformIO social banner>
******************************************************************************************************************************************************************************************************************************************************************************************

Collected 2 items

Processing native in native environment
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Error: Unknown development platform 'native'

I’m on the same pio --version PlatformIO Core, version 5.2.0a3 and this doesn’t occur for me.

Can you double check with the minimal project files above that this exact case runs or fails for you?

mkdir test
cd test
pio init -b uno
< replace platformio.ini with content above>
< place test\test1.cpp with content above>
pio test -e native

should be the procedure.

Logs from my local docker build:

root@503d37aeaee2:/# mkdir test
root@503d37aeaee2:/# cd test/
root@503d37aeaee2:/test# pio init -b uno
******************************************************************************************************************************************************************************************************************************************************************************************
<snip, PlatformIO social>
******************************************************************************************************************************************************************************************************************************************************************************************


The current working directory /test will be used for the project.

The next files/directories have been created in /test
include - Put project header files here
lib - Put here project specific (private) libraries
src - Put project source files here
platformio.ini - Project Configuration File

Project has been successfully initialized! Useful commands:
`pio run` - process/build project from the current directory
`pio run --target upload` or `pio run -t upload` - upload firmware to a target
`pio run --target clean` - clean project (remove compiled files)
`pio run --help` - additional information
root@503d37aeaee2:/test# cat << EOF > platformio.ini
> [env:native]
> platform = native
> EOF
root@503d37aeaee2:/test# cat << EOF > src/test1.cpp
> #include <unity.h>
>
> void TrivialTestCase(void)
> {
>     TEST_ASSERT_EQUAL(32, 32);
> }
>
> int main() {
>     UNITY_BEGIN();
>     RUN_TEST(TrivialTestCase);
>     UNITY_END();
>     return 0;
> }
> EOF
root@503d37aeaee2:/test# pio test -e native
Verbose mode can be enabled via `-v, --verbose` option
Collected 1 items

Processing * in native environment
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Error: Unknown development platform 'native'
root@503d37aeaee2:/test#

Full docker execution logs.

Update: On my local system (NixOS unstable, PIO 5.0.4), I had to move the file to the test directory, but everything works as expected. Doing the same procedure in the docker container did not change the outcome.

What does pio system info say on the local machine vs the docker container?

Docker (official ubuntu:rolling image):

root@b5b6d79e0b19:/work# pio system info
--------------------------  ----------------------------------
PlatformIO Core             5.2.0a3
Python                      3.8.6-final.0
System Type                 linux_x86_64
Platform                    Linux-5.11.2-x86_64-with-glibc2.32
File System Encoding        utf-8
Locale Encoding             UTF-8
PlatformIO Core Directory   /root/.platformio
PlatformIO Core Executable  /usr/local/bin/platformio
Python Executable           /usr/bin/python3
Global Libraries            0
Development Platforms       0
Tools & Toolchains          0
--------------------------  ----------------------------------

Local system:

 /run/user/1000/tmp.aeVbfriN9L pio system info
--------------------------  ---------------------------------------------------------------------------
PlatformIO Core             5.0.4
Python                      3.8.8-final.0
System Type                 linux_x86_64
Platform                    Linux-5.11.2-x86_64-with-glibc2.2.5
File System Encoding        utf-8
Locale Encoding             UTF-8
PlatformIO Core Directory   /home/roosemberth/.platformio
PlatformIO Core Executable  /nix/store/b74szfgq7l317nbn0flnh5rarq2f24w9-platformio-5.0.4/bin/platformio
Python Executable           /nix/store/yl69v76azrz4daiqksrhb8nnmdiqdjg9-python3-3.8.8/bin/python3.8
Global Libraries            0
Development Platforms       2
Tools & Toolchains          5
--------------------------  ---------------------------------------------------------------------------

Edit: Add version used by the docker image.

It fails for me on Ubuntu 20.04.2 via WSL too. I previously tested on Windows where I also previously worked with the native platform.

$ pio test -e native
Verbose mode can be enabled via `-v, --verbose` option
Collected 1 items

Processing * in native environment
------------------------------------------------------------------------------------------------------------------------
Error: Unknown development platform 'native'

There seems to be quirk that a pio test does not install the platform you’re working on.

Try to do a pio platform install native in the docker container and then re-run the test.

I’m filing a bug for this in the meanwhile.

Running pio platform install native and then pio test -v -e native seems to work on my local docker container. I’m doing the necessary changes in the CI to see if it solves the issue.

Update: Our CI is fixed.

Edit for completeness and mark a solution to the thread:

The full set of steps:

  • Remove the native package.
  • Install platformio from PyPI by installing python3-pip using apt and then running pip3 install platformio.
  • To be able to run tests in the host machine, the native platform should be manually installed by running pio platform install native.
1 Like

Bug is filed per https://github.com/platformio/platformio-core/issues/3901.

In the meanwhile it would ofc be good to get PIO core 4.x to build ESP32 projects again, so maybe @ivankravets can try and reproduce the issue described in the first two posts (and ignore the rest for now as it’s been filed as a bug now)

2 Likes

I confirm, having the same problem with CI

We don’t support PlatformIO Core 4.0. The projects written for the previous PlatformIO Core versions are fully compatible with PlatformIO Core 5.0. It was not our wish to kill PlatformIO Core 4.0. See the reason Custom platform packageRepositories alternative? 4.3.x continued support? - #3 by ivankravets

All data have been moved to the EU with PlatformIO Core 5.0. Please upgrade PlatformIO Core to 5.0. I recommend using our installation script instead of native Linux packages. See Redirecting...

You can use your Python package manager and install PlatformIO Core via pip install --user platformio.

My CI has also broken with the upgrade. MuscleOxygen: add batterystatus support · cujomalainey/antplus-arduino@6fad78c · GitHub
@ivankravets something clearly broke since there was no change to the ini. Thanks to posted solution i was able to get it back up and running by manually installing the platform. Its like unit tests fail to check remote for the platform if its not local (ran on 5.1.1)

The linked issue says the bug was resolved in the latest dev version. Do you do pio upgrade --dev before running anything PIO related?

1 Like

This issue was fixed in the latest development version. Please add the line to your CI config which @maxgerhardt recommended above:

      - name: Install PlatformIO
        run: |
          python -m pip install --upgrade pip
          pip install --upgrade platformio
          pio upgrade --dev