Cannot import tweepy after it has been installed - python

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

Related

Can't import external packages with python

Title. It just doesn't recognize it. For example, I'm trying to make a discord bot with discord.py. I do the pip install thingy, and it just spits this out when I try to run my file:
Traceback (most recent call last):
File "C:\Users\Pixel\Desktop\Discord bot\bot.py". line 1, in <module>
import discord
ModuleNotFoundError: No module named 'discord'
It does exist, I checked: (C:\Python38\lib\site-packages\discord)
Am I doing something wrong here or am I just stupid? Thanks!
There are many possible reasons for this error. You might have multiple versions of Python running on your machine, so you could have installed the module in a version of Python that your code is not using.
Make sure you're using the write version of Python as your interpreter.
You could also try installing the module directly in whatever venv you're using by typing this command into the terminal in the same folder python3.9 -m pip install discord. Replace python3.9 with whatever version of Python you're using.

ModuleNotFoundError: No module named 'cryptography'

these are the Error messages I am geeting on running any of my project modules.
Traceback (most recent call last):
File "C:\Users\hsnl\BlockchainCodesTutor\Wallet.py", line 3, in <module>
import Transactions
File "C:\Users\hsnl\BlockchainCodesTutor\Transactions.py", line 2, in <module>
import Signatures
File "C:\Users\hsnl\BlockchainCodesTutor\Signatures.py", line 2, in <module>
import cryptography
ModuleNotFoundError: No module named 'cryptography'
I have already installed the cryptography module and was working perfectly until today I start getting this message that " No module named 'cryptography'".
I have again installed the cryptography as well as pip package but still showing the same error.
There might be loose versions running on your system. Please try the following:
python -m pip uninstall cryptography
python -m pip install cryptography
You can also check out this with python -m to make sure you are not using a loose pip.
You might not have cryptogtaphy installed correctly. I see you are using windows. Open commandline as an administrator and run pip install cryptography again. Enshure that the installation finishes without any errors and consider to restart your python interpreter after installation.
For further help you should post more details like the output of pip and your code leading to the error, so a more detailed answer for your problem can be given.
Try download cryptography whl from here.
Then use pip install cryptography-XXX.whl
For example:
pip install cryptography-3.3.1-cp36-abi3-win_amd64.whl
And now just supports python2.7 and python3.6.

Don't understand this ImportError while running my script

I'm running this code from github:
Everything works fine but in 3rd Step when I run:
cd file-on-blockchain/example
and in this when i execute this=> python deploy_contract_and_test.py, It says
Traceback (most recent call last):
File "deploy_contract_and_test.py", line 2, in <module>
from web3 import Web3, HTTPProvider
ImportError: No module named web3
I have seen many people's answers regarding updating pip and all, but nothings working.
Looks like you don't have the web3 module installed. You can install it using pip:
$ pip install web3
there's more detailed information about how to install the package at the official github :
https://github.com/ethereum/web3.py

ModuleNotFoundError after installing requests package

I am on Mac OS Sierra, with home-brew, pip and python3 installed. I Tried running a script that required the requests module, but I keep getting this error:
Traceback (most recent call last):
File "listing_seq.py", line 1, in <module>
import requests
ModuleNotFoundError: No module named 'requests'
Despite running:
sudo pip3 install requests
sudo pip install requests
sudo pip install requests --upgrade
Any suggestions?
Update:
When I try running using virtualenv I get:
Running virtualenv with interpreter /usr/local/bin/python3
ERROR: File already exists and is not a directory.
Please provide a different path or delete the file.
The most common error is having another file with the name of any of the libraries you requested in the same path.
The other possible error is if the python you are using to execute the file is not python 3 but rather the defalut python from your OSX. See the accepted answer on this for better understanding of a possible issue. Also share your code to identify the bug.

ImportError: No Module named twitter - MacOS Sierra

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.

Categories