No module named future - python-3.x

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? ?

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

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.

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)

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

I had the similar problem, solved it using easy_install future

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.

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

Related

Module not found when I tried to import pyPDF2

My python version is 3.6. I am able to install the pyPDF2.
Ran pip install pyPDF2 successfully.
Ran pip list, it shows up as 1.26.0
My environment is not base, but I set up an environment as pytorch. pyPDF2 is installed successfully in this environment.
It pops error when I tried to import it. (typo fixed from the original post)
Your import pyPDF is incorrect. Instead try import PyPDF2.
Is also possible your pip does not match your python (this can be the case when multiple python versions are installed at the same time). Try running python -m pip list to confirm what exactly is installed.

How can I install modules in Mac OS Terminal?

I want to install some modules for Telegram Bots and I always get errors like:
File "test.py", line 7, in <module>
import spotipy
ModuleNotFoundError: No module named 'spotipy'
I tried to install spotipy with pip, pip3 and apt.
How is it done? Or generally how do I import modules?
Thank you.
From the spotipy README:
If you already have Python on your system you can install the library simply by downloading the distribution, unpack it and install in the usual fashion:
python setup.py install
You can also install it using a popular package manager with
pip install spotipy
or
easy_install spotipy
Make sure your pip version matches your python version (pip --version and python --version should both be Python3 or Python2).
To import the module, use one of the following statements (see python3 documentation):
import numpy
import numpy as np
from numpy import array

No module named 'pandas_datareader' in Jupyter (Anaconda) after I run pip3 install pandas_datareader

I am trying to learn pandas and want to load some stocks data. I was following a course which advised me to load pandas.io.data, but this did not work as io.data was depreciated. So I decided to use pandas-datareader instead. But I am struggling to instal it on mac in Anaconda (Jupiter notebook).
First time I run import pandas_datareader as pdweb I got ModuleNotFoundError: No module named 'pandas_datareader'. Not surprising as I never used this before so I run pip3 install pandas_datareader in Terminal which successfully installed itself. However, Jupiter notebook is still giving me the same error. At this point, I tried running in Terminal conda install -c https://conda.anaconda.org/anaconda pandas-datareader but it did not work as -bash: conda: command not found.
Please help. I am looking for a detailed explanation as I am not too techie.
What I run in Jupiter
import numpy as np
from pandas import Series, DataFrame
import pandas as pd
import pandas_datareader as pdweb
import datetime
Result
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-6-da568f513c93> in <module>
2 from pandas import Series, DataFrame
3 import pandas as pd
----> 4 import pandas_datareader as pdweb
5 import datetime
ModuleNotFoundError: No module named 'pandas_datareader'
Just run
conda install -c anaconda pandas-datareader
as per instructions here.
In my experience, if you're using conda, you should never install with pip unless you're sure conda doesn't have it. Try searching anaconda.org to see which -c source to use.
The problem was with conda command not being set up during the installation of Anaconda. I solved this by removing Anaconda with App Cleaner & Uninstaller Pro (free soft) and reinstalling later version.
After reinstallation of Anaconda command below worked like a charm.
conda install -c anaconda pandas-datareader
If you using Anaconda and still have issues installing panads-datareader using the conda command 'conda install -c anaconda pandas-datareader'. or the installation is successful but the import pandas_datareader.data as web still gives an error.
Locate where your 'site-packages % ' directory and cd to the site-packages % dir and then run the installation command 'conda install -c anaconda pandas-datareader '. It will work.
For the install, try using
pip
instead of
pip3

No module named 'email.FeedParser'

I am trying to run a code on AWS Lambda but it is returning me the error: "Unable to import module 'main': No module named 'email.FeedParser'".
My code does not use email feedparser module or function. It just connect to one Google API and download a CSV report.
I've checked my code scope and the reference for this module is being done by httplib2 library and on the email/parser.py from the python standard library.
All required libraries are fully updated in requirements.txt file. The code is also configured by a samTemplate.yaml file to execute in a python 3.7 environment at aws.
Do you guys had experienced this problem before? How can I solve it?
Thank you!
import httplib2
from googleapiclient import discovery
from oauth2client.client import flow_from_clientsecrets
from oauth2client.file import Storage
from oauth2client.tools import run_flow
from urllib.parse import urlencode
import requests
import json
import time as t
import pandas as pd
from datetime import datetime, timedelta
from calendar import monthrange
from dateutil.relativedelta import relativedelta
I had to make sure pip3 was actually installing to python3 and not python2.
Instead of:
pip3 install <package>
I had to do:
python3.8 -m pip install <package>
See answer here: Why pip3 install in python2 sitepackages
I had exactly the same issue...
I did this:
vim ~/.pydistutils.cfg
[install]
prefix=
see here: 24257803 for more info on this step
rm -rf [dependencies_dir]
pip3 install -r requirements.txt --target [dependencies_dir]
Pip3 will install this dependencies to Python3, where pip was installing to Python2 (where some of these packages don't exist). So when deploying to Lambda via serverless the packages weren't included.

I installed opencv3 with conda, yet I can only import cv2... is this correct?

I am anaconda on a mac os x Yosemite, running python 3.5. I used the following command from anaconda's website
conda install -c menpo opencv3=3.1.0
The terminal read out nothing to do with opencv2.
However, in the ipython console I am unable to import cv3. I get,
conda install -c menpo opencv3=3.1.0
Yet.... interestingly enough I able import cv2. I have read a bit that opencv can be a tricky and wily beast to get working...
Also anaconda specifically says that I have only the opencv3 package.
So, I am wondering... even though I am using opencv3 maybe for some reason it still uses cv2 as the package name to import?
Thanks for any insight!
Apparently, it is just that simple... import cv2 even if you have opencv3.x.
Thank you Miki.

Resources