I'm trying to run a python program with twitter module.
I installed the twitter and json packages via:
pip install twitter
pip install simplejson
While running the program I'm getting error in both python 2 and python 3 version.
My code:
try:
import json
except ImportError:
import simplejson as json
import twitter
from twitter import Twitter, OAuth, TwitterHTTPError, TwitterStream
Error:
Traceback (most recent call last):
File "Untitled.py", line 5, in <module>
import twitter
ImportError: No module named 'twitter'
Do you get this error in the Terminal ?
If no, try to open the Terminal and run python then import twitter.
Maybe you can try to use pip3 with Python3
First install pip3 then run :
pip3 install twitter
And run again the import in the Terminal.
Recently I faced this issue:
- un-install below packages (twitter, python_twitter).
pip uninstall twitter
pip uninstall python_twitter
Then install Twitter.
pip install twitter
problem will solve.
Related
I installed tweepy through CMD by using the 'pip install tweepy' command. However, when I import it in my code I get this error:
Traceback (most recent call last):
File "C:\Users\UserName\Desktop\Code\twitter code\pfp_changer.py", line 1, in <module>
import tweepy
ModuleNotFoundError: No module named 'tweepy'
Furthermore, this command outputs a list that does not include tweepy.
help("modules")
Any help would be appreciated. I am using python version 3.10.0.
firstly, you need to check your PATH and see if you have duplicated python versions, if yes, try deleting one and install into the other
if no:
try installing tweepy in cmd like this:
python -m pip install tweepy
I can't import correct Firebase package in Raspberry PI.
My code:
from firebase import firebase
db = firebase.FirebaseApplication("https://xyz.firebaseio.com/", None)
Error:
Traceback (most recent call last):
File "datastorage.py", line 1, in <module>
from firebase import firebase
firebase/__init__.py", line 14, in <module>
import python_jwt as jwt
ModuleNotFoundError: No module named 'python_jwt'
I tried to use this commands and it didn't help:
sudo pip install requests
sudo pip install python-firebase
pip install jwt
I use Python 3.7.3 and Raspbian Buster. All works on my PC but not on RPi 3B+.
I used advice from #naive.
pip install python_jwt
After that I solved another errors in that order:
pip install gcloud
pip install sseclient
pip install pycrypto
pip install requests-toolbelt
And now I see that It works. Problem was solved.
I think you need python_jwt instead of jwt. You can do:
pip install python_jwt
If you're referring to this library:
https://pyjwt.readthedocs.io/en/latest/
Then you need to install like this:
pip install PyJWT
And afterwards this will work:
import jwt
I'm developing a slackbot. After importing slackclient, I got ModuleNotFoundError: No module named 'slackclient'.
I tried all the options and followed suggestions showed in the post here- Python can't find installed module ('slackclient'). By those suggestions, I installed slack but got the following error while importing WebClient.
>>> from slack import WebClient
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name 'WebClient' from 'slack' (<path_to _venv>/.venv/lib/python3.7/site-packages/slack/__init__.py)
I checked the slack version that seems like ok
slack 0.0.2
Any suggestions what could I be doing wrong?
Using slackclient version 2
$ pip install slackclient --upgrade
$ pip freeze
slackclient==2.1.0
from slack import WebClient
OR, Using slackclient version 1
$ pip install slackclient==1.3.1
from slackclient import SlackClient
there seems to be a conflict between slack versions and imports. If you are using slack >= 0.0.2 and slackclient >= 0.36.2, try this instead:
from slack.web.client import WebClient
you can check that WebClient class is defined in that directory.
I was able to get it to work by using
from slack.web.client import WebClient
The current version of slackclient for Python3 is 2.1.0.
To upgrade your environment run:
$ pip3 install slackclient --upgrade
You find the latest slackclient here.
i'm trying to run this bot https://github.com/ItsCEED/Youtube-Comment-Bot
in mac os but i get this error
l:Youtube-Comment-Bot-master ROOTXX$ python yt.py
Traceback (most recent call last):
File "yt.py", line 6, in <module>
import google.oauth2.credentials
ImportError: No module named google.oauth2.credentials
l:Youtube-Comment-Bot-master ROOTXX$
Run in a root terminal:
pip install --upgrade google-api-python-client
From here, found with a google search.
EDIT: Even better, you linked the required libraries yourself. They are in the GitHub README.md at here. Please read your own links. Anyway, the commands to install follow:
# pip install --upgrade google-api-python-client
# pip install --upgrade requests
# pip install --upgrade beautifulsoup4
I am relatively new to Python and I am stuck on something which is probably relatively easy to resolve.
I have installed the following packages:
pip install --upgrade google-api-python-client
pip install --upgrade google-cloud
pip install --upgrade google-cloud-vision
In my Python file I have:
import cv2
import io
import os
# Imports the Google Cloud client library
from google.cloud import vision
...etc...
And this gives me the error:
Traceback (most recent call last):
File "test.py", line 6, in <module>
from google.cloud import vision
ImportError: No module named 'google.cloud'
What am I missing and where should I look (logs?) to find the answer in the future.
PS:
Pip installs of google-cloud and google-cloud-vision have the output:
Cannot remove entries from nonexistent file /Users/foobar/anaconda/lib/python3.5/site-packages/easy-install.pth
UPDATE:
Running pip freeze doesn't show the packages to be installed...
I had a similar problem. Adding "--ignore-installed" to my pip command made it work for me.
This might be a bug in pip - see this page for more details: https://github.com/pypa/pip/issues/2751
You need to download and install the google-cloud-sdk. Follow this link https://cloud.google.com/sdk/docs/
try this :
from google.cloud.vision import *