o19s / relevant-search-book

Code and Examples for Relevant Search
302 stars 109 forks source link

Steps to run ipython notebook or python scripts for setup of TMDB #14

Closed k2spindrift closed 8 years ago

k2spindrift commented 8 years ago

Hi. I've just received the book and am working through examples. I'm comfortable with elasticsearch, but have never used python. I've followed the readme for setting up ipython notebook (now jupyter), but can't find out how to run the cells. I've also tried to use the python directly as scripts, but that is also elusive at the moment. Since time is of the essence, might you have a set of steps to run and verify the setup of the tmdb data? I tried to use _bulk directly in elastic, but the format isn't compatible. Any help greatly appreciated.

k2spindrift commented 8 years ago

Perhaps this is the problem? Jupyter shows this after In [4]: movieDict = extract()

reindex(movieDict=movieDict)


NameError Traceback (most recent call last)

in () 1 movieDict = extract() ----> 2 reindex(movieDict=movieDict) in reindex(analysisSettings, mappingSettings, movieDict) 10 settings['mappings'] = mappingSettings #C 11 ---> 12 resp = requests.delete("http://localhost:9200/tmdb") #D 13 resp = requests.put("http://localhost:9200/tmdb", 14 data=json.dumps(settings)) NameError: global name 'requests' is not defined My elasticsearch is up and running on the correct host/port: http://localhost:9200 { "name" : "test", "cluster_name" : "es-233-local", "version" : { "number" : "2.3.3", "build_hash" : "218bdf10790eef486ff2c41a3df5cfa32dadcfde", "build_timestamp" : "2016-05-17T15:40:04Z", "build_snapshot" : false, "lucene_version" : "5.5.0" }, "tagline" : "You Know, for Search" }
softwaredoug commented 8 years ago

Hi Kristen. Thanks for the issue. It looks like you need to install the python "requests" library. Simplest way for you might be to type "sudo pip install requests" into a shell.

Hope that helps! On Mon, Jul 25, 2016 at 7:33 PM Kristin notifications@github.com wrote:

Perhaps this is the problem? Jupyter shows this after In [4]: movieDict = extract()

reindex(movieDict=movieDict)

NameError Traceback (most recent call last) in () 1 movieDict = extract() ----> 2 reindex(movieDict=movieDict)

in reindex(analysisSettings, mappingSettings, movieDict) 10 settings['mappings'] = mappingSettings #C 11 ---> 12 resp = requests.delete("http://localhost:9200/tmdb") #D 13 resp = requests.put("http://localhost:9200/tmdb", 14 data=json.dumps(settings))

NameError: global name 'requests' is not defined

My elasticsearch is up and running on the correct host/port:

http://localhost:9200

{ "name" : "test", "cluster_name" : "es-233-local", "version" : { "number" : "2.3.3", "build_hash" : "218bdf10790eef486ff2c41a3df5cfa32dadcfde", "build_timestamp" : "2016-05-17T15:40:04Z", "build_snapshot" : false, "lucene_version" : "5.5.0" }, "tagline" : "You Know, for Search" }

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/o19s/relevant-search-book/issues/14#issuecomment-235118458, or mute the thread https://github.com/notifications/unsubscribe-auth/AAmZRG-HIfy56glZ3DUdXeJeFNa13Skrks5qZUfdgaJpZM4JUpSK .

softwaredoug commented 8 years ago

Also be sure to execute the shells in order as they appear in the Jupyter notebook. Later code cells depend on definitions and imports in earlier ones.

(Sorry getting this setup is so annoying) On Mon, Jul 25, 2016 at 8:02 PM Doug Turnbull softwaredoug@gmail.com wrote:

Hi Kristen. Thanks for the issue. It looks like you need to install the python "requests" library. Simplest way for you might be to type "sudo pip install requests" into a shell.

Hope that helps! On Mon, Jul 25, 2016 at 7:33 PM Kristin notifications@github.com wrote:

Perhaps this is the problem? Jupyter shows this after In [4]: movieDict = extract()

reindex(movieDict=movieDict)

NameError Traceback (most recent call last) in () 1 movieDict = extract() ----> 2 reindex(movieDict=movieDict)

in reindex(analysisSettings, mappingSettings, movieDict) 10 settings['mappings'] = mappingSettings #C 11 ---> 12 resp = requests.delete("http://localhost:9200/tmdb") #D 13 resp = requests.put("http://localhost:9200/tmdb", 14 data=json.dumps(settings))

NameError: global name 'requests' is not defined

My elasticsearch is up and running on the correct host/port:

http://localhost:9200

{ "name" : "test", "cluster_name" : "es-233-local", "version" : { "number" : "2.3.3", "build_hash" : "218bdf10790eef486ff2c41a3df5cfa32dadcfde", "build_timestamp" : "2016-05-17T15:40:04Z", "build_snapshot" : false, "lucene_version" : "5.5.0" }, "tagline" : "You Know, for Search" }

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/o19s/relevant-search-book/issues/14#issuecomment-235118458, or mute the thread https://github.com/notifications/unsubscribe-auth/AAmZRG-HIfy56glZ3DUdXeJeFNa13Skrks5qZUfdgaJpZM4JUpSK .

