-
Notifications
You must be signed in to change notification settings - Fork 16
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
np.bool deprecated in newer versions of NumPy #43
Comments
I was able to correct this in my environment by just modifying line 44 in
jackknife.py to use np.bool_ instead of np.bool. This sed command should do
the job:
sed -i -e 's/np.bool/np.bool_/'
/usr/local/lib/python3.8/dist-packages/popcorn/jackknife.py
It looks like maybe the change didn't stick for you (see line 5 in the
traceback - you still have np.bool and not np.bool_)? Perhaps you
accidentally reinstalled the library from Github again over your modified
version?
Best,
Sean
*Sean Caron (she/they)*
*OS Programmer Lead*
*University of Michigan Center for Statistical Genetics*
*Department of Biostatistics, School of Public Health*
*e: ***@***.*** ***@***.***> p: 734-474-5962*
…On Mon, Apr 22, 2024 at 9:46 AM francontiram ***@***.***> wrote:
Hi @seantcaron <https://github.com/seantcaron> I am getting a very
similar error message - see below. I have tried manually editing
jackknife.py in my local environment, line 44 to np.bool_ as you have
suggested but still getting the same error message - have you managed to
fix this error? It is a while since I have used Python so grateful for any
advice!
Performing jackknife estimation of the standard error using 200 blocks of
size 17608 .
/home/francesinez/.local/lib/python3.10/site-packages/popcorn/jackknife.py:44:
FutureWarning: In the future np.bool will be defined as the corresponding
NumPy scalar.
k = np.ones((x.shape[0]),dtype=np.bool)
Traceback (most recent call last):
File "/home/francesinez/Popcorn/popcorn/*main*.py", line 246, in main()
File "/home/francesinez/Popcorn/popcorn/*main*.py", line 218, in main res
= fit.fit_pg(data.data,args,M=M)
File
"/home/francesinez/.local/lib/python3.10/site-packages/popcorn/fit.py",
line 241, in *init* self.jackknife =
jackknife.jackknife(close_call,data,res,args)
File
"/home/francesinez/.local/lib/python3.10/site-packages/popcorn/jackknife.py",
line 19, in *init* self.psuedovalues, self.delete_values =
self.jackknife(f,x,r)
File
"/home/francesinez/.local/lib/python3.10/site-packages/popcorn/jackknife.py",
line 44, in jackknife k = np.ones((x.shape[0]),dtype=np.bool)
File "/home/francesinez/.local/lib/python3.10/site-packages/numpy/*init*.py",
line 324, in *getattr* raise AttributeError(*former_attrs*[attr])
AttributeError: module 'numpy' has no attribute 'bool'.
np.bool was a deprecated alias for the builtin bool. To avoid this error
in existing code, use bool by itself. Doing this will not modify any
behavior and is safe. If you specifically wanted the numpy scalar type, use
np.bool_ here. The aliases was originally deprecated in NumPy 1.20; for
more details and guidance see the original release note at:
https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations. Did you
mean: 'bool_'?
—
Reply to this email directly, view it on GitHub
<#43 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AEEAXHLODLN4J26U5TWIMJTY6UIBTAVCNFSM6AAAAABFUCCXUKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANRZGQ4TOOJUGU>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Thank you Sean – yes I realised popcorn was loading from local libs and when I changed the jackknife file there then the single change to np.bool_ worked for me too!
I deleted my comment as your fix did the job.
Thanks again,
Fran
From: Sean Caron ***@***.***>
Sent: Monday, April 22, 2024 4:27 PM
To: brielin/Popcorn ***@***.***>
Cc: Fran Conti-Ramsden ***@***.***>; Comment ***@***.***>
Subject: Re: [brielin/Popcorn] np.bool deprecated in newer versions of NumPy (Issue #43)
You don't often get email from ***@***.******@***.***>. Learn why this is important<https://aka.ms/LearnAboutSenderIdentification>
I was able to correct this in my environment by just modifying line 44 in
jackknife.py to use np.bool_ instead of np.bool. This sed command should do
the job:
sed -i -e 's/np.bool/np.bool_/'
/usr/local/lib/python3.8/dist-packages/popcorn/jackknife.py
It looks like maybe the change didn't stick for you (see line 5 in the
traceback - you still have np.bool and not np.bool_)? Perhaps you
accidentally reinstalled the library from Github again over your modified
version?
Best,
Sean
*Sean Caron (she/they)*
*OS Programmer Lead*
*University of Michigan Center for Statistical Genetics*
*Department of Biostatistics, School of Public Health*
*e: ***@***.***<mailto:***@***.***> ***@***.***<mailto:***@***.***>> p: 734-474-5962*
On Mon, Apr 22, 2024 at 9:46 AM francontiram ***@***.***<mailto:***@***.***>> wrote:
Hi @seantcaron <https://github.com/seantcaron> I am getting a very
similar error message - see below. I have tried manually editing
jackknife.py in my local environment, line 44 to np.bool_ as you have
suggested but still getting the same error message - have you managed to
fix this error? It is a while since I have used Python so grateful for any
advice!
Performing jackknife estimation of the standard error using 200 blocks of
size 17608 .
/home/francesinez/.local/lib/python3.10/site-packages/popcorn/jackknife.py:44:
FutureWarning: In the future np.bool will be defined as the corresponding
NumPy scalar.
k = np.ones((x.shape[0]),dtype=np.bool)
Traceback (most recent call last):
File "/home/francesinez/Popcorn/popcorn/*main*.py", line 246, in main()
File "/home/francesinez/Popcorn/popcorn/*main*.py", line 218, in main res
= fit.fit_pg(data.data,args,M=M)
File
"/home/francesinez/.local/lib/python3.10/site-packages/popcorn/fit.py",
line 241, in *init* self.jackknife =
jackknife.jackknife(close_call,data,res,args)
File
"/home/francesinez/.local/lib/python3.10/site-packages/popcorn/jackknife.py",
line 19, in *init* self.psuedovalues, self.delete_values =
self.jackknife(f,x,r)
File
"/home/francesinez/.local/lib/python3.10/site-packages/popcorn/jackknife.py",
line 44, in jackknife k = np.ones((x.shape[0]),dtype=np.bool)
File "/home/francesinez/.local/lib/python3.10/site-packages/numpy/*init*.py",
line 324, in *getattr* raise AttributeError(*former_attrs*[attr])
AttributeError: module 'numpy' has no attribute 'bool'.
np.bool was a deprecated alias for the builtin bool. To avoid this error
in existing code, use bool by itself. Doing this will not modify any
behavior and is safe. If you specifically wanted the numpy scalar type, use
np.bool_ here. The aliases was originally deprecated in NumPy 1.20; for
more details and guidance see the original release note at:
https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations. Did you
mean: 'bool_'?
—
Reply to this email directly, view it on GitHub
<#43 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AEEAXHLODLN4J26U5TWIMJTY6UIBTAVCNFSM6AAAAABFUCCXUKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANRZGQ4TOOJUGU>
.
You are receiving this because you were mentioned.Message ID:
***@***.***<mailto:***@***.***>>
—
Reply to this email directly, view it on GitHub<#43 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/BIACF2UTWQPR3XF3NF52Q7TY6UT5RAVCNFSM6AAAAABFUCCXUKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANRZHA4DMMJTGQ>.
You are receiving this because you commented.Message ID: ***@***.******@***.***>>
|
Wonderful! I'm so happy that my issue report was able to help others!
Best,
Sean
*Sean Caron (she/they)*
*OS Programmer Lead*
*University of Michigan Center for Statistical Genetics*
*Department of Biostatistics, School of Public Health*
*e: ***@***.*** ***@***.***> p: 734-474-5962*
On Mon, Apr 22, 2024 at 11:34 AM francontiram ***@***.***>
wrote:
… Thank you Sean – yes I realised popcorn was loading from local libs and
when I changed the jackknife file there then the single change to np.bool_
worked for me too!
I deleted my comment as your fix did the job.
Thanks again,
Fran
From: Sean Caron ***@***.***>
Sent: Monday, April 22, 2024 4:27 PM
To: brielin/Popcorn ***@***.***>
Cc: Fran Conti-Ramsden ***@***.***>; Comment ***@***.***>
Subject: Re: [brielin/Popcorn] np.bool deprecated in newer versions of
NumPy (Issue #43)
You don't often get email from ***@***.******@***.***>. Learn why this is
important<https://aka.ms/LearnAboutSenderIdentification>
I was able to correct this in my environment by just modifying line 44 in
jackknife.py to use np.bool_ instead of np.bool. This sed command should
do
the job:
sed -i -e 's/np.bool/np.bool_/'
/usr/local/lib/python3.8/dist-packages/popcorn/jackknife.py
It looks like maybe the change didn't stick for you (see line 5 in the
traceback - you still have np.bool and not np.bool_)? Perhaps you
accidentally reinstalled the library from Github again over your modified
version?
Best,
Sean
*Sean Caron (she/they)*
*OS Programmer Lead*
*University of Michigan Center for Statistical Genetics*
*Department of Biostatistics, School of Public Health*
*e: ***@***.***<mailto:***@***.***> ***@***.***<mailto:***@***.***>> p:
734-474-5962*
On Mon, Apr 22, 2024 at 9:46 AM francontiram ***@***.***<mailto:***@***.***>>
wrote:
> Hi @seantcaron <https://github.com/seantcaron> I am getting a very
> similar error message - see below. I have tried manually editing
> jackknife.py in my local environment, line 44 to np.bool_ as you have
> suggested but still getting the same error message - have you managed to
> fix this error? It is a while since I have used Python so grateful for
any
> advice!
>
> Performing jackknife estimation of the standard error using 200 blocks
of
> size 17608 .
>
/home/francesinez/.local/lib/python3.10/site-packages/popcorn/jackknife.py:44:
> FutureWarning: In the future np.bool will be defined as the
corresponding
> NumPy scalar.
> k = np.ones((x.shape[0]),dtype=np.bool)
> Traceback (most recent call last):
> File "/home/francesinez/Popcorn/popcorn/*main*.py", line 246, in main()
> File "/home/francesinez/Popcorn/popcorn/*main*.py", line 218, in main
res
> = fit.fit_pg(data.data,args,M=M)
> File
> "/home/francesinez/.local/lib/python3.10/site-packages/popcorn/fit.py",
> line 241, in *init* self.jackknife =
> jackknife.jackknife(close_call,data,res,args)
> File
>
"/home/francesinez/.local/lib/python3.10/site-packages/popcorn/jackknife.py",
> line 19, in *init* self.psuedovalues, self.delete_values =
> self.jackknife(f,x,r)
> File
>
"/home/francesinez/.local/lib/python3.10/site-packages/popcorn/jackknife.py",
> line 44, in jackknife k = np.ones((x.shape[0]),dtype=np.bool)
> File
"/home/francesinez/.local/lib/python3.10/site-packages/numpy/*init*.py",
> line 324, in *getattr* raise AttributeError(*former_attrs*[attr])
> AttributeError: module 'numpy' has no attribute 'bool'.
> np.bool was a deprecated alias for the builtin bool. To avoid this error
> in existing code, use bool by itself. Doing this will not modify any
> behavior and is safe. If you specifically wanted the numpy scalar type,
use
> np.bool_ here. The aliases was originally deprecated in NumPy 1.20; for
> more details and guidance see the original release note at:
> https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations. Did
you
> mean: 'bool_'?
>
> —
> Reply to this email directly, view it on GitHub
> <#43 (comment)>,
> or unsubscribe
> <
https://github.com/notifications/unsubscribe-auth/AEEAXHLODLN4J26U5TWIMJTY6UIBTAVCNFSM6AAAAABFUCCXUKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANRZGQ4TOOJUGU>
> .
> You are receiving this because you were mentioned.Message ID:
> ***@***.***<mailto:***@***.***>>
>
—
Reply to this email directly, view it on GitHub<
#43 (comment)>, or
unsubscribe<
https://github.com/notifications/unsubscribe-auth/BIACF2UTWQPR3XF3NF52Q7TY6UT5RAVCNFSM6AAAAABFUCCXUKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANRZHA4DMMJTGQ>.
You are receiving this because you commented.Message ID:
***@***.******@***.***>>
—
Reply to this email directly, view it on GitHub
<#43 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AEEAXHL6UKAXNHDVCXG6WRLY6UUXLAVCNFSM6AAAAABFUCCXUKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANRZHEYTMOJQG4>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The following error is produced when running popcorn with NumPy >= 1.20.
Performing jackknife estimation of the standard error using 200 blocks of size 17925 .
/usr/local/lib/python3.8/dist-packages/popcorn/jackknife.py:44: FutureWarning: In the future
np.bool
will be defined as the corresponding NumPy scalar.k = np.ones((x.shape[0]),dtype=np.bool)
Traceback (most recent call last):
File "/usr/local/bin/popcorn", line 8, in
sys.exit(main())
File "/usr/local/lib/python3.8/dist-packages/popcorn/main.py", line 218, in main
res = fit.fit_pg(data.data,args,M=M)
File "/usr/local/lib/python3.8/dist-packages/popcorn/fit.py", line 241, in init
self.jackknife = jackknife.jackknife(close_call,data,res,args)
File "/usr/local/lib/python3.8/dist-packages/popcorn/jackknife.py", line 19, in init
self.psuedovalues, self.delete_values = self.jackknife(f,x,r)
File "/usr/local/lib/python3.8/dist-packages/popcorn/jackknife.py", line 44, in jackknife
k = np.ones((x.shape[0]),dtype=np.bool)
File "/usr/local/lib/python3.8/dist-packages/numpy/init.py", line 305, in getattr
raise AttributeError(former_attrs[attr])
AttributeError: module 'numpy' has no attribute 'bool'.
np.bool
was a deprecated alias for the builtinbool
. To avoid this error in existing code, usebool
by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, usenp.bool_
here.The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
Could you please update line 44 in jackknife.py to replace np.bool with np.bool_ such that this will run properly with newer NumPy without modification?
Thank you!
The text was updated successfully, but these errors were encountered: