mol2vec icon indicating copy to clipboard operation
mol2vec copied to clipboard

Type Error when running with Python 3.8

Open hamilton-function opened this issue 3 years ago • 1 comments

When running with Python 3.8, I get the following error message:

Featurizing molecules. Traceback (most recent call last): File "/Users/dkazempour/opt/anaconda3/bin/mol2vec", line 8, in sys.exit(run()) File "/Users/dkazempour/opt/anaconda3/lib/python3.8/site-packages/mol2vec/app/mol2vec.py", line 165, in run args.func(args) File "/Users/dkazempour/opt/anaconda3/lib/python3.8/site-packages/mol2vec/app/mol2vec.py", line 25, in do_featurize features.featurize(args.in_file, args.out_file, args.model, args.radius, args.uncommon) File "/Users/dkazempour/opt/anaconda3/lib/python3.8/site-packages/mol2vec/features.py", line 465, in featurize word2vec_model[uncommon] TypeError: 'Word2Vec' object is not subscriptable

Which library is causing this issue?

Update: I recognized that my observation is related to the other issue titled "update sentences2vec function for gensim 4.0" by Maledive.

The causing library is gensim. Something has changed at the 4.x.x versions, which yields the above stated error.

A temporary 'fix' (actually a quite quick-n-dirty hack) is as follows: pip install -Iv gensim==3.8.2 Afterwards I could successfully run mol2vec again.

hamilton-function avatar Apr 26 '21 16:04 hamilton-function

It seems as of Gensim 4.0 & higher, the Word2Vec model doesn't support subscripted-indexed access https://stackoverflow.com/questions/67687962/typeerror-word2vec-object-is-not-subscriptable

m-liddell avatar Dec 02 '22 20:12 m-liddell