Python – Error importing NLTK on PyCharm

nltkpycharmpython

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?

Best Answer

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.

Related Topic