-
-
Notifications
You must be signed in to change notification settings - Fork 469
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug module 'numpy' has no attribute 'int'. Did you mean: 'inf'? #151
Comments
Hi, Can you give the steps to reproduce this bug ? |
I actually tried a sample code in a pipenv and it gave me this error. ` Define the function to be optimizeddef fitness_func(x): Set the number of variables (in this case, x) and the number of generationsnum_variables = 1 Set the lower and upper bounds for xlower_bound = [0] Set the crossover and mutation ratecrossover_rate = 0.8 Create the PyGAD objectga = pygad.GeneticAlgorithm(num_variables=num_variables, Run the optimizationbest_solution = ga.run() Print the best solutionprint(best_solution) |
I think I had the same issue. https://github.com/numpy/numpy/releases/tag/v1.24.0:
By using a previous version of numpy I was able to work around the issue.
|
Here is the PR fixing the issue: #152 |
Had a similar issue and had to revert to |
Happened to me too on python 3.10.5 with numpy 1.24.1.
` |
Same issue, using the reference code provided on the main page:
AttributeError: module 'numpy' has no attribute 'int'. Did you mean: 'inf'? |
The issue is solved in this PR: #152 A new release will be pushed soon. |
Traceback (most recent call last):
File "C:\Users\HP\Desktop\Programs\Python\Testing\test.py", line 1, in
import pygad
File "C:\Users\HP.virtualenvs\Testing-x9UQs_eI\lib\site-packages\pygad_init_.py", line 1, in
from .pygad import * # Relative import.
File "C:\Users\HP.virtualenvs\Testing-x9UQs_eI\lib\site-packages\pygad\pygad.py", line 9, in
class GA:
File "C:\Users\HP.virtualenvs\Testing-x9UQs_eI\lib\site-packages\pygad\pygad.py", line 11, in GA
supported_int_types = [int, numpy.int, numpy.int8, numpy.int16, numpy.int32, numpy.int64, numpy.uint, numpy.uint8, numpy.uint16, numpy.uint32, numpy.uint64]
File "C:\Users\HP.virtualenvs\Testing-x9UQs_eI\lib\site-packages\numpy_init_.py", line 284, in getattr
raise AttributeError("module {!r} has no attribute "
AttributeError: module 'numpy' has no attribute 'int'. Did you mean: 'inf'?
The text was updated successfully, but these errors were encountered: