Closed nateGeorge closed 6 years ago
Maybe try again with python3-pip? I'm using pip for Python 3 and have no problems.
You should use virtualenv.
I cannot reproduce the problem...
$ pip install google
Collecting google
Downloading google-1.9.3-py2.py3-none-any.whl
Requirement already satisfied: beautifulsoup4 in /usr/lib/python2.7/dist-packages (from google)
Installing collected packages: google
Successfully installed google-1.9.3
$ python
Python 2.7.12+ (default, Sep 17 2016, 12:08:02)
[GCC 6.2.0 20160914] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from google import search
>>>
Perhaps you have another module with the same name?
Ah, I get it now, this other ticket describes the problem: https://github.com/MarioVilas/googlesearch/issues/36
Changed the name of the package to "googlesearch" to avoid the name collision. Also updated the version number since this would break existing scripts.
Changed the name of the package to "googlesearch" to avoid the name collision. Also updated the version number since this would break existing scripts.
how can i do this ?
Change "from google import search" To from googlesearch import search
ImportError: cannot import name 'search' from 'googlesearch'
You'll have to give me more that that because I've no idea what you have installed or how in your computer.
On Sun, Sep 29, 2019 at 11:46 PM ThePyProgrammer notifications@github.com wrote:
ImportError: cannot import name 'search' from 'googlesearch'
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/MarioVilas/googlesearch/issues/39?email_source=notifications&email_token=AABXUU5XQIYU4UGIKNBBZ2LQMDEV5A5CNFSM4DZQVX4KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD73YEKI#issuecomment-536314409, or mute the thread https://github.com/notifications/unsubscribe-auth/AABXUU5ACZGCJTVZ7NEZD2DQMDEV5ANCNFSM4DZQVX4A .
-- “There's a reason we separate military and the police: one fights the enemy of the state, the other serves and protects the people. When the military becomes both, then the enemies of the state tend to become the people.”
AttributeError: module 'googlesearch' has no attribute 'search'
This is not working on google colab apparently.
Seems to work for me...
Thank you for your valuable time. I think it was the issue of the name collision. There were different modules I had installed for google-search. So I uninstalled all of them and then reinstalled "pip install google" only and then it worked.
Glad to be of help! :)
Thank you for your valuable time. I think it was the issue of the name collision. There were different modules I had installed for google-search. So I uninstalled all of them and then reinstalled "pip install google" only and then it worked.
Had the exact same issue, changed to a new clean venv and it worked
I've installed google via pip for both python2 (system distro) and anaconda for python3. I'm using ubuntu 16.04. When I try to import anything, like search, it says
ImportError: cannot import name 'search'
That's after doing
from google import search
The same thing happens in python2 or 3.
When I import google and check the 'dir', it says: (python3)
(python2)
Any ideas what's going on? The
__init__.py
file looks fine where it's installed, which I found fromgoogle.__path__
. But I thought for most packages,.__file__
was the way to specify the filepath to the module.