PlatformIO Community

Marlin: Help me ERRROR ModuleNotFoundError

I use Platformio to update Marlin on my 3D printer. 2 weeks ago it worked perfectly and today I changed a Marlin parameter and when compiling I get this error:

ModuleNotFoundError: No module named 'platformio.managers.package':
  File "C:\users\oscar\.platformio\penv\lib\site-packages\platformio\builder\", line 167:
    env.SConscript(item, exports="env")
  File "C:\Users\Oscar\.platformio\packages\tool-scons\script\..\engine\SCons\Script\", line 597:
    return _SConscript(self.fs, *files, **subst_kw)
  File "C:\Users\Oscar\.platformio\packages\tool-scons\script\..\engine\SCons\Script\", line 286:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "D:\Oscar\Impresion 3D\Marlin\Marlin-2.0.6\Marlin 2.0.6 MKS Robin-V6-BMG\buildroot\share\PlatformIO\scripts\", line 12:
    from platformio.managers.package import PackageManager

Help me please

Maybe related to

Have you tried updating your PlatformIO installation (pio upgrade --dev) or reinstalling it completely (deleting C:\Users\<users>\.platformio completely, too)?

I have updated Platformio and I keep getting the same error, can’t import PackageManager.

But the weird thing is that other Marlin compilations and other projects with ESP8266 and Arduido compile fine.
That’s why installing everything I don’t know if it will be the solution

Help me please

I ran into this exact error - turns out the problem is you need to update the Marlin source code. Doing a git pull on the branch to get the latest fixed the problem, reinstalling platformio did not. The problem is your platformio has updated at some point, but the Marlin code is using an older API.

It seems that the platformio.managers.package was removed - or at least trying to do import platformio works, import platformio.managers works, and import platformio.managers.package gives the error.

what would you git pull, and how can it be done?

You need to re-download the latest stable Marlin software from It contains a fix for PlatformIO Core 5.0.

Another solution is to replace only buildroot from


A quick workaround is to take buildroot from a newer Marlin and replace the one in your project


Worked like a charm! Thank you!

Thank you all.

Possibly a bug in the Marlin version, but I see that Windows 10 has something to do with the problem. I have solved it by installing the Ubuntu subsystem on Windows 10 and compiling the same code but with platformio on Linux Ubuntu.

Follow the directions in this video:

It is a problem with Marlin 2.6.0 since when updating Platformio to version 5 it gives the same error when compiling in linux as in Windows 10. I will test Marlin 2.6.1 to see if it works well and this incompatibility is solved.

Thank you

You can always tell VSCode to not use its builtin core version but the global one instead that you install via pip in the extension settings. Then using pip, you can always uninstall PIO and install a specific version of PIO 4. See and

1 Like

I asked this question in other topic.

Is there anything else that has to be changed in new configuration.h ?
After update I experience problem with RE-ARM board. Now when I upload firmware and connect re-arm to computer it doesn’t recognize SD card anymore and loses USB connection after couple of minutes.


With version of Marlin it compiles perfectly in Windows 10.

Thank you all for the help


I have no knowledge of that plate but I give some tips if they help you:

  • Format SD in FAT32.
  • Find the appropriate configuration for your board of these parameters in configuration.h

#define SERIAL_PORT -1 // MKS Robin E3

#define SERIAL_PORT_2 1 // MKS Robin E3

To avoid conflicts between SD USB …

The values ​​that I give you are those of my board.


I am having this issue with the Marlin build for the board, This is my first time working with updating the firm ware and Im not sure what is going wrong.

This totally solved the issue.