Problems and solutions that may be encountered in HyTE model reproduction

Table of contents

一、ImportError: No module named ' tensorflow '

二、AttributeError: 'version_info' object has no attribute '__version__'。

三、ModuleNotFoundError: No module named 'numpy.testing.decorators'

appendix


Description: Github address of HyTE model: 

GitHub - malllabiisc/HyTE: EMNLP 2018: HyTE: Hyperplane-based Temporally aware Knowledge Graph Embedding EMNLP 2018: HyTE: Hyperplane-based Temporally aware Knowledge Graph Embedding - GitHub - malllabiisc/HyTE: EMNLP 2018: H yTE: Hyperplane-based Temporally aware Knowledge Graph Embedding https://github.com/malllabiisc/HyTE It is best to use conda to create a virtual environment to reproduce the HyTE model. In addition, when reproducing, you first need to follow the instructions in the readme at the above address to operate. When you encounter a problem, check this article again to see if you can solve the problem you encountered.


一、ImportError: No module named ' tensorflow '

Cause: python version and tensorflow version are not compatible

Solution: Do not repeatedly install the tensorflowpython version, and lower the pythob version to below 3.6

conda install python=3.6

二、AttributeError: 'version_info' object has no attribute '__version__'。

As shown below:

Solution:

Find the file:

C:\Users\你的用户名\AppData\Roaming\Python\Python36\site-packages\pyparsing\__init__.py

Change the code snippet below:

class version_info(NamedTuple):
    major: int
    minor: int    
    micro: int
    releaselevel: str
    serial: int

for:

class version_info():
    def __init__(self,major:int,minor:int,micro:int,releaselevel:str,serial:int):   
        self.major = major
        self.minor = minor
        self.micro = micro
        self.releaselevel = releaselevel
        self.serial = serial

三、ModuleNotFoundError: No module named 'numpy.testing.decorators'

As shown below:

Solution steps:

(a) Uninstall the original numpy

Execute the command multiple times:

pip uninstall numpy

Until all versions are uninstalled (that is, the command WARNING: Skipping numpy as it is not installed. appears): 

(b) Install numpy

pip3 install numpy==1.16.4

Note that you must install a version below numpy==1.17.0, otherwise the following warning will be reported:

FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.

As shown below: 


 Of course, there is another solution to this problem in the third section, you can refer to the following blog:

[Solution without downgrading] ModuleNotFoundError: No module named 'numpy.testing.decorators'_link_in_csdn's blog-CSDN blog When using Python's numpy package, if it involves the introduction of numpy.testing.decorators, an error ModuleNotFoundError may be reported: No module named 'numpy.testing.decorators'. Most of the tutorials that can be found so far suggest that you downgrade, which is unwise. This article introduces the underlying cause of the problem, and discusses the corresponding solutions by category https://blog.csdn.net/link_in_csdn /article/details/124815024


四、UnicodeDecodeError: 'gbk' codec can't decode byte 0xaf in position 423: illegal multibyte sequence

Solution: Add encoding="utf-8" to the file operation in time_proj.py


appendix

Problems that may also be encountered when installing numpy:

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
mkl-random 1.0.1 requires cython, which is not installed.

Execute the following command:

pip install --upgrade setuptools
pip install mkl-random

As shown below:

Guess you like

Origin blog.csdn.net/qq_40506723/article/details/127296754