ImportError: No module named future

Hello everyone. I am new to this and trying to get everything set up, but am running into an error trying to run ‘make sitl -j4’ in Cygwin.

Everything is installed and seems to be running, however when I get to that step it starts and then stops with:

ImportError: No module named future
mavgen: failed

When I try to reinstall future it says ‘the requirement is already satisfied’.

I have tried reinstalling things and manually downloading the future module but nothing seems to work.

Any help would be greatly appreciated! Thank you!

You need to get future and compile it. https://pypi.python.org/pypi.future Save yourself a lot of extra trouble and install linux instead of trying to use emulators. Not that difficult and it doesn’t require a ton of disk space. I have windoze and 3 flavors of linux on this box. To get away from the problems with grub and dual booting with windoze install linux on a separate disk and don’t let it update the windoze boot manager. Ubuntu will recognize the windoze bootmanager and put it in its boot menu. Then just set that disk as your boot disk in the bios. No issues with dual booting that way.

Thanks for the reply! I have actually already grabbed future from the python site and no matter how I try it, it always tells me it’s already there. I’ll look into the Linux concept and go from there unless anyone else has a thought. Thanks again!

Did you try to uninstall it? Pip uninstall command?

Thank you, yes, I have tried that with the same result. At this point I am going to remove everything down to and including python and start over. I’ll post the result. Thanks again.

Complete uninstall and reinstall with no change. In case I’m mis-interpreting the error, below is the full output. Any other thoughts would be appreciated. Thank you!

$ make sitl -j4
Checking modules
echo "Generating MAVLink headers…"
Generating MAVLink headers…
#goto mavlink module directory and run the most recent generator script
echo “Generating C code using mavgen.py located at” /home/Stuart/ardupilot/modul es/mavlink/
Generating C code using mavgen.py located at /home/Stuart/ardupilot/modules/mavl ink/
PYTHONPATH=/home/Stuart/ardupilot/modules/mavlink/ python /home/Stuart/ardupilot /modules/mavlink//pymavlink/tools/mavgen.py --lang=C --wire-protocol=2.0 --outpu t=/tmp/ArduCopter.build/libraries/GCS_MAVLink/include/mavlink/v2.0 /home/Stuart/ ardupilot/modules/mavlink/message_definitions/v1.0/ardupilotmega.xml; if [ $? -l e 0 -o $? -gt 128 ]; then echo “mavgen: success”; exit 0; else echo “mavgen: fai led”; exit 1; fi
// BUILDROOT=/tmp/ArduCopter.build HAL_BOARD=HAL_BOARD_SITL HAL_BOARD_SUBTYPE=HA L_BOARD_SUBTYPE_NONE TOOLCHAIN=NATIVE EXTRAFLAGS=-DGIT_VERSION=“b27e4dbd” -I/hom e/Stuart/ardupilot/libraries/AP_Common/missing -DMAVLINK_PROTOCOL_VERSION=2 -DHA VE_CMATH_ISFINITE -DNEED_CMATH_ISFINITE_STD_NAMESPACE -DHAVE_ENDIAN_H -DHAVE_BYT ESWAP_H
Traceback (most recent call last):
File “/home/Stuart/ardupilot/modules/mavlink//pymavlink/tools/mavgen.py”, line 16, in
from pymavlink.generator import mavgen
File “/home/Stuart/ardupilot/modules/mavlink/pymavlink/generator/mavgen.py”, l ine 12, in
from future import standard_library
ImportError: No module named future
mavgen: failed
make: *** [C:/cygwin/home/Stuart/ardupilot/mk/mavgen.mk:12: /tmp/ArduCopter.buil d/libraries/GCS_MAVLink/include/mavlink/v2.0/ardupilotmega/mavlink.h] Error 1
make: *** Waiting for unfinished jobs…

Got it! To be honest I’m not sure what the solution is to help others, other than to say that the complete reinstall ended up working. On the reinstall I accidentally ran the pip install of the future module from a standard command prompt instead of cygwin command window. Once I ran it from cygwin, everything worked fine.

Thanks again for your help and time!

I’ve been doing everything through the command prompt. Can you tell me what you did in cygwin to get it working.
-Cheers

