Import Error: can't import algorithms from neupy

607 Views Asked by At

I'm trying to import a library in anaconda

from neupy import algorithms

ImportError: cannot import name 'gcd' from 'fractions'

2

There are 2 best solutions below

0
On

That seems to be a more general issue. See this previous question on the matter: Import Error: can't import name gcd from fractions

1
On

From Python 3.9, GCD is moved to Math.

https://docs.python.org/3/library/math.html#math.gcd

Try using math.gcd(a, b).