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>
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 *
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
OS: Mac OS X. When I'm trying to run the code below, I get the error:
ImportError: cannot import name HeaderParsingError
I've attached traceback below the code.
I've tried to solve this issue for 20 min now, using Google and other stackoverflow. I have tried running:
pip install urllib3 --upgrade
I've also tried reinstalling the requests package.
It did not help.
This seems to be an issue with my requests or urllib3 package. Has anyone had a similar issue?
The code:
import requests
import json
def printResponse(r):
print '{} {}\n'.format(json.dumps(r.json(), sort_keys=True, indent=4, separators=(',', ': ')), r)
r = requests.get('http://wikitest.orcsoftware.com/rest/api/content',
params={'title': 'new page'},
auth=('seb', '****'))
printResponse(r)
parentPage = r.json()['results'][0]
pageData = {'type': 'comment', 'container': parentPage,
'body': {'storage': {'value': "<p>A new comment</p>", 'representation': 'storage'}}}
r = requests.post('http://localhost:8080/confluence/rest/api/content',
data=json.dumps(pageData),
auth=('admin', 'admin'),
headers=({'Content-Type': 'application/json'}))
printResponse(r)
This is the traceback:
Traceback (most recent call last):
File "/Users/sebastian/OneDrive/orc/restAPI/createSpace.py", line 1, in <module>
import requests
File "/Library/Python/2.7/site-packages/requests/__init__.py", line 61, in <module>
from . import utils
File "/Library/Python/2.7/site-packages/requests/utils.py", line 25, in <module>
from .compat import parse_http_list as _parse_list_header
File "/Library/Python/2.7/site-packages/requests/compat.py", ine 7, in <module>
from .packages import charade as chardet
File "/Library/Python/2.7/site-packages/requests/packages/__init__.py", line 3, in <module>
from . import urllib3
File "/Library/Python/2.7/site-packages/requests/packages/urllib3/__init__.py", line 16, in <module>
from .connectionpool import (
File "/Library/Python/2.7/site-packages/requests/packages/urllib3/connectionpool.py", line 33, in <module>
from .connection import (
File "/Library/Python/2.7/site-packages/requests/packages/urllib3/connection.py", line 41, in <module>
from .util import (
File "/Library/Python/2.7/site-packages/requests/packages/urllib3/util/__init__.py", line 4, in <module>
from .response import is_fp_closed
File "/Library/Python/2.7/site-packages/requests/packages/urllib3/util/response.py", line 3, in <module>
from ..exceptions import HeaderParsingError
ImportError: cannot import name HeaderParsingError
requests comes with its own copy of the urllib3 library, in the requests/packages subdirectory. It is this copy that is somehow broken.
Reinstall requests itself; either upgrade (you have at most version 2.1.0, given the from .packages import charade as chardet line), or reinstall the existing version.
Reinstalling with pip can be done with the --force-reinstall switch:
pip install --force-reinstall requests==2.1.0
or force an upgrade:
pip install --upgrade requests
I had the same issue while I was simply trying to make any command using pip. At the end I found a very simple solution, just use sudo before pip.
Specifically for above issue, I have used following command.
sudo pip install --upgrade urllib3
Hope that will help.
It could be an issue with the "urllib3" package itself. uninstall/install will fix the problem.
sudo pip uninstall urllib3
sudo pip install --upgrade urllib3
In my case, the error was:
ImportError: cannot import name UnrewindableBodyError
Another issue could be that, urllib3 was installed via pip, and requests installed via yum repo, or vice-versa. In that case, the fix is to completely remove these libraries and install it via same repo.
I recommend pip over yum to install both packages as it is easy to maintain and gives more control. Any further yum updates required for OS patching or VM maintenance activities etc., won't impact the packages installed via pip.
First remove all installations of “urllib3” and “requests” via pip and yum:
sudo pip uninstall urllib3 -y
sudo pip uninstall requests -y
sudo yum remove python-urllib3 -y
sudo yum remove python-requests -y
To have single source of installations, use either of the below steps, not both.
Now install both packages only via pip:
sudo pip install --upgrade urllib3
sudo pip install --upgrade requests
Or, use only yum. I prefer pip over yum as explained above.
To install both packages only via yum:
sudo yum install python-urllib3
sudo yum install python-requests
Note: Always use virtual environment to avoid conflicts when an yum update happens at OS level.