Numpy: RuntimeWarning: overflow encountered
up vote
0
down vote
favorite
A friend of mine sent me some code including the numpy, functools and matplotlib packages which work fine on his windows system and does not raise any warning/exceptions. The same code does not work on my system, I get many "-inf" or "nan" values my friend does not get.
When I run the same code on my MacBook (OS X 10.14), python 3.6 and the same installed packages I get the following errors:
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/numpy/linalg/linalg.py:2022: RuntimeWarning: overflow encountered in det
r = _umath_linalg.det(a, signature=signature)
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/ipykernel_launcher.py:90: RuntimeWarning: invalid value encountered in multiply
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/ipykernel_launcher.py:94: RuntimeWarning: invalid value encountered in multiply
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/numpy/linalg/linalg.py:2022: RuntimeWarning: invalid value encountered in det
r = _umath_linalg.det(a, signature=signature)
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/ipykernel_launcher.py:99: RuntimeWarning: invalid value encountered in multiply
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/ipykernel_launcher.py:76: RuntimeWarning: divide by zero encountered in log`
I also noticed that when I try to "pip install functools" I get some error messages which are not clear to me. Could it be the case that the new Mojave update destroyed something on my system?
/usr/bin/clang -fno-strict-aliasing -Wsign-compare -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch i386 -arch x86_64 -g -I/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c src/functools.c -o build/temp.macosx-10.6-intel-3.6/src/functools.o
src/functools.c:43:6: warning: implicit declaration of function 'Py_InitModule3' is invalid in C99 [-Wimplicit-function-declaration]
m = Py_InitModule3("_functools", NULL, functools_doc);
^
src/functools.c:43:6: warning: this function declaration is not a prototype [-Wstrict-prototypes]
src/functools.c:43:4: warning: incompatible integer to pointer conversion assigning to 'PyObject *' (aka 'struct _object *') from 'int' [-Wint-conversion]
m = Py_InitModule3("_functools", NULL, functools_doc);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/functools.c:45:3: error: non-void function 'init_functools' should return a value [-Wreturn-type]
return;
^
src/functools.c:49:2: error: non-void function 'init_functools' should return a value [-Wreturn-type]
return;
^
3 warnings and 2 errors generated.
error: command '/usr/bin/clang' failed with exit status 1
Command "/Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -u -c "import setuptools, tokenize;__file__='/private/var/folders/hg/qhfjf8mn647dsz9p4c85j0z40000gn/T/pip-install-nek3bgo1/functools/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('rn', 'n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/hg/qhfjf8mn647dsz9p4c85j0z40000gn/T/pip-record-6vakus33/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/hg/qhfjf8mn647dsz9p4c85j0z40000gn/T/pip-install-nek3bgo1/functools/`
EDIT: Just to make it more clear, it is not only that I get error messages my friend does not get, the code doesn't work at all on my system.
python numpy
add a comment |
up vote
0
down vote
favorite
A friend of mine sent me some code including the numpy, functools and matplotlib packages which work fine on his windows system and does not raise any warning/exceptions. The same code does not work on my system, I get many "-inf" or "nan" values my friend does not get.
When I run the same code on my MacBook (OS X 10.14), python 3.6 and the same installed packages I get the following errors:
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/numpy/linalg/linalg.py:2022: RuntimeWarning: overflow encountered in det
r = _umath_linalg.det(a, signature=signature)
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/ipykernel_launcher.py:90: RuntimeWarning: invalid value encountered in multiply
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/ipykernel_launcher.py:94: RuntimeWarning: invalid value encountered in multiply
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/numpy/linalg/linalg.py:2022: RuntimeWarning: invalid value encountered in det
r = _umath_linalg.det(a, signature=signature)
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/ipykernel_launcher.py:99: RuntimeWarning: invalid value encountered in multiply
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/ipykernel_launcher.py:76: RuntimeWarning: divide by zero encountered in log`
I also noticed that when I try to "pip install functools" I get some error messages which are not clear to me. Could it be the case that the new Mojave update destroyed something on my system?
/usr/bin/clang -fno-strict-aliasing -Wsign-compare -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch i386 -arch x86_64 -g -I/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c src/functools.c -o build/temp.macosx-10.6-intel-3.6/src/functools.o
src/functools.c:43:6: warning: implicit declaration of function 'Py_InitModule3' is invalid in C99 [-Wimplicit-function-declaration]
m = Py_InitModule3("_functools", NULL, functools_doc);
^
src/functools.c:43:6: warning: this function declaration is not a prototype [-Wstrict-prototypes]
src/functools.c:43:4: warning: incompatible integer to pointer conversion assigning to 'PyObject *' (aka 'struct _object *') from 'int' [-Wint-conversion]
m = Py_InitModule3("_functools", NULL, functools_doc);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/functools.c:45:3: error: non-void function 'init_functools' should return a value [-Wreturn-type]
return;
^
src/functools.c:49:2: error: non-void function 'init_functools' should return a value [-Wreturn-type]
return;
^
3 warnings and 2 errors generated.
error: command '/usr/bin/clang' failed with exit status 1
Command "/Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -u -c "import setuptools, tokenize;__file__='/private/var/folders/hg/qhfjf8mn647dsz9p4c85j0z40000gn/T/pip-install-nek3bgo1/functools/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('rn', 'n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/hg/qhfjf8mn647dsz9p4c85j0z40000gn/T/pip-record-6vakus33/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/hg/qhfjf8mn647dsz9p4c85j0z40000gn/T/pip-install-nek3bgo1/functools/`
EDIT: Just to make it more clear, it is not only that I get error messages my friend does not get, the code doesn't work at all on my system.
python numpy
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
A friend of mine sent me some code including the numpy, functools and matplotlib packages which work fine on his windows system and does not raise any warning/exceptions. The same code does not work on my system, I get many "-inf" or "nan" values my friend does not get.
When I run the same code on my MacBook (OS X 10.14), python 3.6 and the same installed packages I get the following errors:
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/numpy/linalg/linalg.py:2022: RuntimeWarning: overflow encountered in det
r = _umath_linalg.det(a, signature=signature)
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/ipykernel_launcher.py:90: RuntimeWarning: invalid value encountered in multiply
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/ipykernel_launcher.py:94: RuntimeWarning: invalid value encountered in multiply
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/numpy/linalg/linalg.py:2022: RuntimeWarning: invalid value encountered in det
r = _umath_linalg.det(a, signature=signature)
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/ipykernel_launcher.py:99: RuntimeWarning: invalid value encountered in multiply
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/ipykernel_launcher.py:76: RuntimeWarning: divide by zero encountered in log`
I also noticed that when I try to "pip install functools" I get some error messages which are not clear to me. Could it be the case that the new Mojave update destroyed something on my system?
/usr/bin/clang -fno-strict-aliasing -Wsign-compare -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch i386 -arch x86_64 -g -I/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c src/functools.c -o build/temp.macosx-10.6-intel-3.6/src/functools.o
src/functools.c:43:6: warning: implicit declaration of function 'Py_InitModule3' is invalid in C99 [-Wimplicit-function-declaration]
m = Py_InitModule3("_functools", NULL, functools_doc);
^
src/functools.c:43:6: warning: this function declaration is not a prototype [-Wstrict-prototypes]
src/functools.c:43:4: warning: incompatible integer to pointer conversion assigning to 'PyObject *' (aka 'struct _object *') from 'int' [-Wint-conversion]
m = Py_InitModule3("_functools", NULL, functools_doc);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/functools.c:45:3: error: non-void function 'init_functools' should return a value [-Wreturn-type]
return;
^
src/functools.c:49:2: error: non-void function 'init_functools' should return a value [-Wreturn-type]
return;
^
3 warnings and 2 errors generated.
error: command '/usr/bin/clang' failed with exit status 1
Command "/Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -u -c "import setuptools, tokenize;__file__='/private/var/folders/hg/qhfjf8mn647dsz9p4c85j0z40000gn/T/pip-install-nek3bgo1/functools/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('rn', 'n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/hg/qhfjf8mn647dsz9p4c85j0z40000gn/T/pip-record-6vakus33/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/hg/qhfjf8mn647dsz9p4c85j0z40000gn/T/pip-install-nek3bgo1/functools/`
EDIT: Just to make it more clear, it is not only that I get error messages my friend does not get, the code doesn't work at all on my system.
python numpy
A friend of mine sent me some code including the numpy, functools and matplotlib packages which work fine on his windows system and does not raise any warning/exceptions. The same code does not work on my system, I get many "-inf" or "nan" values my friend does not get.
When I run the same code on my MacBook (OS X 10.14), python 3.6 and the same installed packages I get the following errors:
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/numpy/linalg/linalg.py:2022: RuntimeWarning: overflow encountered in det
r = _umath_linalg.det(a, signature=signature)
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/ipykernel_launcher.py:90: RuntimeWarning: invalid value encountered in multiply
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/ipykernel_launcher.py:94: RuntimeWarning: invalid value encountered in multiply
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/numpy/linalg/linalg.py:2022: RuntimeWarning: invalid value encountered in det
r = _umath_linalg.det(a, signature=signature)
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/ipykernel_launcher.py:99: RuntimeWarning: invalid value encountered in multiply
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/ipykernel_launcher.py:76: RuntimeWarning: divide by zero encountered in log`
I also noticed that when I try to "pip install functools" I get some error messages which are not clear to me. Could it be the case that the new Mojave update destroyed something on my system?
/usr/bin/clang -fno-strict-aliasing -Wsign-compare -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch i386 -arch x86_64 -g -I/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c src/functools.c -o build/temp.macosx-10.6-intel-3.6/src/functools.o
src/functools.c:43:6: warning: implicit declaration of function 'Py_InitModule3' is invalid in C99 [-Wimplicit-function-declaration]
m = Py_InitModule3("_functools", NULL, functools_doc);
^
src/functools.c:43:6: warning: this function declaration is not a prototype [-Wstrict-prototypes]
src/functools.c:43:4: warning: incompatible integer to pointer conversion assigning to 'PyObject *' (aka 'struct _object *') from 'int' [-Wint-conversion]
m = Py_InitModule3("_functools", NULL, functools_doc);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/functools.c:45:3: error: non-void function 'init_functools' should return a value [-Wreturn-type]
return;
^
src/functools.c:49:2: error: non-void function 'init_functools' should return a value [-Wreturn-type]
return;
^
3 warnings and 2 errors generated.
error: command '/usr/bin/clang' failed with exit status 1
Command "/Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -u -c "import setuptools, tokenize;__file__='/private/var/folders/hg/qhfjf8mn647dsz9p4c85j0z40000gn/T/pip-install-nek3bgo1/functools/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('rn', 'n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/hg/qhfjf8mn647dsz9p4c85j0z40000gn/T/pip-record-6vakus33/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/hg/qhfjf8mn647dsz9p4c85j0z40000gn/T/pip-install-nek3bgo1/functools/`
EDIT: Just to make it more clear, it is not only that I get error messages my friend does not get, the code doesn't work at all on my system.
python numpy
python numpy
edited Nov 11 at 12:46
asked Nov 11 at 1:35
canadair
11
11
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
Two things: first, functools
is part of the Python standard library. It comes as a part of every Python distribution, so you won't need to install it with pip
. I believe the error you're getting is down to the fact that there is still a functools
package up on PyPI (the repository where pip
fetches packages from). However, it was last updated in 2005. It is not the functools
that you want. Don't run pip install functools
. You can just do import functools
in any of your Python code, and the import should just work.
Second, the fact that you're getting warnings when your friend isn't could be due to a lot of different things. You'll have to debug the code yourself in order to figure out what's going wrong. The easiest way to do this is to change the warnings into errors. Add the following line near the top of the Python script that you're executing (after the import statements):
np.seterr(all='raise')
While that line is in place, whenever numpy would raise a warning it will raise an error instead. The error will include a stacktrace that leads back to the buggy line in your own code. This will help you get started figuring out what's wrong.
Hi tel, thank you for your answer. Regarding the second part, just to make it clear, the exact same code works fine at my friend's system while it doesn't work on mine (I get many "nan" or "-inf" values my friend does not get). Therefore, I believe the error is not code-dependent.
– canadair
Nov 11 at 12:48
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
Two things: first, functools
is part of the Python standard library. It comes as a part of every Python distribution, so you won't need to install it with pip
. I believe the error you're getting is down to the fact that there is still a functools
package up on PyPI (the repository where pip
fetches packages from). However, it was last updated in 2005. It is not the functools
that you want. Don't run pip install functools
. You can just do import functools
in any of your Python code, and the import should just work.
Second, the fact that you're getting warnings when your friend isn't could be due to a lot of different things. You'll have to debug the code yourself in order to figure out what's going wrong. The easiest way to do this is to change the warnings into errors. Add the following line near the top of the Python script that you're executing (after the import statements):
np.seterr(all='raise')
While that line is in place, whenever numpy would raise a warning it will raise an error instead. The error will include a stacktrace that leads back to the buggy line in your own code. This will help you get started figuring out what's wrong.
Hi tel, thank you for your answer. Regarding the second part, just to make it clear, the exact same code works fine at my friend's system while it doesn't work on mine (I get many "nan" or "-inf" values my friend does not get). Therefore, I believe the error is not code-dependent.
– canadair
Nov 11 at 12:48
add a comment |
up vote
0
down vote
Two things: first, functools
is part of the Python standard library. It comes as a part of every Python distribution, so you won't need to install it with pip
. I believe the error you're getting is down to the fact that there is still a functools
package up on PyPI (the repository where pip
fetches packages from). However, it was last updated in 2005. It is not the functools
that you want. Don't run pip install functools
. You can just do import functools
in any of your Python code, and the import should just work.
Second, the fact that you're getting warnings when your friend isn't could be due to a lot of different things. You'll have to debug the code yourself in order to figure out what's going wrong. The easiest way to do this is to change the warnings into errors. Add the following line near the top of the Python script that you're executing (after the import statements):
np.seterr(all='raise')
While that line is in place, whenever numpy would raise a warning it will raise an error instead. The error will include a stacktrace that leads back to the buggy line in your own code. This will help you get started figuring out what's wrong.
Hi tel, thank you for your answer. Regarding the second part, just to make it clear, the exact same code works fine at my friend's system while it doesn't work on mine (I get many "nan" or "-inf" values my friend does not get). Therefore, I believe the error is not code-dependent.
– canadair
Nov 11 at 12:48
add a comment |
up vote
0
down vote
up vote
0
down vote
Two things: first, functools
is part of the Python standard library. It comes as a part of every Python distribution, so you won't need to install it with pip
. I believe the error you're getting is down to the fact that there is still a functools
package up on PyPI (the repository where pip
fetches packages from). However, it was last updated in 2005. It is not the functools
that you want. Don't run pip install functools
. You can just do import functools
in any of your Python code, and the import should just work.
Second, the fact that you're getting warnings when your friend isn't could be due to a lot of different things. You'll have to debug the code yourself in order to figure out what's going wrong. The easiest way to do this is to change the warnings into errors. Add the following line near the top of the Python script that you're executing (after the import statements):
np.seterr(all='raise')
While that line is in place, whenever numpy would raise a warning it will raise an error instead. The error will include a stacktrace that leads back to the buggy line in your own code. This will help you get started figuring out what's wrong.
Two things: first, functools
is part of the Python standard library. It comes as a part of every Python distribution, so you won't need to install it with pip
. I believe the error you're getting is down to the fact that there is still a functools
package up on PyPI (the repository where pip
fetches packages from). However, it was last updated in 2005. It is not the functools
that you want. Don't run pip install functools
. You can just do import functools
in any of your Python code, and the import should just work.
Second, the fact that you're getting warnings when your friend isn't could be due to a lot of different things. You'll have to debug the code yourself in order to figure out what's going wrong. The easiest way to do this is to change the warnings into errors. Add the following line near the top of the Python script that you're executing (after the import statements):
np.seterr(all='raise')
While that line is in place, whenever numpy would raise a warning it will raise an error instead. The error will include a stacktrace that leads back to the buggy line in your own code. This will help you get started figuring out what's wrong.
edited Nov 11 at 1:52
answered Nov 11 at 1:43
tel
3,3011427
3,3011427
Hi tel, thank you for your answer. Regarding the second part, just to make it clear, the exact same code works fine at my friend's system while it doesn't work on mine (I get many "nan" or "-inf" values my friend does not get). Therefore, I believe the error is not code-dependent.
– canadair
Nov 11 at 12:48
add a comment |
Hi tel, thank you for your answer. Regarding the second part, just to make it clear, the exact same code works fine at my friend's system while it doesn't work on mine (I get many "nan" or "-inf" values my friend does not get). Therefore, I believe the error is not code-dependent.
– canadair
Nov 11 at 12:48
Hi tel, thank you for your answer. Regarding the second part, just to make it clear, the exact same code works fine at my friend's system while it doesn't work on mine (I get many "nan" or "-inf" values my friend does not get). Therefore, I believe the error is not code-dependent.
– canadair
Nov 11 at 12:48
Hi tel, thank you for your answer. Regarding the second part, just to make it clear, the exact same code works fine at my friend's system while it doesn't work on mine (I get many "nan" or "-inf" values my friend does not get). Therefore, I believe the error is not code-dependent.
– canadair
Nov 11 at 12:48
add a comment |
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53245099%2fnumpy-runtimewarning-overflow-encountered%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown