Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gensim installation problems

Tags:

python

pip

gensim

I am trying to install gensim on a google cloud instance using:

pip3 install gensim

and this is the stacktrace when I am trying to import gensim:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.4/dist-packages/gensim/__init__.py", line 6, in <module>
    from gensim import parsing, matutils, interfaces, corpora, models, similarities, summarization
  File "/usr/local/lib/python3.4/dist-packages/gensim/models/__init__.py", line 7, in <module>
    from .coherencemodel import CoherenceModel
  File "/usr/local/lib/python3.4/dist-packages/gensim/models/coherencemodel.py", line 30, in <module>
    from gensim.models.wrappers import LdaVowpalWabbit, LdaMallet
  File "/usr/local/lib/python3.4/dist-packages/gensim/models/wrappers/__init__.py", line 5, in <module>
    from .ldamallet import LdaMallet
  File "/usr/local/lib/python3.4/dist-packages/gensim/models/wrappers/ldamallet.py", line 43, in <module>
    from smart_open import smart_open
  File "/usr/local/lib/python3.4/dist-packages/smart_open/__init__.py", line 1, in <module>
    from .smart_open_lib import *
  File "/usr/local/lib/python3.4/dist-packages/smart_open/smart_open_lib.py", line 36, in <module>
    import boto.s3.key
  File "/usr/local/lib/python3.4/dist-packages/boto/s3/key.py", line 33, in <module>
    import boto.utils
  File "/usr/local/lib/python3.4/dist-packages/boto/__init__.py", line 1216, in <module>
    boto.plugin.load_plugins(config)
AttributeError: 'module' object has no attribute 'plugin'

This is the linux version (output of lsb_release -a):

No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 8.6 (jessie)
Release:    8.6
Codename:   jessie

and this is the output of

pip3 freeze

Cython==0.25.1
Flask==0.11.1
Jinja2==2.8
MarkupSafe==0.23
Pillow==2.6.1
Werkzeug==0.11.11
beautifulsoup4==4.3.2
boto==2.43.0
bz2file==0.98
chardet==2.3.0
click==6.6
colorama==0.3.2
decorator==3.4.0
gensim==0.13.3
html5lib==0.999
itsdangerous==0.24
lxml==3.4.0
matplotlib==1.4.2
nltk==3.2.1
nose==1.3.4
numexpr==2.4
numpy==1.11.2
pandas==0.14.1
pyparsing==2.0.3
python-apt==0.9.3.12
python-dateutil==2.2
pytz==2012c
requests==2.4.3
scipy==0.14.0
six==1.8.0
smart-open==1.3.5
stop-words==2015.2.23.1
tables==3.1.1
unattended-upgrades==0.1
urllib3==1.9.1
wheel==0.24.0

Can anybody give me pointers! This is very frustrating.

like image 248
VJune Avatar asked Nov 22 '16 01:11

VJune


2 Answers

had the same problem, in case anyone stumbles upon this: GCE is broken somehow

pip install google-compute-engine

from https://github.com/GoogleCloudPlatform/compute-image-packages/issues/262

works

like image 98
AdrianLoer Avatar answered Oct 21 '22 23:10

AdrianLoer


Fixed it:

sudo pip3 uninstall boto

sudo pip3 install boto

It seemed to be a google compute cloud thing.

like image 34
VJune Avatar answered Oct 21 '22 22:10

VJune