Skip to content
This repository has been archived by the owner on Feb 28, 2024. It is now read-only.

AttributeError when using skopt.gp_minimize (numpy 1.24.0) #1138

Open
ChromaticIsobar opened this issue Dec 20, 2022 · 9 comments
Open

AttributeError when using skopt.gp_minimize (numpy 1.24.0) #1138

ChromaticIsobar opened this issue Dec 20, 2022 · 9 comments

Comments

@ChromaticIsobar
Copy link

ChromaticIsobar commented Dec 20, 2022

I frequently use skopt.gp_minimize. But, since numpy version 1.24.0, it raises an exception

AttributeError: module 'numpy' has no attribute 'int'

This issue has been anticipated for some time, in the form of a deprecation warning, and it is targeted by PR #1093 and #1123.
I think it is redundant for me to contribute with my own PR, since #1123 seems to solve the problem, but fails validation because of seemingly independent issues with the circleci automation.

In the meantime I will just have to manually add a constraint on the numpy version for my own pipelines, so I have no personal urgency. But I guess it could be a problem for new users, trying to figure out why the function is not working.
I hope this issue will help them fix it.

Edit: [2023/03/14]
If you really need the latest numpy version, you can monkey patch.

import numpy as np
np.int = int

It is ugly, but it will get your job done (tested in numpy version 1.24.2).

@sshquack
Copy link

sshquack commented Dec 21, 2022

Running into this problem from dependencies as well kernc/backtesting.py#838 (comment)

It's unfortunate that scikit-optimize is pretty much dead with no commits for over an year. Not sure if this will ever get fixed and released.

I truly hope #1123 gets merged 🤞

@sshquack
Copy link

It looks like @kernc is looking to move the CI to Github actions here #1117 which would help getting some of these PRs in. Thank you @kernc 🤩

@jmarul1
Copy link

jmarul1 commented Jan 18, 2023

Running into the same problem with numpy not having "int" in its module, as it is expected from 1.24.0 while running LHS

@jmarul1
Copy link

jmarul1 commented Jan 18, 2023

To be more specific, I found the location where the problem lies:
File:
image

image

@JohnKilbride
Copy link

For anyone stuck on this, I managed to get around the issue by downgrading NumPy to version 1.22.0.

Hopefully the fix will be merged soon!

@ChromaticIsobar
Copy link
Author

For anyone stuck on this, I managed to get around the issue by downgrading NumPy to version 1.22.0.

Hopefully the fix will be merged soon!

Any version previous to 1.24.0 should be fine

@kangshung
Copy link

kangshung commented Mar 13, 2023

When will this be fixed? It prevents me from using the latest numpy version

@ChromaticIsobar
Copy link
Author

There has been no commits since late 2021. So, I doubt we'll get an expected date for the fix.
As for myself, I will start looking for alternatives.
If you really need the latest numpy version and this package, my suggestion is to go on and monkey patch.

import numpy as np
np.int = int

This works, and I will add it to my original post.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants
@sshquack @ChromaticIsobar @JohnKilbride @kangshung @jmarul1 and others