# ValueError: incompatible .mpy file

**URL:** <https://forums.digi.com/t/valueerror-incompatible-mpy-file/20652>\
**Category:** XBee Micropython & IDE plugin\
**Tags:** micropython, cross-compile\
**Created:** [July 22, 2019, 10:14am UTC](https://forums.digi.com/t/valueerror-incompatible-mpy-file/20652 "2019-07-22T10:14:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![amirna2](https://avatars.discourse-cdn.com/v4/letter/a/3be4f8/32.png) [@amirna2](https://forums.digi.com/u/amirna2)\
**Post date:** [July 22, 2019, 10:14am UTC](https://forums.digi.com/t/valueerror-incompatible-mpy-file/20652/1 "2019-07-22T10:14:03Z")

</div>

Hello,

I am following the Digi Micropython Programming guide documentation to setup my development environment with PyCharm IDE and the Digi XBee plugin.

The setup works great and I was able to create a project, add some code and have the IDE flash the connected module.  
However when the code runs, I get the following error on the terminal:

MicroPython v1.11-1227-g52e306b on 2019-07-10; XBee3 Zigbee with EFR32MG  
Type “help()” for more information.  
\>\>\>  
Loading /flash/main.mpy…  
ValueError: incompatible .mpy file

If I download the same code directly from the terminal using (CTRL+F / CRTL+D) and then run it using CTRL+R  
then it executes the mpy just fine.

I am using PyCharm version 2019.1.3 and Xbee plugin Version 1.0.1 (June 2019). The Xbee3 Zigbee module I am using is on f/w 1007

I am suspecting that the plugin is using a version of the cross-compiler that is not compatible with the micropython installed on the module, but I have no idea how/where I can change the cross-compiler.

Any help is appreciated. The PyCharm IDE + Plugin is quite amazing to use and this is really the only problem right now to get a full development environment setup.

Thanks,  
Amir.

---

<div class="post-metadata">

**Author:** ![rmoral](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.digi.com/rmoral/32/4287_2.png) [@rmoral](https://forums.digi.com/u/rmoral)\
**Post date:** [July 24, 2019, 7:23am UTC](https://forums.digi.com/t/valueerror-incompatible-mpy-file/20652/2 "2019-07-24T07:23:14Z")

</div>

Hi Amir,

Thanks for reporting this issue. As you say, there is a mismatch between the cross-compiler and MicroPython versions. We are fixing the problem and will release a new version of the plugin very soon.

In the meantime, you can disable the source compilation to avoid this problem. To do so, go to File | Settings | Project: | XBee MicroPython and uncheck the “Compile source files with ‘mpy-cross’” option.

We apologize for the inconvenience.

Best regards,  
Ruben

---

<div class="post-metadata">

**Author:** ![shruthijothsana](https://avatars.discourse-cdn.com/v4/letter/s/3bc359/32.png) [@shruthijothsana](https://forums.digi.com/u/shruthijothsana)\
**Post date:** [July 29, 2019, 12:54pm UTC](https://forums.digi.com/t/valueerror-incompatible-mpy-file/20652/3 "2019-07-29T12:54:23Z")

</div>

This error occurs when importing a module that is stored as a mpy binary file (rather than a py text file) that was generated by a different version of CircuitPython than the one its being loaded into. Most versions are compatible but, rarely they aren’t.

---

<div class="post-metadata">

**Author:** ![shruthijothsana](https://avatars.discourse-cdn.com/v4/letter/s/3bc359/32.png) [@shruthijothsana](https://forums.digi.com/u/shruthijothsana)\
**Post date:** [August 21, 2019, 4:11pm UTC](https://forums.digi.com/t/valueerror-incompatible-mpy-file/20652/4 "2019-08-21T16:11:47Z")

</div>

ValueError: Incompatible .mpy file.  
This error occurs when importing a module that is stored as a mpy binary file (rather than a py text file) that was generated by a different version of CircuitPython than the one its being loaded into. Most versions are compatible but, rarely they aren’t.This may help:  
[https://docsbay.net/troubleshooting](https://docsbay.net/troubleshooting)
