Problems while calling NLTK with Python 3.5.2_2?
<p>When I try to import nltk in python 3.5.2_2 I get the following message:</p>

<pre><code>&gt;&gt;&gt; import nltk
Traceback (most recent call last):
  File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  File "/usr/local/lib/python3.5/site-packages/nltk/__init__.py", line 117, in &lt;module&gt;
    from nltk.align import *
  File "/usr/local/lib/python3.5/site-packages/nltk/align/__init__.py", line 15, in &lt;module&gt;
    from nltk.align.ibm1 import IBMModel1
  File "/usr/local/lib/python3.5/site-packages/nltk/align/ibm1.py", line 18, in &lt;module&gt;
    from nltk.corpus import comtrans
  File "/usr/local/lib/python3.5/site-packages/nltk/corpus/__init__.py", line 64, in &lt;module&gt;
    from nltk.tokenize import RegexpTokenizer
  File "/usr/local/lib/python3.5/site-packages/nltk/tokenize/__init__.py", line 65, in &lt;module&gt;
    from nltk.tokenize.regexp   import (RegexpTokenizer, WhitespaceTokenizer,
  File "/usr/local/lib/python3.5/site-packages/nltk/tokenize/regexp.py", line 201, in &lt;module&gt;
    blankline_tokenize = BlanklineTokenizer().tokenize
  File "/usr/local/lib/python3.5/site-packages/nltk/tokenize/regexp.py", line 172, in __init__
    RegexpTokenizer.__init__(self, r'\s*\n\s*\n\s*', gaps=True)
  File "/usr/local/lib/python3.5/site-packages/nltk/tokenize/regexp.py", line 119, in __init__
    self._regexp = compile_regexp_to_noncapturing(pattern, flags)
  File "/usr/local/lib/python3.5/site-packages/nltk/internals.py", line 54, in compile_regexp_to_noncapturing
    return sre_compile.compile(convert_regexp_to_noncapturing_parsed(sre_parse.parse(pattern)), flags=flags)
  File "/usr/local/lib/python3.5/site-packages/nltk/internals.py", line 50, in convert_regexp_to_noncapturing_parsed
    parsed_pattern.pattern.groups = 1
AttributeError: can't set attribute
</code></pre>

<p>I tried to reinstall it with pip3 and I am still having the same issue... Any idea of how to correctly install NLTK in OSX?, and how to solve this issue?.</p>

<p>I solved this issue by upgrading with pip3 nltk and sklearn:</p>

<pre><code>user@MacBook-Pro-de-User:~$ pip3 install nltk --upgrade
Collecting nltk
  Downloading nltk-3.2.1.tar.gz (1.1MB)
    100% |ââââââââââââââââââââââââââââââââ| 1.1MB 675kB/s
Building wheels for collected packages: nltk
  Running setup.py bdist_wheel for nltk ... done
  Stored in directory: /Users/user/Library/Caches/pip/wheels/55/0b/ce/960dcdaec7c9af5b1f81d471a90c8dae88374386efe6e54a50
Successfully built nltk
Installing collected packages: nltk
  Found existing installation: nltk 3.0.0
    Uninstalling nltk-3.0.0:
      Successfully uninstalled nltk-3.0.0
Successfully installed nltk-3.2.1
user@MacBook-Pro-de-User:~$ python3
Python 3.5.2 (default, Sep 28 2016, 18:08:09)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.38)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
&gt;&gt;&gt; import nltk
/usr/local/lib/python3.5/site-packages/sklearn/utils/fixes.py:55: DeprecationWarning: inspect.getargspec() is deprecated, use inspect.signature() instead
  if 'order' in inspect.getargspec(np.copy)[0]:
&gt;&gt;&gt;
user@MacBook-Pro-de-User:~$ clear
user@MacBook-Pro-de-User:~$ pip3 install sklearn --upgrade
Requirement already up-to-date: sklearn in /usr/local/lib/python3.5/site-packages
Collecting scikit-learn (from sklearn)
  Downloading scikit_learn-0.18-cp35-cp35m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (6.8MB)
    100% |ââââââââââââââââââââââââââââââââ| 6.8MB 202kB/s
Installing collected packages: scikit-learn
  Found existing installation: scikit-learn 0.15.2
    Uninstalling scikit-learn-0.15.2:
      Successfully uninstalled scikit-learn-0.15.2
Successfully installed scikit-learn-0.18
user@MacBook-Pro-de-User:~$ clear
user@MacBook-Pro-de-User:~$ python3
Python 3.5.2 (default, Sep 28 2016, 18:08:09)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.38)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
&gt;&gt;&gt; import nltk
&gt;&gt;&gt; 
</code></pre>

python python-3.x nltk python-3.5