Import "olympe" could not be resolved PylancereportMissingImports


I think this issue (or a similar one) has been raised several times already, but no real solution has been posted.

My setup:

  • Source installation of Olympe SDK on Raspberry PI 4 (ARM)
  • Creation and launch of venv works
  • Test app works
cd ~/parrot-groundsdk/
source ./products/olympe/linux/env/shell
# The following should print 'Installation OK' if everything is fine
python -c 'import olympe; print("Installation OK")'

Perfect. Now it comes :slight_smile:

I put the same little “test-script” into and fire up VSCode on my PC, remote debugging on the PI.

What I see is this:

In the beginning I had kind of understanding for this warning, since - how should PyLance know about this extension. After a lot of attempts to solve this, I’m now asking, if somebody was able to import the symbols of Olympe into VSCode and if, how? Because it would be a dramatic improvement to have things like Intellisense working on these objects…

What I tried so far was to add the module path of olympe derived from

import olymp, os; 

to the workspace settings (to no avail)

Anybody having an idea?

I suspect I would be able to resolve that if I would be able to run VSCode on the PI directly…

Sorry, setting was wrong

But didn’t change the result…

I think you can’t fix that, they are working on it

Thanks. Is there any reference thread in which the progress of this work is discussed?

BTW: At least for import olympe olympe can be resolved by

    "python.analysis.extraPaths": [


Things like from olympe.messages.ardrone3.Piloting import TakeOff are still remaining in the dark

Basically these would be highly appreaciated:

import olympe.messages
import olympe.enums

Last time I’ve checked PyLance was not smart enough to find the definition of the olympe.messages and olympe.enums packages which are populated at runtime.

The solution to this would be to generate *.pyi “interface files” for olympe.messages and olympe.enums (and every subpackages/submodules?) and ideally to package them with Olympe.

Since PyLance is supposed to check for those *.pyi files it should work just fine.

Correction: For Olympe, we are just thinking about it. For AirSDK, the situation is a little bit different and we are still working on a viable long term solution.

Yes, I think PyLance is just capable of finding modules based on “real” paths. Since the reported paths for both modules after load does not really exist, it doesn’t help to specify them in the settings.

(olympe-python3) pi@raspberrypi:~/vxparrot $ python3
Python 3.7.3 (default, Jan 22 2021, 20:04:44) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import olympe, os
>>> import olympe.messages
>>> import olympe.enums
>>> os.path.dirname(olympe.__file__)
>>> olympe.messages
<module 'olympe.messages' (/home/pi/parrot-groundsdk/out/olympe-linux/final/usr/lib/python/site-packages/olympe/messages)>
>>> olympe.enums
<module 'olympe.enums' (/home/pi/parrot-groundsdk/out/olympe-linux/final/usr/lib/python/site-packages/olympe/enums)>

Both paths don’t exist.

Could you please elaborate a bit on your “*.pyi interface file” hint?

Sure, I think that the relevant specification/documentation on *.pyi stub files can be found here : PEP 561 – Distributing and Packaging Type Information |
and here : Stub files - mypy 1.8.0 documentation.

Yepp. Found that already… Didn’t help much in the specific case.

Basically, what’s needed is one *.pyi stub file per module under the “olympe.messages” and “olympe.enums” packages. Those *.pyi files should probably be placed under site-packages/olympe/messages/ and site-packages/olympe/enums (I don’t know if it’s possible to placed elsewere where you’re IDE/language server can find them).

Those files should contain the prototypes and docstrings of every type exposed by the runtime olympe.messages and olympe.enums packages. It should be possible to generate them automatically from a python script that imports olympe (that’s the only practical way of doing it).

Basically, what’s needed is one *.pyi stub file per module under the “olympe.messages” and “olympe.enums” packages.

I wasn’t even able to locate them up to now. I didn’t fully understand your code, but I only found and in some location in a subdir called “arsdkng”. Is it this?

No, that’s not going to work for me. I stubgened an arbitrary found, got something, was able to resolve import olympe.messages, but this is nonsense.

OK, than back to stone-age debugging using print and reading large descriptions :frowning:

Thanks for now

This topic was automatically closed after 30 days. New replies are no longer allowed.