graphvite
graphvite copied to clipboard
Raise KeyError: 'PREFIX' when import
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'
Simply removing the os.path.realpath(os.path.join(os.environ["PREFIX"], "lib")),
line solved the problem for me
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.
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'
Bevor I imported graphvite I used
os.environ["CONDA_PREFIX"] = sys.base_prefix
os.environ["PREFIX"]= sys.base_prefix
Did you know the solution for this problem?
Did you know the solution for this problem?
Define os.environ["PREFIX"] by yourself should fix this.