When I ran the pip command to install the future module from the command prompt, it told me it was already there but would still give the error. So instead, open cygwin and run the same install command from that prompt. That did it for me. Hope this helps!

That didn’t work. I think I might do a complete unistall/reinstall. I’ve been trying to get ardupilot working for a couple of days now.

Looks like you don’t have the pip command installed properly.

I ended up having to do a complete uninstall/reinstall after a couple days as well, but I would check the pip command first. You might be able to avoid the headache.

Thank you, that worked. I was able to get it to Make the copter, but now when I run “sim_vehicle.py -j4 --map” it gives me an error saying " -bash: sim_vehicle.py: command not found"

EDIT: I got it working completely. I ran “export PATH=$PATH:$HOME/ardupilot/Tools/autotest” from the cygwin terminal, then ran “sim_vehicle.py -j4 --map” and it worked.

Did you set up your path in Cygwin? Below is a part of the instructions from http://ardupilot.org/dev/docs/sitl-native-on-windows.html that sets the path to the location of the sim_vehicle directory.

If you have done that, then maybe you have the file in a different directory. If so, then do a search for the sim_vehicle file and make the appropriate changes.

Hope this helps.

Set up directories/paths in Cygwin

To save having to set up paths every time you start SITL, it can be helpful to set up the path to the Tools/autotest directory.

  1.   Open and then close the Cygwin Terminal from the desktop or start menu icon.
    

Tip

This will create initialisation files for the user in the Cygwin home directory (and display their locations). For example, a user’s home directory might be located atC:\cygwin\home\user_name.

  1.   Navigate the file system to the home directory and open the .bashrc files (e.g. C:\cygwin\home\user_name\.bashrc.
    
  2.   Add the following line to the end of .bashrc
    
  3. export PATH=$PATH:$HOME/ardupilot/Tools/autotest

The file will be loaded next time you open the Cygwin terminal.

have you solved this problem? If yes, i hope you can tell me how to do.:relaxed:

I did follow the directions of adding the export command to the end .bashrc file, but it wasn’t taking. I have just accustomed myself to running the export command every time I want to run the simulator. The extra step outweighs the extra hassle.
Steps to starting the simulation: (Windows)
1.) Open Cygwin
2.) cd ~/ardupilot/ArduCopter
3.) export PATH=$PATH:$HOME/ardupilot/Tools/autotest
4.) sim_vehicle.py -j4 -L NUCC --map
5.) Open a new Cygwin terminal
6.) cd ~/dronekit-python/examples/simple_goto
7.) python simple_goto.py --connect 127.0.0.1:14550

and it works perfectly now. Next task for me is to get 3 drones running. If you have any expertise in that, it would be much appreciated.

For anyone else who might’ve faced the same issue like me,

I uninstalled future using command prompt using pip uninstall

later, I installed it again but using cygwin’s command line interface. That worked for me. I did not have to reinstall everything and start from scratch again.

Thanks for all the help

in mavgen.mk just change python to python2.7
and make sure that future module is installed on python2.7 it worked for me.

A similar question in compiling the Ardusub

I have a similar question about compiling the ardusub code. I download the entire ardupilot code and trying to compile the code throught this tutorial:

Everything works fine except this command:

./waf --targets bin/arducopter --upload

The prompt gives me this error:

File “/Users/wanglingxiao/ardupilot/modules/mavlink/pymavlink/generator/mavgen.py”, line 12, in <module>

from future import standard_library

ImportError: No module named future

It says the system could not find a module named ‘future’. I tried to download a future module by using

pip install future

, but after I download the future module and re-compile the code, the problem exists. I opened a python IDE, and run the following code

from future import standard_library

It did not give me error information, which means the future module has been installed. The python version is 2.7 and my computer is running on Mac OS.

If you have any ideas to solve this problem, please let me know.

Thanks in advance and Merry Christmas!

where is mavgen.mk located?

I was found this kind of error while building ardupilot from source code. I fixed it by check where’s my future library and which python that i use for build the ardupilot. Because i installed future library for python3, than i should build waf by python3 as well. You can change waf setting it by open waf file in /ardupilot and replace “#!/usr/bin/env python” by “#!/usr/bin/env python3”. Or maybe you can adapt it to your ubuntu’s settings

1 Like