k2spindrift commented 8 years ago

Thanks Doug. I ran the pip for requests, see below (also tried upgrade flag), same issue. When ipython notebook opens, and I select chapter 3, the cells seem to run automatically. Any additional help would be greatly appreciated ... version 2.7.12 is fine, yes? I will keep trying on this end, too.

APP8G8WMEB26C3:ipython kkrau3$ sudo -H pip install requests Requirement already satisfied (use --upgrade to upgrade): requests in /Users/kkrau3/Development/anaconda2/lib/python2.7/site-packages

k2spindrift commented 8 years ago

Full console output from jupyter:

APP8G8WMEB26C3:ipython kkrau3$ jupyter notebook [W 11:26:02.060 NotebookApp] Unrecognized JSON config file version, assuming version 1 [I 11:26:02.335 NotebookApp] [nb_conda_kernels] enabled, 1 kernels found [I 11:26:02.690 NotebookApp] ✓ nbpresent HTML export ENABLED [W 11:26:02.690 NotebookApp] ✗ nbpresent PDF export DISABLED: No module named nbbrowserpdf.exporters.pdf [I 11:26:02.695 NotebookApp] [nb_conda] enabled [I 11:26:02.767 NotebookApp] [nbanacondacloud] enabled [I 11:26:02.773 NotebookApp] Serving notebooks from local directory: /Users/kkrau3/Development/relevant-search-book/ipython [I 11:26:02.774 NotebookApp] 0 active kernels [I 11:26:02.774 NotebookApp] The Jupyter Notebook is running at: http://localhost:8888/ [I 11:26:02.774 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation). [W 11:26:09.409 NotebookApp] Kernel not found: None [E 11:26:09.410 NotebookApp] { "Origin": "http://localhost:8888", "Content-Length": "99", "Accept-Language": "en-US,en;q=0.8,de;q=0.6,ja;q=0.4,fr;q=0.2,zh-CN;q=0.2,zh;q=0.2", "Accept-Encoding": "gzip, deflate", "Host": "localhost:8888", "Accept": "application/json, text/javascript, /_; q=0.01", "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36", "Dnt": "1", "Connection": "keep-alive", "X-Requested-With": "XMLHttpRequest", "Referer": "http://localhost:8888/notebooks/Chapter%203%20(Solving%20Your%20First%20Relevance%20Problem).ipynb", "Cookie": "_ga=GA1.1.1182480614.1462221468", "Content-Type": "application/json" } [E 11:26:09.410 NotebookApp] 501 POST /api/sessions (127.0.0.1) 221.21ms referer=http://localhost:8888/notebooks/Chapter%203%20(Solving%20Your%20First%20Relevance%20Problem).ipynb

softwaredoug commented 8 years ago

That sounds pretty odd! If you're open to it I would be happy to jump on a google hangout and look at what you're seeing.

k2spindrift commented 8 years ago

Hi Doug, thanks for the offer, but I've got it working. Here's what happened.... ipython notebook is now jupyter notebook whose installation recommends anaconda. I opted for the full installation and suspect a conflicting libarary preventing pip install requests from working. So, I started over - deleted the anaconda2 directory, then re-ran:

pip install requests

It worked.

Afterward, I ran

On Wed, Jul 27, 2016 at 1:41 PM, Doug Turnbull notifications@github.com wrote:

That sounds pretty odd! If you're open to it I would be happy to jump on a google hangout and look at what you're seeing.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/o19s/relevant-search-book/issues/14#issuecomment-235713902, or mute the thread https://github.com/notifications/unsubscribe-auth/AIEHcLKp1mMkn_T-dcaGsiwAsY1XcidXks5qZ8JhgaJpZM4JUpSK .

Kristin Kraus | Consulting Search Architect Spindrift | Mobile US +1 949 254 0028 | UK 020 8144 1965 | Skype k2kite http://www.spindriftgroup.com

k2spindrift commented 8 years ago

pip install ipython, but ipython notebook wouldn't start, so ran: pip install ipython[notebook] which added the correct supporting libraries.

ipython notebook command says it's deprecated, so killed server and ran jupyter notebook instead, your ipynb files were updated and it finally ran! Whew! Looking good now. Thanks for your timely responses.

On Wed, Jul 27, 2016 at 2:20 PM, Kristin Kraus kristin@spindriftgroup.com wrote:

Hi Doug, thanks for the offer, but I've got it working. Here's what happened.... ipython notebook is now jupyter notebook whose installation recommends anaconda. I opted for the full installation and suspect a conflicting libarary preventing pip install requests from working. So, I started over - deleted the anaconda2 directory, then re-ran:

pip install requests

It worked.

Afterward, I ran

On Wed, Jul 27, 2016 at 1:41 PM, Doug Turnbull notifications@github.com wrote:

That sounds pretty odd! If you're open to it I would be happy to jump on a google hangout and look at what you're seeing.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/o19s/relevant-search-book/issues/14#issuecomment-235713902, or mute the thread https://github.com/notifications/unsubscribe-auth/AIEHcLKp1mMkn_T-dcaGsiwAsY1XcidXks5qZ8JhgaJpZM4JUpSK .

