Re: Python Error
Thanks - I am able to launch 'py' from the command prompt and it gives me the python versions installed in my machine from python.org website. However, when I am trying to execute a python program from command prompt, I am getting the error below. I had reinstalled python packages (numpy, pandas) but it didn't resolve the issue. Any help would be appreciated. Original error was: No module named 'numpy.core._multiarray_umath' --- C:\Users\mchak\Documents\Python>py ES.pyTraceback (most recent call last): File "C:\Users\mchak\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\numpy\core\__init__.py", line 22, in from . import multiarray File "C:\Users\mchak\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\numpy\core\multiarray.py", line 12, in from . import overrides File "C:\Users\mchak\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\numpy\core\overrides.py", line 7, in from numpy.core._multiarray_umath import (ModuleNotFoundError: No module named 'numpy.core._multiarray_umath' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Users\mchak\Documents\Python\ES.py", line 1, in import scipy as sp File "C:\Users\mchak\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\scipy\__init__.py", line 61, in from numpy import show_config as show_numpy_config File "C:\Users\mchak\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\numpy\__init__.py", line 140, in from . import core File "C:\Users\mchak\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\numpy\core\__init__.py", line 48, in raise ImportError(msg)ImportError: IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE! Importing the numpy C-extensions failed. This error can happen formany reasons, often due to issues with your setup or how NumPy wasinstalled. We have compiled some common reasons and troubleshooting tips at: https://numpy.org/devdocs/user/troubleshooting-importerror.html Please note and check the following: * The Python version is: Python3.9 from "C:\Users\mchak\AppData\Local\Programs\Python\Python39\python.exe" * The NumPy version is: "1.19.4" and make sure that they are the versions you expect.Please carefully study the documentation linked above for further help. Original error was: No module named 'numpy.core._multiarray_umath' On Tuesday, November 24, 2020, 07:13:04 AM GMT, Gisle Vanem wrote: Barry Scott wrote: > If you have python from python.org installed you should be able to list all > the version you have installed > with the command: > > py -0 When was that '-0' feature added? I have Python 3.6 from Python.org and here a 'py.exe -0' gives: Requested Python version (0) not installed But using 'py.exe -0' from Python 3.9 correctly gives: -3.6-32 * -2.7-32 -- --gv -- https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list
Re: Python Error
Two observations. Python.exe is not on your PATH. But that does not matter as you can use the py command instead And nymph may not be available for python 3.9 yet. Check on pypi to see if there is a build for 3.9. Maybe use 3.8 for the time being. Barry > On 24 Nov 2020, at 11:18, Mayukh Chakraborty via Python-list > wrote: > > Thanks - I am able to launch 'py' from the command prompt and it gives me > the python versions installed in my machine from python.org website. > However, when I am trying to execute a python program from command prompt, I > am getting the error below. I had reinstalled python packages (numpy, pandas) > but it didn't resolve the issue. Any help would be appreciated. > Original error was: No module named 'numpy.core._multiarray_umath' > > --- > C:\Users\mchak\Documents\Python>py ES.pyTraceback (most recent call last): > File > "C:\Users\mchak\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\numpy\core\__init__.py", > line 22, in from . import multiarray File > "C:\Users\mchak\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\numpy\core\multiarray.py", > line 12, in from . import overrides File > "C:\Users\mchak\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\numpy\core\overrides.py", > line 7, in from numpy.core._multiarray_umath import > (ModuleNotFoundError: No module named 'numpy.core._multiarray_umath' > During handling of the above exception, another exception occurred: > Traceback (most recent call last): File > "C:\Users\mchak\Documents\Python\ES.py", line 1, in import scipy > as sp File > "C:\Users\mchak\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\scipy\__init__.py", > line 61, in from numpy import show_config as show_numpy_config > File > "C:\Users\mchak\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\numpy\__init__.py", > line 140, in from . import core File > "C:\Users\mchak\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\numpy\core\__init__.py", > line 48, in raise ImportError(msg)ImportError: > IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE! > Importing the numpy C-extensions failed. This error can happen formany > reasons, often due to issues with your setup or how NumPy wasinstalled. > We have compiled some common reasons and troubleshooting tips at: > https://numpy.org/devdocs/user/troubleshooting-importerror.html > Please note and check the following: > * The Python version is: Python3.9 from > "C:\Users\mchak\AppData\Local\Programs\Python\Python39\python.exe" * The > NumPy version is: "1.19.4" > and make sure that they are the versions you expect.Please carefully study > the documentation linked above for further help. > Original error was: No module named 'numpy.core._multiarray_umath' > >>On Tuesday, November 24, 2020, 07:13:04 AM GMT, Gisle Vanem >> wrote: >> >> Barry Scott wrote: >> >> If you have python from python.org installed you should be able to list all >> the version you have installed >> with the command: >> >> py -0 > When was that '-0' feature added? > I have Python 3.6 from Python.org and here a > 'py.exe -0' gives: > Requested Python version (0) not installed > > But using 'py.exe -0' from Python 3.9 correctly > gives: > -3.6-32 * > -2.7-32 > > -- > --gv > -- > https://mail.python.org/mailman/listinfo/python-list > > -- > https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list
Re: Python Error
Thanks. I updated the path and was able to launch python.exe for v3.8. I got rid of the other errors but now facing an error with 'pandas' although it is installed ok and the path correctly updated. C:\Users\mchak>pythonPython 3.8.6 (tags/v3.8.6:db45529, Sep 23 2020, 15:52:53) [MSC v.1927 64 bit (AMD64)] on win32Type "help", "copyright", "credits" or "license" for more information.>>> import pandas as pdTraceback (most recent call last): File "", line 1, in File "C:\Users\mchak\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\pandas\__init__.py", line 22, in from pandas.compat.numpy import (ModuleNotFoundError: No module named 'pandas.compat.numpy'>>> - Mayukh On Tuesday, November 24, 2020, 09:27:00 PM GMT, Barry wrote: Two observations. Python.exe is not on your PATH. But that does not matter as you can use the py command instead And nymph may not be available for python 3.9 yet. Check on pypi to see if there is a build for 3.9. Maybe use 3.8 for the time being. Barry > On 24 Nov 2020, at 11:18, Mayukh Chakraborty via Python-list > wrote: > > Thanks - I am able to launch 'py' from the command prompt and it gives me > the python versions installed in my machine from python.org website. > However, when I am trying to execute a python program from command prompt, I > am getting the error below. I had reinstalled python packages (numpy, pandas) > but it didn't resolve the issue. Any help would be appreciated. > Original error was: No module named 'numpy.core._multiarray_umath' > > --- > C:\Users\mchak\Documents\Python>py ES.pyTraceback (most recent call last): > File > "C:\Users\mchak\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\numpy\core\__init__.py", > line 22, in from . import multiarray File > "C:\Users\mchak\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\numpy\core\multiarray.py", > line 12, in from . import overrides File > "C:\Users\mchak\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\numpy\core\overrides.py", > line 7, in from numpy.core._multiarray_umath import > (ModuleNotFoundError: No module named 'numpy.core._multiarray_umath' > During handling of the above exception, another exception occurred: > Traceback (most recent call last): File > "C:\Users\mchak\Documents\Python\ES.py", line 1, in import scipy > as sp File > "C:\Users\mchak\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\scipy\__init__.py", > line 61, in from numpy import show_config as show_numpy_config > File > "C:\Users\mchak\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\numpy\__init__.py", > line 140, in from . import core File > "C:\Users\mchak\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\numpy\core\__init__.py", > line 48, in raise ImportError(msg)ImportError: > IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE! > Importing the numpy C-extensions failed. This error can happen formany > reasons, often due to issues with your setup or how NumPy wasinstalled. > We have compiled some common reasons and troubleshooting tips at: > https://numpy.org/devdocs/user/troubleshooting-importerror.html > Please note and check the following: > * The Python version is: Python3.9 from >"C:\Users\mchak\AppData\Local\Programs\Python\Python39\python.exe" * The >NumPy version is: "1.19.4" > and make sure that they are the versions you expect.Please carefully study > the documentation linked above for further help. > Original error was: No module named 'numpy.core._multiarray_umath' > >> On Tuesday, November 24, 2020, 07:13:04 AM GMT, Gisle Vanem >> wrote: >> >> Barry Scott wrote: >> >> If you have python from python.org installed you should be able to list all >> the version you have installed >> with the command: >> >> py -0 > When was that '-0' feature added? > I have Python 3.6 from Python.org and here a > 'py.exe -0' gives: > Requested Python version (0) not installed > > But using 'py.exe -0' from Python 3.9 correctly > gives: > -3.6-32 * > -2.7-32 > > -- > --gv > -- > https://mail.python.org/mailman/listinfo/python-list > > -- > https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list
Why can't numpy array be restored to saved value?
Why isn't the final value of the numpy array npary in the following code the
same as the initial value before some but not all elements of the array were
changed to a new value?
I know I am missing something basic here. I thought I understood the
concepts of immutable vs mutable values but obviously I missed something.
My environment is Win10-64, Python 3.8.5, numpy 1.19.2.
Code and output follows. TIA for any help you can provide to cure my
ignorance.
Peter
--- nptest.py ---
import numpy as np
import sys
if len(sys.argv) > 0:
try:
asz = int(sys.argv[1]) + 0
except:
asz = 4
npary = np.full([asz, asz, asz], 0, dtype=np.int32)
print("Array before change=\n{}".format(npary))
svary = npary[:, :, :]
npary[1:-1, 1:-1, 1:-1] = 1
print("Array after change=\n{}".format(npary))
npary = svary[:, :, :]
print("Array after restore=\n{}".format(npary))
--- nptest.py ---
--- output ---
Array before change=
[[[0 0 0 0]
[0 0 0 0]
[0 0 0 0]
[0 0 0 0]]
[[0 0 0 0]
[0 0 0 0]
[0 0 0 0]
[0 0 0 0]]
[[0 0 0 0]
[0 0 0 0]
[0 0 0 0]
[0 0 0 0]]
[[0 0 0 0]
[0 0 0 0]
[0 0 0 0]
[0 0 0 0]]]
Array after change=
[[[0 0 0 0]
[0 0 0 0]
[0 0 0 0]
[0 0 0 0]]
[[0 0 0 0]
[0 1 1 0]
[0 1 1 0]
[0 0 0 0]]
[[0 0 0 0]
[0 1 1 0]
[0 1 1 0]
[0 0 0 0]]
[[0 0 0 0]
[0 0 0 0]
[0 0 0 0]
[0 0 0 0]]]
Array after restore=
[[[0 0 0 0]
[0 0 0 0]
[0 0 0 0]
[0 0 0 0]]
[[0 0 0 0]
[0 1 1 0]
[0 1 1 0]
[0 0 0 0]]
[[0 0 0 0]
[0 1 1 0]
[0 1 1 0]
[0 0 0 0]]
[[0 0 0 0]
[0 0 0 0]
[0 0 0 0]
[0 0 0 0]]]
--- output ---
--
https://mail.python.org/mailman/listinfo/python-list
