I'm getting the following Import Error when importing the sutime module - what does it mean?

社会主义新天地 提交于 2020-01-16 11:59:11

问题


I'm getting this error:

ImportError: cannot import name 'SUTime' from partially initialized module 'sutime' (most likely due to a circular import)

when importing the sutime module as:

from sutime import SUTime

as suggested in the sutime GitHub example: https://github.com/FraBle/python-sutime

Context: sutime is a Python library for parsing date/time from a natural language input, developed by the amazing team over at Stanford CoreNLP.

Note: I've already run the pre-req installs as well:

>> pip install setuptools_scm jpype1 # install pre-reqs
>> pip install sutime
>> # use package pom.xml to install all Java dependencies via Maven into ./jars
>> mvn dependency:copy-dependencies -DoutputDirectory=./jars

回答1:


It's not true that a circular import is the most likely cause of your error. A failed, incomplete, or in some way strange installation is more likely. Try this:

pip uninstall sutime
pip uninstall jpype1
pip uninstall setuptools_scm
pip3 install setuptools_scm jpype1  # note: pip3
pip3 install sutime

Then, in the python-sutime directory, enter this command:

./test.sh

It should output lots of log lines, and the last line but one should be similar to this:

======================== 5 passed, 2 warnings in 13.06s ========================

In the same directory you can enter and run the Python script from the Example section of the README. It should output many log lines before the reported output. There may be a way to avoid that, but anyway it happens only once, when the script starts.




回答2:


$pip install sutime, Before using, you should install library



来源:https://stackoverflow.com/questions/59743652/im-getting-the-following-import-error-when-importing-the-sutime-module-what-d

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!