Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pycharm shows "Unresolved reference" all of a sudden

Tags:

python

pycharm

I have no idea what I could have done but Pycharm now decides to claim that it doesn't know things like TaggedDocument or Doc2Vec although it worked an hour ago.

enter image description here

This is my project structure:

enter image description here

I can't remember doing anything that could have cause this so please tell me how I could fix this.

The thing I don't get it that under "External Libraries in the Project Explorer I can actually see that gensim.models.doc2vec is actually present. So why does PyCharm still complain here?


enter image description here


Update

I noticed the following: In the package gensim.models I see that the file doc2vec.py is not labeled as a Python file! Please note on the right side that there is also no syntax highlighting! The strange thing is that all other files in that directory are actually recognized correctly!

enter image description here

These are the file permissions under /usr/local/lib/python2.7/dist-packages/gensim/models

drwxr-sr-x 3 root staff   4096 Oct 23  2015 .
drwxr-sr-x 9 root staff   4096 Oct 23  2015 ..
-rw-r--r-- 1 root staff 570651 Oct 23  2015 doc2vec_inner.c
-rw-r--r-- 1 root staff  26872 Oct 23  2015 doc2vec_inner.pyx
-rwxr-xr-x 1 root staff 473658 Oct 23  2015 doc2vec_inner.so
-rw-r--r-- 1 root staff  37304 Oct 23  2015 doc2vec.py
-rw-r--r-- 1 root staff  35822 Oct 23  2015 doc2vec.pyc
-rw-r--r-- 1 root staff  23000 Oct 23  2015 hdpmodel.py
-rw-r--r-- 1 root staff  21250 Oct 23  2015 hdpmodel.pyc
-rw-r--r-- 1 root staff   1920 Oct 23  2015 __init__.py
-rw-r--r-- 1 root staff   2697 Oct 23  2015 __init__.pyc
-rw-r--r-- 1 root staff   6724 Oct 23  2015 lda_dispatcher.py
-rw-r--r-- 1 root staff   7451 Oct 23  2015 lda_dispatcher.pyc
-rw-r--r-- 1 root staff  37778 Oct 23  2015 ldamodel.py
-rw-r--r-- 1 root staff  32106 Oct 23  2015 ldamodel.pyc
-rw-r--r-- 1 root staff  12478 Oct 23  2015 ldamulticore.py
-rw-r--r-- 1 root staff  11924 Oct 23  2015 ldamulticore.pyc
-rw-r--r-- 1 root staff   4079 Oct 23  2015 lda_worker.py
-rw-r--r-- 1 root staff   5067 Oct 23  2015 lda_worker.pyc
-rw-r--r-- 1 root staff   4239 Oct 23  2015 logentropy_model.py
-rw-r--r-- 1 root staff   4452 Oct 23  2015 logentropy_model.pyc
-rw-r--r-- 1 root staff   7100 Oct 23  2015 lsi_dispatcher.py
-rw-r--r-- 1 root staff   7518 Oct 23  2015 lsi_dispatcher.pyc
-rw-r--r-- 1 root staff  34968 Oct 23  2015 lsimodel.py
-rw-r--r-- 1 root staff  27309 Oct 23  2015 lsimodel.pyc
-rw-r--r-- 1 root staff   3793 Oct 23  2015 lsi_worker.py
-rw-r--r-- 1 root staff   4848 Oct 23  2015 lsi_worker.pyc
-rw-r--r-- 1 root staff  10461 Oct 23  2015 phrases.py
-rw-r--r-- 1 root staff   9505 Oct 23  2015 phrases.pyc
-rw-r--r-- 1 root staff   3734 Oct 23  2015 rpmodel.py
-rw-r--r-- 1 root staff   4002 Oct 23  2015 rpmodel.pyc
-rw-r--r-- 1 root staff   6372 Oct 23  2015 tfidfmodel.py
-rw-r--r-- 1 root staff   6100 Oct 23  2015 tfidfmodel.pyc
-rw-r--r-- 1 root staff    310 Oct 23  2015 voidptr.h
-rw-r--r-- 1 root staff 517311 Oct 23  2015 word2vec_inner.c
-rwxr-xr-x 1 root staff  22906 Oct 23  2015 word2vec_inner.pyx
-rwxr-xr-x 1 root staff 357937 Oct 23  2015 word2vec_inner.so
-rw-r--r-- 1 root staff  72866 Oct 23  2015 word2vec.py
-rw-r--r-- 1 root staff  62243 Oct 23  2015 word2vec.pyc
drwxr-sr-x 2 root staff   4096 Oct 23  2015 wrappers

and here is the entire content of my doc2vec.py.

like image 485
Stefan Falk Avatar asked Apr 24 '16 15:04

Stefan Falk


1 Answers

Please check that you didn't accidently removed parts of the code from doc2vec.py file because it's strange that pycharm can give a direct path for this file but can't read it. Another thing that can happen but will be totally weird is things about permissions, maybe you've changed permissions in this folder and now pycharm doesn't have the permissions to read this file?

like image 50
Rotem Vil Avatar answered Nov 02 '22 21:11

Rotem Vil