Installing pymogo from Jupyter Notebook

0 views
Skip to first unread message

Peter Lucas

unread,
Apr 30, 2018, 1:54:36 AM4/30/18
to conda - Public
Afternoon All,

We have decided to switch to Mongo Db to store our data. I would like to set my python scripts to pull data from the Mongo Db istead of pd.read_csv. I'd like to install the library and tried conda install -c anaconda pymongo

I'm getting the following error:

  File "<ipython-input-6-9a39d6ac74c1>", line 1
    conda install -c anaconda pymongo
                ^
SyntaxError: invalid syntax


Any ideas?

Peter
pymogo Install.png

Chris Withers

unread,
Apr 30, 2018, 1:56:38 AM4/30/18
to co...@continuum.io
On 30/04/2018 06:54, Peter Lucas wrote:
> Afternoon All,
>
> We have decided to switch to Mongo Db to store our data.

I wonder if mongo's reputation for storing data has improved?

> I would like to
> set my python scripts to pull data from the Mongo Db istead of
> pd.read_csv. I'd like to install the library and tried conda install -c
> anaconda pymongo
>
> I'm getting the following error:
>
> File "<ipython-input-6-9a39d6ac74c1>", line 1
> conda install -c anaconda pymongo
> ^
> SyntaxError: invalid syntax

You need to do this from the shell in which you would normally launch
jupyter, not from within a cell in the notebook.

cheers,

Chris

Peter Lucas

unread,
Apr 30, 2018, 2:23:59 AM4/30/18
to conda - Public
Hi Chris,

Same error in the console

Python 3.6.3 (v3.6.3:2c5fed8, Oct  3 2017, 17:26:49) [MSC v.1900 32 bit (Intel)]
 on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> conda install -c anaconda pymongo
  File "<stdin>", line 1
    conda install -c anaconda pymongo
                ^
SyntaxError: invalid syntax
>>>

Peter

Chris Withers

unread,
Apr 30, 2018, 2:52:13 AM4/30/18
to co...@continuum.io
Peter,

I said shell, not console. How are you starting Jupyter and how did you install it?

cheers,

Chris
--
You received this message because you are subscribed to the Google Groups "conda - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to conda+un...@continuum.io.
To post to this group, send email to co...@continuum.io.
Visit this group at https://groups.google.com/a/continuum.io/group/conda/.
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/conda/1eb3da43-8fb7-4037-bc36-ca4ee11c7ec1%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Peter Lucas

unread,
Apr 30, 2018, 3:04:50 AM4/30/18
to conda - Public
Jupyter is started from Anaconda. When I referred to console I refer to this exe:
C:\Users\pelucas\AppData\Local\Programs\Python\Python36-32\python.exe

Peter

On Monday, April 30, 2018 at 1:54:36 PM UTC+8, Peter Lucas wrote:
Launch Jupyter.png

Chris Withers

unread,
Apr 30, 2018, 3:10:05 AM4/30/18
to co...@continuum.io
There should be an option along the lines of "start anaconda shell" in the Anaconda menu, you need to be a in a DOS box (cmd.exe) started that way, then you can type the conda install command...


Chris

On 30/04/2018 08:04, Peter Lucas wrote:
--
You received this message because you are subscribed to the Google Groups "conda - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to conda+un...@continuum.io.
To post to this group, send email to co...@continuum.io.
Visit this group at https://groups.google.com/a/continuum.io/group/conda/.

Peter Lucas

unread,
Apr 30, 2018, 3:18:18 AM4/30/18
to conda - Public
I didn't see any option in the Anaconda UI. But there is an option under the Python menu for IDLE which launches a shell (see attachment):

C:\Users\pelucas\AppData\Local\Programs\Python\Python36-32\pythonw.exe "C:\Users\pelucas\AppData\Local\Programs\Python\Python36-32\Lib\idlelib\idle.pyw"

Whwn I run various commands there, issue still arises.

Peter
Python Shell.png

Chris Withers

unread,
Apr 30, 2018, 3:22:43 AM4/30/18
to co...@continuum.io
Peter,

This is tricky, but you need to stop trying to type shell commands into Python REPLs (anything with a >>> won't work here).
The reason you keep getting SyntaxErrors is because 'conda install -c anaconda pymongo' is not python source code.

Idle, IPython and Jupyter are all Python REPLs and will only understand Python source code.
You need an operating system shell, on windows that's cmd.exe, but you also need it set up with the correct anaconda paths.
In the Anaconda section off the Windows start menu there will be something about "Anaconda Shell" or similar that has a little black square next to it.

If that's not possible, I can only suggest finding a local Windows support person to help you...

good luck!

Chris

Matthieu Dartiailh

unread,
Apr 30, 2018, 3:38:29 AM4/30/18
to co...@continuum.io

Hi Peter,

Alternatively from Anaconda Navigator you can install pymongo by going to the Environment tab and then searching for pymongo in the packages not yet installed (drop down menu at the top), marking it for installation and clicking apply.

Best,

Matthieu

Peter Lucas

unread,
Apr 30, 2018, 3:44:53 AM4/30/18
to conda - Public
Hi Chris, Matthieu,

I found both options. Looks to a firewall issue. I may need to chat to the Network Team 

Anaconda:

CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://repo.continuum.io/pkgs/main/win-64/repodata.json.bz2>

Elapsed: -


An HTTP error occurred when trying to retrieve this URL.

HTTP errors are often intermittent, and a simple retry will get you on your way.

ConnectTimeout(MaxRetryError("HTTPSConnectionPool(host='repo.continuum.io', port=443): Max retries exceeded with url: /pkgs/main/win-64/repodata.json.bz2 (Caused by ConnectTimeoutError(<urllib3.connection.VerifiedHTTPSConnection object at 0x00000000053B32E8>, 'Connection to repo.continuum.io timed out. (connect timeout=9.15)'))",),)


Anaconda Shell:


(C:\Users\pelucas\AppData\Local\Continuum\anaconda3) C:\Users\pelucas\Documents>

conda install -c anaconda pymongo

Fetching package metadata ...

CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://conda.anaconda.org/a

naconda/win-64/repodata.json>

Elapsed: -


An HTTP error occurred when trying to retrieve this URL.

HTTP errors are often intermittent, and a simple retry will get you on your way.


ConnectTimeout(MaxRetryError("HTTPSConnectionPool(host='conda.anaconda.org', por

t=443): Max retries exceeded with url: /anaconda/win-64/repodata.json (Caused by

 ConnectTimeoutError(<urllib3.connection.VerifiedHTTPSConnection object at 0x000

0000005391F60>, 'Connection to conda.anaconda.org timed out. (connect timeout=9.

15)'))",),)


Peter


Peter Lucas

unread,
Apr 30, 2018, 4:04:32 AM4/30/18
to conda - Public
Looks like it's a no go from Infra : ). Is there somewhere I can mannually download and install?

Peter
Reply all
Reply to author
Forward
0 new messages