ModuleNotFoundError: No module named 'fyers_api' - python

I am running the below code to connect fyers API:
from fyers_api import accessToken
from fyers_api import fyersModel
app_id = "app_id"
app_secret = "secret_id"
app_session = accessToken.SessionModel(app_id, app_secret)
response = app_session.auth()
But still getting error:
ModuleNotFoundError: No module named 'fyers_api'
Please help to resolve issue. I did install fyers_api module. pip install fyers_api

Since this is Python 3 (because ModuleNotFoundError is specific to Python 3), you should be using pip3 instead of pip to install packages:
pip3 install fyers_api
pip install fyers_api will install it for Python 2.

Download fyers api package from here
For Anaconda-3 run below command from the anaconda prompt.
pip install <path to the downloaded package>

Related

ModuleNotFoundError: No module named 'dnspython'

I am trying to import the module dnspython in a python 3.6 script using import dnspython.
pip3 freeze shows that the package is installed but I keep getting the error ModuleNotFoundError: No module named 'dnspython'
I have tried:
pip3 install dnspython
uninstalling and reinstalling with pip3
pip3 install git+https://github.com/rthalley/dnspython
Cloning the package from github and installing with sudo python setup.py install
pip3 install dnspython3 and using import dnspython3 in the script
Copying the dns folder of the cloned package in the site-packages folder
I am aware of this post for python 2.7 but none of the solutions worked.
The problem was import dnspython. Changing it into import dns worked fine.
Some test code:
import dns
result = dns.resolver.query('google.com', 'A')
for ipval in result:
print('IP', ipval.to_text())
# Output: IP {your ip}
It worked for me (Python 3.8.5):
pip install dnspython3
code:
import dns
from dns import resolver
result = resolver.resolve('google.com')
for ipval in result:
print('IP', ipval.to_text())

Issue installing zenipy, ModuleNotFoundError: no module named 'gi'

I'm trying to import zenipy for windows 10 after reading and experiencing that zenity-python simply will not work. So I installed zenipy and got the 'successfully installed' message from the command line but now when trying to import it I get :
ModuleNotFoundError: No module named 'gi'
in PyCharm I am writing:
from zenipy import *
Please can someone help me to import zenipy and tell me what is going wrong?
Looks like it's not installed or don't have the dependencies that need. Try pip uninstall zenipy and then pip install zenipy.
Or download and install the repo on GitHub.
$ git clone https://github.com/poulp/zenipy.git
$ cd ./zenipy
$ python setup.py install

ModuleNotFoundError: No module named 'python_jwt' (Raspberry Pi)

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

Python mysql.connector.pooling ImportError: No module named pooling

I am facing some difficulty when I try to run a Flask app. I get the following import error:
File "/db/mysql_utils.py", line 2, in <module>
import mysql.connector.pooling
ImportError: No module named pooling
I tried several ways to install mysql_connector_python-1.0.12 such as
sudo pip install https://cdn.mysql.com/Downloads/Connector-Python/mysql-connector-python-1.0.12.tar.gz
Download the file to local and install it. Also tried running the setup.py and had no luck.
I am assuming mysql.connector.pooling is part of mysql-connector-python, but please correct me if I am wrong.
Thanks
On my Centos7 box, i installed the community-release repo and mysql-connector.
sudo yum update mysql-community-release
sudo yum install mysql-connector-python
https://dev.mysql.com/doc/connector-python/en/connector-python-installation-binary.html

exceptions.ImportError: cannot import name TwitterAPI

Keep getting this error and not sure why,
exceptions.ImportError: cannot import name TwitterAPI
TwitterAPI library is already downloaded, I download it first from pip install twitterapi, didnt work, uninstall it and download the .zip file for it, and tried to install it using
python setup.py build
python setup.py install
didnt work too, still getting the same error, any ideas?
the code:
from TwitterAPI import TwitterAPI
TRACK_TERM = 'NBA'
api = TwitterAPI(consumer_key='__', consumer_secret='__', access_token_key='__', access_token_secret='__')
r = api.request('statuses/filter', {'track': TRACK_TERM})
for item in r:
print (item['text'] if 'text' in item else item)
Please write this command that set:
pip install python-twitter
Because you installed TwitterAPI from a zip file, the package is not necessarily in a path where Python will see it. That is why import fails. Your best bet is to try installing with pip again, but this time use the proper case since pip is case sensitive:
pip install TwitterAPI
You should to install requests (or upgrade them) like in this issue.
pip install requests
or
pip install --upgrade requests
Probably need to set PYTHONPATH:
export PYTHONPATH=`pwd`

Categories