1

I am running the latest version of Python:

'3.6.5 |Anaconda custom (64-bit)| (default, Mar 29 2018, 13:14:23) \n[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)]'

Upon trying to import gensim like so:

from gensim.corpora import Dictionary
import numpy as np

I get the following error:

/anaconda/lib/python3.6/site-packages/boto/provider.py in <module>()
     32 
     33 import boto
---> 34 from boto import config
     35 from boto.compat import expanduser
     36 from boto.pyami.config import Config

ImportError: cannot import name 'config'

I have tried updating Python, all of the packages and their dependencies, and so on. Nothing seems to be working.

Any thoughts?

Parseltongue
  • 11,157
  • 30
  • 95
  • 160

1 Answers1

1

I have recently bumped into a similar problem as following as well:

/anaconda2/lib/python2.7/site-packages/boto3/session.py in <module>()
     16 
     17 import botocore.session
---> 18 from botocore.client import Config
     19 from botocore.exceptions import DataNotFoundError, UnknownServiceError
     20 

ImportError: cannot import name Config

Based on my experience, it is rooted in the conflict of dependencies for packages in your conda environment. So the way I resolved it is as following:

  1. Remove Anaconda completely. (see here)
  2. Reinstall Anaconda from scratch (see here)
  3. Install Gensim library with conda install -c anaconda gensim command

It is needful to say that to avoid future issues similar to this, you should try creating different environment variables for conda as it keeps packages separate from each other hence no conflict of packages. You can see this post that explains clearly how to create such an environment before starting your different projects

I hope that helps.

Habib Karbasian
  • 556
  • 8
  • 18