Search code examples
pythonpycharmanacondagoogle-search-apiconflicting-libraries

Conflicting libraries error in Python


I'm trying to install a library and run it on PyCharm. Tried to install it through PyCharm but I wasn't able, some error happened:

Collecting Google-Search-API
Using cached Google-Search-API-1.1.13.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/private/var/folders/5t/y8w_0_2j52l866cgl2p2q0nm0000gn/T/pycharm-packaging0.tmp/Google-Search-API/setup.py", line 15, in <module>
    with open("test_requirements.txt") as f:
FileNotFoundError: [Errno 2] No such file or directory: 'test_requirements.txt'

Together with the error message there was a sugestion:

"Try to run this command from the system terminal. Make sure that you use the correct version of 'pip' installed for your Python interpreter located at '/Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5'."

Cool. So I went to terminal, did a export PATH=/Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5:$PATH to make sure that pip was sending the lib to the right place.

After tried pip install Google-Search-API, all seemed alright:

MacBook-Air-2:~ santanna_santanna$ pip install Google-Search-API
Requirement already satisfied: Google-Search-API in /anaconda/lib/python2.7/site-packages

No errors, all cool.

So I went back to PyCharm and, as suggested in the [Google-Search-API GitHub][1] typed:

import google

And got:

ImportError: No module named 'google'

I've been burning my brains to install that and use on PyCharm.

Note: After doing the export PATH=... on terminal I did a which python and the answer terminal gave me was //anaconda/bin/python

EDIT

Tried sudo /Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5 -m pip install Google-Search-API and the error I got was very similar to the one on PyCharm:

The directory '/Users/santanna_santanna/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/santanna_santanna/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting Google-Search-API
  Downloading Google-Search-API-1.1.13.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/tmp/pip-build-j2qk3_00/Google-Search-API/setup.py", line 15, in <module>
        with open("test_requirements.txt") as f:
    FileNotFoundError: [Errno 2] No such file or directory: 'test_requirements.txt'

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/tmp/pip-build-j2qk3_00/Google-Search-API/
You are using pip version 8.1.2, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

Solution

  • This package is in alpha status and only supports Python 2, according to its PyPI page: https://pypi.python.org/pypi/Google-Search-API. That's probably the reason why it installs with errors.

    I would suggest to either use an alternative solution to query the Google search API, or switch to Python 2 if you absolutely must use this package.