22

I am running a telegram bot in python and i am using python3.6 on raspbian ( pi3 )

Below is my imports:

from __future__ import (absolute_import, division,
                    print_function, unicode_literals)
from builtins import (
    bytes, dict, int, list, object, range, str,
    ascii, chr, hex, input, next, oct, open,
    pow, round, super,
    filter, map, zip)
from uuid import uuid4

import re
import telegram

from telegram.utils.helpers import escape_markdown

from telegram import InlineQueryResultArticle, ParseMode, \
    InputTextMessageContent
from telegram.ext import Updater, InlineQueryHandler, CommandHandler
import logging
import random
import telepot
import unicodedata
import json
import requests
import bs4
from bs4 import BeautifulSoup

When i try to run my bot with sudo python3 bot.py i get

ImportError: No module named 'future'

I have searched and found many answers on this but none have worked for me such as pip install future and pip3 install future The module does show in my lib for python 3.6 future in lib

Any idea why it still says No module named future? ?

PeppaPigKilla
  • 229
  • 1
  • 2
  • 3
  • 1
    is there a reason you are running with `sudo`? That will clobber your environment which is why python can't find installed modules – avigil Mar 18 '18 at 23:37
  • Possible duplicate of [PYTHONPATH not working for sudo on GNU/Linux (works for root)](https://stackoverflow.com/questions/7969540/pythonpath-not-working-for-sudo-on-gnu-linux-works-for-root) – avigil Mar 18 '18 at 23:39
  • @avigil its just the way ive always done it. I did without and all worked fine. Thank you – PeppaPigKilla Mar 19 '18 at 00:39

7 Answers7

28

I ran into a similar problem using Python code written by someone else. See http://python-future.org/. future is a module that aids in conversion between Python 2 and 3. It was an easy installation for me by doing pip3 install future

jkulpe
  • 390
  • 4
  • 6
13

I tried install, reinstall, easy_install and conda install but nothing worked for me. I was finally able to import my package by running upgrade on future.

pip install -U future 

This solved my issue.

Sayali Sonawane
  • 12,289
  • 5
  • 46
  • 47
2

None of these work for me, despite uninstalling the module, then reinstalling it with pip3 install future I keep getting the error (trying to run ardupilot's sim_vehicle.py --console --map in case it matters)

1

I had the similar problem, solved it using conda install future

Ee Ann Ng
  • 109
  • 1
  • 8
0

I had the similar problem, solved it using easy_install future

0

I know this is an old question, but if anyone needs it. This happened when I was trying to builds tests for ArduPilot.

I was facing a similar problem, the pip that you'd have been using was for python3. So you need to install pip for python2.7. You can do that using curl

apt-get install curl
curl https://bootstrap.pypa.io/2.7/get-pip.py -o get-pip.py
python get-pip.py

Then you can run

pip install future

to install future.

Gyanendra
  • 31
  • 1
  • 6
0

I encountered the same problem. The previous answer isn't effective anymore. I had to install python 3.7 and use this :

apt-get install curl
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3.7 get-pip.py