question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot import name search

See original GitHub issue

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)

In [84]: dir(google)
Out[84]: ['__doc__', '__loader__', '__name__', '__package__', '__path__', '__spec__']

(python2)

In [3]: dir(google)
Out[3]: ['__doc__', '__name__', '__path__']

Any ideas what’s going on? The __init__.py file looks fine where it’s installed, which I found from google.__path__. But I thought for most packages, .__file__ was the way to specify the filepath to the module.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:5
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
ThePyProgrammercommented, Sep 29, 2019

ImportError: cannot import name ‘search’ from ‘googlesearch’

2reactions
adhv45commented, Apr 28, 2020

AttributeError: module ‘googlesearch’ has no attribute ‘search’

This is not working on google colab apparently.

Read more comments on GitHub >

github_iconTop Results From Across the Web

python - ImportError: cannot import name 'search' from 'google ...
I would install googlesearch using python3 -m pip install googlesearch-python. Then the function is simple to call. from googlesearch import ...
Read more >
How to Fix ImportError: Cannot Import Name in Python - Rollbar
The Python ImportError: cannot import name error occurs when an imported class is not accessible or is in a circular dependency.
Read more >
How to Fix : “ImportError: Cannot import name X” in Python
In Python "ImportError: cannot import name" error generally occurs when the imported class is not accessible, or the imported class is in a...
Read more >
Cannot import name 'search' from 'google_search' - Replit
The line that I used to do it was: 'from googlesearch import search' I had tried running the same code on pycharm and...
Read more >
ImportError: cannot import name X in Python [Solved]
The Python "ImportError: cannot import name" often occurs when we have circular imports (importing members between the same files).
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found