DeepGraphLearning / graphvite

GraphVite: A General and High-performance Graph Embedding System
https://graphvite.io
Apache License 2.0
1.21k stars 151 forks source link

Raise KeyError: 'PREFIX' when import #102

Closed RaistlinTAO closed 1 year ago

RaistlinTAO commented 2 years ago

The program just stop with 'raise KeyError(key) from None' error right after 'import graphvite as gv', with no other code.

Environment

Python: 3.8 Conda: Latest CentOS

Error Message

Traceback (most recent call last):
  File "DGI_matrix.py", line 19, in <module>
    import graphvite as gv
  File "/apphome/algorithm/anaconda3/envs/xnf/lib/python3.8/site-packages/graphvite/__init__.py", line 30, in <module>
    os.path.realpath(os.path.join(os.environ["PREFIX"], "lib")),
  File "/apphome/algorithm/anaconda3/envs/xnf/lib/python3.8/os.py", line 675, in __getitem__
    raise KeyError(key) from None
KeyError: 'PREFIX'
elya5 commented 2 years ago

Simply removing the os.path.realpath(os.path.join(os.environ["PREFIX"], "lib")), line solved the problem for me

RaistlinTAO commented 2 years ago

Simply removing the os.path.realpath(os.path.join(os.environ["PREFIX"], "lib")), line solved the problem for me

Best-practice-wise, I d like to stay away from touching the source code of dependencies, since we have other members working on this.

YijianLiu commented 1 year ago

Same with you, have you deal with this problem?

import graphvite Traceback (most recent call last): File "", line 1, in File "/home/lyj/anaconda3/envs/graphvite3/lib/python3.8/site-packages/graphvite/init.py", line 30, in os.path.realpath(os.path.join(os.environ["PREFIX"], "lib")), File "/home/lyj/anaconda3/envs/graphvite3/lib/python3.8/os.py", line 675, in getitem raise KeyError(key) from None KeyError: 'PREFIX'

p-dre commented 1 year ago

Bevor I imported graphvite I used

os.environ["CONDA_PREFIX"] = sys.base_prefix
os.environ["PREFIX"]= sys.base_prefix
DaliaDawod commented 1 year ago

Did you know the solution for this problem?

RaistlinTAO commented 1 year ago

Did you know the solution for this problem?

Define os.environ["PREFIX"] by yourself should fix this.