1

I'm trying to import NLTK in PyCharm, and get the following error. I'm on Mac OS 10.5.8 with Python 2.7.6. What could be going on? I'm completely new to programming, so sorry if there's something basic that I'm missing.

Install packages failed: Error occurred when installing package nltk.

The following command was executed:

packaging_tool.py install --build-dir /private/var/folders/NG/NGoQZknvH94yHKezwiiT+k+++TI/-Tmp-/pycharm-packaging3166068946358630595.tmp nltk

The error output of the command:

Downloading/unpacking nltk
Could not fetch URL https://pypi.python.org/simple/nltk/: There was a problem confirming the ssl certificate: <urlopen error [Errno 1] _ssl.c:507: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed>
Will skip URL https://pypi.python.org/simple/nltk/ when looking for download links for nltk
Could not fetch URL https://pypi.python.org/simple/: There was a problem confirming the ssl certificate: <urlopen error [Errno 1] _ssl.c:507: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed>
Will skip URL https://pypi.python.org/simple/ when looking for download links for nltk
Cannot fetch index base URL https://pypi.python.org/simple/
Could not fetch URL https://pypi.python.org/simple/nltk/: There was a problem confirming the ssl certificate: <urlopen error [Errno 1] _ssl.c:507: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed>
Will skip URL https://pypi.python.org/simple/nltk/ when looking for download links for nltk
Could not find any downloads that satisfy the requirement nltk
Cleaning up...
No distributions at all found for nltk
Storing complete log in /Users/Tom/.pip/pip.log

ETA: OK, now I've successfully installed NLTK from the command line, and then was able to install it in PyCharm -- but only for the Python 2.5.1 interpreter. If I try it with Python 2.7.6, I still get the error above. Does this matter, or should I not worry about it and just use it with 2.5.1?

TKR
  • 185
  • 1
  • 2
  • 11

3 Answers3

2

You'd be much better off sticking with the latest version of pip (1.5.6) and just telling it that you don't care about the security of your python packages:

pip install --allow-all-external --allow-unverified ntlk nltk

If you really want to be sure an install runs without complaint, you can also tell it not to overwrite any existing installations:

pip install --upgrade --force-reinstall --allow-all-external --allow-unverified ntlk nltk

And sudo if you get file write permission errors.

hobs
  • 18,473
  • 10
  • 83
  • 106
1

I use PyCharm but never install packages through PyCharm, I always use Terminal and install them with mostly pip or easy_install (in my virtual environment). Maybe you can just install the package from terminal..

sudo pip install nltk (https://pypi.python.org/pypi/nltk)

or

sudo easy_install nltk (if you don't have pip installed)

And then in PyCharm, make sure in preferences you set your Project Interpreter to the python path with your installed packages.

  • Thanks, but installing from the Terminal was actually what I tried first; I keep getting errors (see [this question](http://stackoverflow.com/questions/23570671/please-help-a-newbie-install-nltk-on-mac-os-10-5-8)). – TKR May 09 '14 at 18:03
  • I've now succeeded in installing from the Terminal! Sorry for the total noob question, but how exactly should I change the Project Interpreter? The current path is /Library/Frameworks/Python.framework/Versions/2.7/bin/python, but I'm not sure where NLTK installed -- I ran it out of my Downloads folder, and I think it just built there. Should I build it again in a different folder? – TKR May 09 '14 at 18:18
  • It's all good, I'm a lifetime noob. In PyCharm -> Preferences, select Project Interpreter -> Python Iterpreters. You should see a list of Python's installed (you might only have one) and then under that, you should see the packages installed. From terminal you can also type, 'pip freeze', or 'pip list' and it should give you a list of packages you have installed. – Ryan Loechner May 09 '14 at 18:23
  • Thanks, that's what I've been doing -- I have NLTK installed under the 2.5.1 interpreter, but when I try to install it under 2.7.6 I get the error above. – TKR May 09 '14 at 19:06
0

I have run into this (and just did again), I don't remember exactly where I found the answer, but it's an openssl version + local certificate issue (spoken like someone who's only vaguely familiar with the concepts). The way I have worked around this is to downgrade pip:

easy_install pip==1.2.1

After that you should be able to pip install again.

Matt Savoie
  • 722
  • 1
  • 8
  • 13