Kristin Kraus | Consulting Search Architect Spindrift | Mobile US +1 949 254 0028 | UK 020 8144 1965 | Skype k2kite http://www.spindriftgroup.com

Kristin Kraus | Consulting Search Architect Spindrift | Mobile US +1 949 254 0028 | UK 020 8144 1965 | Skype k2kite http://www.spindriftgroup.com

Golii commented 8 years ago
                                                                                                                                                                                                                                                                                                                                                                                                                          Odesláno ze smartphonu se systémem BlackBerry 10.                                                                                                                                                                                                                Od: KristinOdesláno: středa, 27. července 2016 23:21Komu: o19s/relevant-search-bookOdpovědět: o19s/relevant-search-bookPředmět: Re: [o19s/relevant-search-book] Steps to run ipython notebook or python scripts for setup of TMDB (#14)Hi Doug, thanks for the offer, but I've got it working. Here's what

happened.... ipython notebook is now jupyter notebook whose installation recommends anaconda. I opted for the full installation and suspect a conflicting libarary preventing pip install requests from working. So, I started over - deleted the anaconda2 directory, then re-ran:

pip install requests

It worked.

Afterward, I ran

On Wed, Jul 27, 2016 at 1:41 PM, Doug Turnbull notifications@github.com wrote:

That sounds pretty odd! If you're open to it I would be happy to jump on a google hangout and look at what you're seeing.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/o19s/relevant-search-book/issues/14#issuecomment-235713902, or mute the thread https://github.com/notifications/unsubscribe-auth/AIEHcLKp1mMkn_T-dcaGsiwAsY1XcidXks5qZ8JhgaJpZM4JUpSK .

Kristin Kraus | Consulting Search Architect Spindrift | Mobile US +1 949 254 0028 | UK 020 8144 1965 | Skype k2kite http://www.spindriftgroup.com

—You are receiving this because you are subscribed to this thread.Reply to this email directly, view it on GitHub, or mute the thread.

Golii commented 8 years ago
                                                                                                                                                                                                                                                                                                                                                                                                                          Odesláno ze smartphonu se systémem BlackBerry 10.                                                                                                                                                                                                                Od: KristinOdesláno: středa, 27. července 2016 23:33Komu: o19s/relevant-search-bookOdpovědět: o19s/relevant-search-bookKopie: Golii XLL; CommentPředmět: Re: [o19s/relevant-search-book] Steps to run ipython notebook or python scripts for setup of TMDB (#14)Closed #14.

—You are receiving this because you commented.Reply to this email directly, view it on GitHub, or mute the thread.

Golii commented 8 years ago
                                                                                                                                                                                                                       if you're beautiful wet and sweet as your sweet mom was so write and send pictures of wet pussies !!! And then see how much money I spend !!!!                                                                                                                                                                                                   Odesláno ze smartphonu se systémem BlackBerry 10.                                                                                                                                                                                                                Od: KristinOdesláno: středa, 27. července 2016 23:33Komu: o19s/relevant-search-bookOdpovědět: o19s/relevant-search-bookKopie: Golii XLL; CommentPředmět: Re: [o19s/relevant-search-book] Steps to run ipython notebook or python scripts for setup of TMDB (#14)Closed #14.

—You are receiving this because you commented.Reply to this email directly, view it on GitHub, or mute the thread.

Golii commented 8 years ago
                                                                                                                                                                                                                       why do not you write ?? @ 're homosexual ???? then I am not interested !!!! but if you are handsome and wet picinka ktwra wants pořádnýho Madara and send pictures but please note that you are not like your father a pedophile but here hungarian Cigan and fucks pussy with us since 18 years !!!                                                                                                                                                                                                   Odesláno ze smartphonu se systémem BlackBerry 10.                                                                                                                                                                                                                Od: KristinOdesláno: středa, 27. července 2016 23:33Komu: o19s/relevant-search-bookOdpovědět: o19s/relevant-search-bookKopie: Golii XLL; CommentPředmět: Re: [o19s/relevant-search-book] Steps to run ipython notebook or python scripts for setup of TMDB (#14)Closed #14.

—You are receiving this because you commented.Reply to this email directly, view it on GitHub, or mute the thread.

Golii commented 8 years ago

why do not you write ?? @ 're homosexual ???? then I am not interested !!!! but if you are handsome and wet picinka ktwra wants pořádnýho Madara and send pictures but please note that you are not like your father a pedophile but here hungarian Cigan and fucks pussy with us since 18 years !!! Odesláno ze smartphonu se systémem BlackBerry 10. Od: Doug TurnbullOdesláno: středa, 27. července 2016 22:41Komu: o19s/relevant-search-bookOdpovědět: o19s/relevant-search-bookPředmět: Re: [o19s/relevant-search-book] Steps to run ipython notebook or python scripts for setup of TMDB (#14)That sounds pretty odd! If you're open to it I would be happy to jump on a google hangout and look at what you're seeing.

—You are receiving this because you are subscribed to this thread.Reply to this email directly, view it on GitHub, or mute the thread.