1

I have installed indeed and linkedin packages in my python environment using pip.

Everything shows up as successfully installed and then, when I start my python through the terminal, and do an import, it says module not found.

I referred to this and this forum post. However, their situation is slightly different than mine. In my case, the package is already installed successfully at the correct location. However, it does not seem to pick up.

Following is an example:

Installing linkedin package:

MacBook-Air:lib admin$ pip install linkedin
Downloading/unpacking linkedin
  Downloading linkedin-0.1.5.tar.gz
  Running setup.py (path:/private/var/folders/15/nylbk3955yz1y5_y17nysdfc0000gq/T/pip_build_admin/linkedin/setup.py) egg_info for package linkedin

Downloading/unpacking httplib2 (from linkedin)
  Downloading httplib2-0.9.tar.gz (204kB): 204kB downloaded
  Running setup.py (path:/private/var/folders/15/nylbk3955yz1y5_y17nysdfc0000gq/T/pip_build_admin/httplib2/setup.py) egg_info for package httplib2

Downloading/unpacking oauth2 (from linkedin)
  Downloading oauth2-1.5.211.tar.gz
  Running setup.py (path:/private/var/folders/15/nylbk3955yz1y5_y17nysdfc0000gq/T/pip_build_admin/oauth2/setup.py) egg_info for package oauth2

Downloading/unpacking simplejson (from linkedin)
  Downloading simplejson-3.6.5.tar.gz (73kB): 73kB downloaded
  Running setup.py (path:/private/var/folders/15/nylbk3955yz1y5_y17nysdfc0000gq/T/pip_build_admin/simplejson/setup.py) egg_info for package simplejson

Installing collected packages: linkedin, httplib2, oauth2, simplejson
  Running setup.py install for linkedin

  Running setup.py install for httplib2

  Running setup.py install for oauth2

  Running setup.py install for simplejson
    building 'simplejson._speedups' extension
    clang -fno-strict-aliasing -fno-common -dynamic -I/usr/local/include -I/usr/local/opt/sqlite/include -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/usr/local/Cellar/python/2.7.8_1/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c simplejson/_speedups.c -o build/temp.macosx-10.9-x86_64-2.7/simplejson/_speedups.o
    clang -bundle -undefined dynamic_lookup -L/usr/local/lib -L/usr/local/opt/sqlite/lib build/temp.macosx-10.9-x86_64-2.7/simplejson/_speedups.o -o build/lib.macosx-10.9-x86_64-2.7/simplejson/_speedups.so

Successfully installed linkedin httplib2 oauth2 simplejson
Cleaning up...
MacBook-Air:lib admin$ 

Started Python through a new terminal window and following is the output after trying to import linkedin package.

MacBook-Air:lib admin$ python
Python 2.7.6 (v2.7.6:3a1db0d2747e, Nov 10 2013, 00:42:54) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import linkedin
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named linkedin
>>> import sys
>>> sys.path
['', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages', '/Library/Python/2.7/site-packages']
>>> 
Community
  • 1
  • 1
user3694373
  • 140
  • 1
  • 9
  • Type `which python` and `which pip` on both windows? – hd1 Dec 12 '14 at 04:09
  • Thanks! I tried both the commands and got the following outputs: `/usr/local/bin/python` and `/usr/local/bin/pip` respectively. Is this not correct? Appreciate your help! – user3694373 Dec 12 '14 at 16:45

2 Answers2

3

You need to copy these library folder (linkedin,httplib2, oauth2 ,simplejson) to:

'/Library/Python/2.7/site-packages/'.

One more thing, make sure your Eclipse Preference point to there by this way: open Eclipse -> Prefereces -> Pydev-> Interpreters-> Python Interpreter -> Libraries tab. make sure '/Library/Python/2.7/site-packages' is already added.

Ve Pham
  • 303
  • 1
  • 9
  • 1
    Thanks! I also tried changing sys.path to include the path: /Library/Python/2.7/site-packages/ I copied over all packages from usr/local/lib/python2.7/site-packages to /Library/Python/2.7/site-packages/ and that worked. How can I make this change permanent? If all my packages are getting installed to usr/local/lib/python2.7/site-packages location, how can I tell python to look for packages at that location? I am not using interpreter for now. Only terminal and Anaconda. Any hints? Appreciate your help! – user3694373 Dec 12 '14 at 16:39
  • If you want to tell Python look for packages at 'usr/local/lib/python2.7/site-packages', you need to do some thing: open Eclipse -> Prefereces -> Pydev-> Interpreters-> Python Interpreter -> Libraries -> New Folder -> then point to 'usr/local/lib/python2.7/site-packages' -> Apply. – Ve Pham Dec 13 '14 at 02:57
  • 1
    Thanks! However, I am not using Eclipse. In stead, I am using Anaconda. Can you please let me know how to make these changes in Anaconda? – user3694373 Dec 13 '14 at 18:40
  • I have never been using Anaconda, but i think same way as above. – Ve Pham Dec 14 '14 at 09:31
  • 1
    I just copied over all my packages to Anaconda packages folder and that seemed to work. Thanks for all your help! – user3694373 Dec 15 '14 at 17:20
0

Try this (from an example):

from linkedin import linkedin
chris
  • 4,840
  • 5
  • 35
  • 66
  • Thanks! But, that was not working too. Looks like I had to copy over all my packages from usr/local/lib/python2.7/site-packages to /Library/Python/2.7/site-packages/ and that worked. I wonder how do I make this change permanent so that all packages are picked up in my Anaconda and python (via terminal) env. Any hints? Appreciate your help! – user3694373 Dec 12 '14 at 16:42