I installed the google module by Mario Vilas in my virtual environment in ubuntu 14.04 with python2.7
https://pypi.python.org/pypi/google
I have done this before in both windows and Ubuntu and it worked fine.
However, now when I do the following
>>> from google import search
Traceback (most recent call last):
File "<input>", line 1, in <module>
ImportError: cannot import name search
I am using pycharm and I can view the package and its modules and I can auto insert using ctrl+space
I tried giving total privileges to the virtual venv package using sudo chmod -R ugo+rX but to no avail
The shortest work around for this will be:
from googlesearch import search
Your installation of Python came with a built-in module named google which is taking precedence over the one you installed. You have two options:
Remove the built-in module.
Use importlib to import the desired module by its filesystem path:
google = importlib.import_module('/usr/local/lib/python2.7/site-packages/google/__init__.py')
"from google import search" is giving error as there is no module with the name "google".After "pip install google" i checked the path to find out out the module in lib, but i was not able to find. I checked and found a module with "googlesearch". By doing the below change in my code i was able to solve the issue
OLD : "from google import search"
NEW : "from googlesearch import search"
simply install both google and google-search
pip install google
pip install google-search
It works for me
Just import google and you will be all set :)
import google
It is tested and verified.
I have gone through the same problem and i solve it by importing googlesearch API like this:
from googlesearch import *
Related
Brownie framework community:
please help. I'm trying to use an external python module, PyGithub, in my python script in the scripts folder. I've pip installed it:
pip install PyGithub
In scripts/create.py, I try to import it:
from github import Github <----- error
from brownie import accounts, convert
def main(): ...
however, when I try running it:
brownie run create.py
I get the error:
ModuleNotFoundError: No module named 'github'
The import statement works perfectly fine in python. Any suggestions on how to resolve this? thanks
When i attempt to import selenium i get the error:
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import selenium
ModuleNotFoundError: No module named 'selenium'
My selenium module is currently in:
C:\Users\Maseeek\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\selenium
I've seen other people have it in a different directory and want to know how to fix it.
If you are using "PYCHARM" and if you created project with "Virtual Environment" you should choose "Python 3.x.x" instead of "Virtual Environment Python 3.9" that PyCharm created.
If you installed "anaconda" before you need to change paths of libaries.
If you're using PyCharm, then this might help:
PyCharm sometimes shows an error in importing modules that have already been installed (that's annoying). But, try to change the file location to this destination:
C:\Users\Maseeek\PyCharm Projects\(project name)\venv\site-packages\
or try installing the package in PyCharm using python with the following code:
from sys import *
from subprocess import *
call(["-m", "pip", "install", "selenium"])
I recently tried to view Google Calendar using python . To do that I referred Python Quickstart. I did the steps that were mentioned in the website.
I completed the second step and downloaded the secretclient.json file.
In the terminal I typed in :
pip install --upgrade google-api-python-client
as I was instructed in the website.
I ran the python that was on the website and when I compiled I got the error:
Blockquote
Traceback (most recent call last):
File "quickstart.py", line 2, in
from apiclient import discovery
ModuleNotFoundError: No module named 'apiclient'
The Lines which correspond to the error are :
from apiclient import discovery
Why is the apiclient module unavailable ?
Could it be that you're using a different python version than what the pip installed? For example, if you use python3 to execute the problematic import line, but pip is for python2. Or if you use conda or another python distribution that uses a different path to import the packages from.
You can verify it if you just open from the command line:
python
then
from apiclient import discovery
and check if you still get the error.
you can resolve this by going to Script folder of your Python installation directory and running from there
e.g.
cd D:\Python27\Scripts\
python
from apiclient import discovery
Mainly this issue arises when u have more than one python installation , as noob have suggested
i'm currently into learning a bit of python and i want to import the paperclip third party module into my python file.
Yes, i already installed the pyperclip module with
pip install pyperclip.
if i create a file on my desktop, i get an error which says
Traceback (most recent call last):
File "test.py", line 1, in <module>
import pyperclip
ImportError: No module named pyperclip
However if i put the test.py in my python folder, it runs.
The question now is, is there a way to make all my installed modules available on a global scope ? I just want to have my file e.g. on my Desktop and run it without having import issues.
Thank you.
Greetings
Edit: I'm working on a Mac, maybe this leads to the problem
Found the problem.
The pip installautomatically used pip3.5 install
whereas python test.pydidn't use python3.5 test.py
Thank you #Bakurìu
Is there a way i can define python3.5as python?
You can do this :
pip3.5 install paperclip
pyperclip is install but not paperclip
I have added a validators library to my google app engine by manually adding the code to a folder lib/validators. Then in my code I added this line
from validators.utils import ValidationFailure
When I run my app I got an exception from this line:
from validators.utils import ValidationFailure
File "lib/validators/__init__.py", line 1, in <module>
from .between import between
File "lib/validators/between.py", line 2, in <module>
from .utils import validator
File "lib/validators/utils.py", line 5, in <module>
from decorator import decorator
ImportError: No module named decorator
If I run from decorator import decorator in the python intrepretor, it works as expected.
However when I tried it in the 'interactive console' in the local development server, I got the same error
How can I resolve this exception?
This worked for me, I installed the decorator package specifically for Python 3.4:
sudo python3.4 -m pip install decorator # specifically Python 3.4
I need to copy the decorator.py and its dependency six.py into the same 'lib' folder.
For python3 or above, use
sudo apt-get install python3-decorator
If you're using anaconda, the best approach is to install it through conda install decorator.
I hope you find it useful.
I create the symbolic links like previous answer said, but doesn't work for me.
I have to download the source package
https://pypi.python.org/pypi/decorator#downloads
and I have reinstalled it manually "$ python setup.py install"
And It worked