I was doing this and got this error :
from gensim.models import Word2Vec
ImportError: cannot import name 'open' from 'smart_open' (C:\ProgramData\Anaconda3\lib\site-packages\smart_open\__init__.py)
Then I did this :
import smart_open
dir(smart_open)
['BZ2File','BytesIO','DEFAULT_ERRORS','IS_PY2','P','PATHLIB_SUPPORT','SSLError','SYSTEM_ENCODING','Uri','__builtins__','__cached__','__doc__','__file__','__loader__','__name__','__package__','__path__','__spec__','boto','codecs','collections','gzip','hdfs','http','importlib','io','logger','logging','os','pathlib','pathlib_module','requests','s3','s3_iter_bucket','six','smart_open','smart_open_hdfs','smart_open_http','smart_open_lib','smart_open_s3','smart_open_webhdfs','sys','urlparse','urlsplit','warnings','webhdfs']
As you can see there is no 'open' in it so how should I solve this. I tried to install different versions and I upgraded all version too.
import smart_open
smart_open.open = smart_open.smart_open
from gensim.models import Word2Vec
Works well.
I also got the same error. I resolved it by updating the smart_open to version 2.0.0.
conda install smart_open==2.0.0
or
pip install smart_open==2.0.0.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With