I'm trying to install and import talos ( https://github.com/autonomio/talos ) to my jupyter notebook. I used "pip install talos" on anaconda3 to install it. Everything went fine, but now when I try to import talos I get the following error:
import talos
ImportError: cannot import name 'float_factorial' from 'scipy._lib._util'(C:\Users\myname\Anaconda3\lib\site-packages\scipy\_lib\_util.py)
The strange thing is that when I visit this specific folder, there is a float_factorial function so its unclear to me why this is not working. What could be causing this problem and how should I solve it?
Thanks in advance!
PS I'm using anaconda3, scipy 1.6.1 and talos 1.0.
I found a solution which works for me. Go to C:\Users\myname\Anaconda3\lib\site-packages\scipy_lib_util.py and edit the float_factorial function. Just rewrite it from this:
def float_factorial(n: int) -> float:
"""Compute the factorial and return as a float
Returns infinity when result is too large for a double
"""
return float(math.factorial(n)) if n < 171 else np.inf
To more simple where I removed the function annotation:
def float_factorial(num):
"""Compute the factorial and return as a float
Returns infinity when result is too large for a double
"""
val = float(math.factorial(num)) if num < 171 else np.inf
return val
I suppose it is something with Python versions and changes in 3.8
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.