Error "no attribute 'LifoQueue" when installing gensim with pip on Ubuntu 16.04

442 views
Skip to first unread message

Michelle Berry

unread,
Feb 10, 2017, 7:07:03 PM2/10/17
to gensim
Hi,

I'm trying to install gensim on my vagrant machine running ubuntu 16.04. The package installs with no errors when I run "pip install gensim" but i get the following error when I import.

In [1]: import gensim

---------------------------------------------------------------------------

AttributeError                            Traceback (most recent call last)

<ipython-input-1-ec15f3ffe0f1> in <module>()

----> 1 import gensim


/home/vagrant/src/sourceror/env/lib/python2.7/site-packages/gensim/__init__.py in <module>()

      4 """

      5 

----> 6 from gensim import parsing, matutils, interfaces, corpora, models, similarities, summarization

      7 import logging

      8 


/home/vagrant/src/sourceror/env/lib/python2.7/site-packages/gensim/parsing/__init__.py in <module>()

      5 # bring model classes directly into package namespace, to save some typing

      6 from .porter import PorterStemmer

----> 7 from .preprocessing import *


/home/vagrant/src/sourceror/env/lib/python2.7/site-packages/gensim/parsing/preprocessing.py in <module>()

      8 import glob

      9 

---> 10 from gensim import utils

     11 from gensim.parsing.porter import PorterStemmer

     12 


/home/vagrant/src/sourceror/env/lib/python2.7/site-packages/gensim/utils.py in <module>()

     48 

     49 try:

---> 50     from smart_open import smart_open

     51 except ImportError:

     52     logger.info("smart_open library not found; falling back to local-filesystem-only")


/home/vagrant/src/sourceror/env/lib/python2.7/site-packages/smart_open/__init__.py in <module>()

----> 1 from .smart_open_lib import *


/home/vagrant/src/sourceror/env/lib/python2.7/site-packages/smart_open/smart_open_lib.py in <module>()

     26 import subprocess

     27 import sys

---> 28 import requests

     29 import io

     30 if sys.version_info[0] == 2:


/home/vagrant/src/sourceror/env/lib/python2.7/site-packages/requests/__init__.py in <module>()

     50 # Attempt to enable urllib3's SNI support, if possible

     51 try:

---> 52     from .packages.urllib3.contrib import pyopenssl

     53     pyopenssl.inject_into_urllib3()

     54 except ImportError:


/home/vagrant/src/sourceror/env/lib/python2.7/site-packages/requests/packages/__init__.py in <module>()

     25 

     26 try:

---> 27     from . import urllib3

     28 except ImportError:

     29     import urllib3


/home/vagrant/src/sourceror/env/lib/python2.7/site-packages/requests/packages/urllib3/__init__.py in <module>()

      6 import warnings

      7 

----> 8 from .connectionpool import (

      9     HTTPConnectionPool,

     10     HTTPSConnectionPool,


/home/vagrant/src/sourceror/env/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.py in <module>()

     56 

     57 # Pool objects

---> 58 class ConnectionPool(object):

     59     """

     60     Base class for all connection pools, such as


/home/vagrant/src/sourceror/env/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.py in ConnectionPool()

     63 

     64     scheme = None

---> 65     QueueCls = queue.LifoQueue

     66 

     67     def __init__(self, host, port=None):


AttributeError: 'module' object has no attribute 'LifoQueue'


I'm installing gensim in a virtual environment. Here is the result of pip freeze: 
appdirs==1.4.0
arrow==0.5.0
blinker==1.4
boto==2.45.0
bz2file==0.98
click==6.7
Faker==0.7.7
Flask==0.12
Flask-DebugToolbar==0.10.0
Flask-SQLAlchemy==2.1
future==0.14.3
gensim==0.13.4.1
ipaddress==1.0.18
itsdangerous==0.24
Jinja2==2.9.5
MarkupSafe==0.23
memoized-property==1.0.2
mendeley==0.3.2
nltk==3.2.2
numpy==1.12.0
oauthlib==0.7.2
packaging==16.8
pkg-resources==0.0.0
psycopg2==2.6.2
pyparsing==2.1.10
python-dateutil==2.6.0
requests==2.13.0
requests-oauthlib==0.4.2
scipy==0.18.1
six==1.10.0
smart-open==1.3.5
SQLAlchemy==1.1.5
stop-words==2015.2.23.1
Werkzeug==0.11.15

Thanks for any help.

-Michelle

Lev Konstantinovskiy

unread,
Feb 14, 2017, 2:33:47 PM2/14/17
to gensim
Dear Michelle,

The problem is in the requests package and you should be able to reproduce it with import requests.
Request 2.13.0 works correctly on my machine with gensim so I suggest contacting the requests project for support.

Regards
Lev
Reply all
Reply to author
Forward
0 new messages