Marlin: Help me ERRROR ModuleNotFoundError

Hello
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\main.py", line 167:
    env.SConscript(item, exports="env")
  File "C:\Users\Oscar\.platformio\packages\tool-scons\script\..\engine\SCons\Script\SConscript.py", line 597:
    return _SConscript(self.fs, *files, **subst_kw)
  File "C:\Users\Oscar\.platformio\packages\tool-scons\script\..\engine\SCons\Script\SConscript.py", 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\common-dependencies.py", line 12:
    from platformio.managers.package import PackageManager

Help me please

Maybe related to ImportError: No module named *** · Issue #1787 · platformio/platformio-vscode-ide · GitHub?

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

Hello
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.

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

You need to re-download the latest stable Marlin software from GitHub - MarlinFirmware/Marlin: Marlin is an optimized firmware for RepRap 3D printers based on the Arduino platform. | Many commercial 3D printers come with Marlin installed. Check with your vendor if you need source code for your specific machine.. It contains a fix for PlatformIO Core 5.0.

Another solution is to replace only buildroot from GitHub - MarlinFirmware/Marlin: Marlin is an optimized firmware for RepRap 3D printers based on the Arduino platform. | Many commercial 3D printers come with Marlin installed. Check with your vendor if you need source code for your specific machine.

1 Like

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

2 Likes

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: - YouTube

Hello
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 platformio · PyPI and python - Installing specific package version with pip - Stack Overflow.

1 Like

Hi,
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.

Hello

With version 2.6.0.1 of Marlin it compiles perfectly in Windows 10.

Thank you all for the help

Hello

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.

Regards

I am having this issue with the 2.0.6.1 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.

I’m using Github Desktop and merged upstream into my branch, so Marlin (bugfix-2.0.x) should be updated with the latest updates as of just a few minutes ago. I’ve also tried to download both stable and bugfix from Github to my local machine and copied buildroot manually, but I still have the same error, except my missing module is ‘elftools’. I’m running PlatformIO 5.0.3. VSCode is also updated (v1.51.1). Any idea how to fix this?