Вы пишите что-то удивительное. numpy
ставится легко и непринуждённо.
Вот пример. Windows 10, Powershell 7, Pyhton 3.9. Я делаю следующее:
- Создаю
venv
- Активирую
venv
- Убеждаюсь, что python указывает внутрь
venv
- Запускаю python, делаю
import numpy
и получаю отлуп:No module named 'numpy'
- Устанавливаю
numpy
черезpip
внутриvenv
. Никаких ошибок. - Запускаю python, делаю
import numpy
— работает.
На каком этапе у вас ломается? Покажите весь сценарий.
PS:tmp> D:SoftwarePythonpython -m venv try-env
PS:tmp> .try-envScriptsactivate
(try-env) PS:tmp> Get-Command python
CommandType Name Version Source
----------- ---- ------- ------
Application python.exe 3.9.4150.… D:tmptry-envScriptspython.exe
(try-env) PS:tmp> python
Python 3.9.4 (tags/v3.9.4:1f2e308, Apr 6 2021, 13:40:21) [MSC v.1928 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy as np
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'numpy'
>>> ^Z
(try-env) PS:tmp> python -m pip --version
pip 20.2.3 from D:tmptry-envlibsite-packagespip (python 3.9)
(try-env) PS:tmp> python -m pip install numpy
Collecting numpy
Using cached numpy-1.20.2-cp39-cp39-win_amd64.whl (13.7 MB)
Installing collected packages: numpy
Successfully installed numpy-1.20.2
WARNING: You are using pip version 20.2.3; however, version 21.0.1 is available.
You should consider upgrading via the 'D:tmptry-envScriptspython.exe -m pip install --upgrade pip' command.
(try-env) PS:tmp> python
Python 3.9.4 (tags/v3.9.4:1f2e308, Apr 6 2021, 13:40:21) [MSC v.1928 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy as np
>>> ^Z
(try-env) PS:tmp> deactivate
PS:tmp>
Дополнительная проверка, что numpy
есть в site-packages
внутри виртуального окружения:
PS:tmp> ls .try-envLibsite-packages
Directory: D:tmptry-envLibsite-packages
Mode LastWriteTime Length Name
---- ------------- ------ ----
d---- 2021-04-14 18:54 __pycache__
d---- 2021-04-14 18:55 numpy
d---- 2021-04-14 18:55 numpy-1.20.2.dist-info
d---- 2021-04-14 18:54 pip
d---- 2021-04-14 18:54 pip-20.2.3.dist-info
d---- 2021-04-14 18:54 pkg_resources
d---- 2021-04-14 18:54 setuptools
d---- 2021-04-14 18:54 setuptools-49.2.1.dist-info
-a--- 2021-04-14 18:54 126 easy_install.py
Hi @seberg and @ksunden
Run the code with no cache dir param but no success, on the first moment, looks good but the same error. Also, I already have the Anaconda, this was my first workaround for the issue, once I need python for my test on university
`C:UsersLeo>pip3 install numpy —no-cache-dir
Collecting numpy
Downloading https://files.pythonhosted.org/packages/93/48/956b9dcdddfcedb1705839280e02cbfeb2861ed5d7f59241210530867d5b/numpy-1.16.3.zip (5.1MB)
|████████████████████████████████| 5.1MB 3.2MB/s
Building wheels for collected packages: numpy
Building wheel for numpy (setup.py) … error
ERROR: Complete output from command ‘c:usersleoappdatalocalprogramspythonpython38python.exe’ -u -c ‘import setuptools, tokenize;file='»‘»‘C:UsersLeoAppDataLocalTemppip-install-cy037osinumpysetup.py'»‘»‘;f=getattr(tokenize, ‘»‘»‘open'»‘»‘, open)(file);code=f.read().replace(‘»‘»‘rn'»‘»‘, ‘»‘»‘n'»‘»‘);f.close();exec(compile(code, file, ‘»‘»‘exec'»‘»‘))’ bdist_wheel -d ‘C:UsersLeoAppDataLocalTemppip-wheel-otjo0nri’ —python-tag cp38:
ERROR: Running from numpy source directory.
C:UsersLeoAppDataLocalTemppip-install-cy037osinumpynumpydistutilsmisc_util.py:476: SyntaxWarning: «is» with a literal. Did you mean «==»?
return is_string(s) and (‘*’ in s or ‘?’ is s)
blas_opt_info:
blas_mkl_info:
No module named ‘numpy.distutils._msvccompiler’ in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries mkl_rt not found in [‘c:usersleoappdatalocalprogramspythonpython38lib’, ‘C:’, ‘c:usersleoappdatalocalprogramspythonpython38libs’]
NOT AVAILABLE
blis_info:
No module named ‘numpy.distutils._msvccompiler’ in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries blis not found in [‘c:usersleoappdatalocalprogramspythonpython38lib’, ‘C:’, ‘c:usersleoappdatalocalprogramspythonpython38libs’]
NOT AVAILABLE
openblas_info:
No module named ‘numpy.distutils._msvccompiler’ in numpy.distutils; trying from distutils
customize MSVCCompiler
No module named ‘numpy.distutils._msvccompiler’ in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries openblas not found in [‘c:usersleoappdatalocalprogramspythonpython38lib’, ‘C:’, ‘c:usersleoappdatalocalprogramspythonpython38libs’]
get_default_fcompiler: matching types: ‘[‘gnu’, ‘intelv’, ‘absoft’, ‘compaqv’, ‘intelev’, ‘gnu95’, ‘g95’, ‘intelvem’, ‘intelem’, ‘flang’]’
customize GnuFCompiler
Could not locate executable g77
Could not locate executable f77
customize IntelVisualFCompiler
Could not locate executable ifort
Could not locate executable ifl
customize AbsoftFCompiler
Could not locate executable f90
customize CompaqVisualFCompiler
Could not locate executable DF
customize IntelItaniumVisualFCompiler
Could not locate executable efl
customize Gnu95FCompiler
Could not locate executable gfortran
Could not locate executable f95
customize G95FCompiler
Could not locate executable g95
customize IntelEM64VisualFCompiler
customize IntelEM64TFCompiler
Could not locate executable efort
Could not locate executable efc
customize PGroupFlangCompiler
Could not locate executable flang
don’t know how to compile Fortran code on platform ‘nt’
NOT AVAILABLE
atlas_3_10_blas_threads_info:
Setting PTATLAS=ATLAS
No module named ‘numpy.distutils._msvccompiler’ in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries tatlas not found in [‘c:usersleoappdatalocalprogramspythonpython38lib’, ‘C:’, ‘c:usersleoappdatalocalprogramspythonpython38libs’]
NOT AVAILABLE
atlas_3_10_blas_info:
No module named ‘numpy.distutils._msvccompiler’ in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries satlas not found in [‘c:usersleoappdatalocalprogramspythonpython38lib’, ‘C:’, ‘c:usersleoappdatalocalprogramspythonpython38libs’]
NOT AVAILABLE
atlas_blas_threads_info:
Setting PTATLAS=ATLAS
No module named ‘numpy.distutils._msvccompiler’ in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries ptf77blas,ptcblas,atlas not found in [‘c:usersleoappdatalocalprogramspythonpython38lib’, ‘C:’, ‘c:usersleoappdatalocalprogramspythonpython38libs’]
NOT AVAILABLE
atlas_blas_info:
No module named ‘numpy.distutils._msvccompiler’ in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries f77blas,cblas,atlas not found in [‘c:usersleoappdatalocalprogramspythonpython38lib’, ‘C:’, ‘c:usersleoappdatalocalprogramspythonpython38libs’]
NOT AVAILABLE
accelerate_info:
NOT AVAILABLE
C:UsersLeoAppDataLocalTemppip-install-cy037osinumpynumpydistutilssystem_info.py:638: UserWarning:
Atlas (http://math-atlas.sourceforge.net/) libraries not found.
Directories to search for the libraries can be specified in the
numpy/distutils/site.cfg file (section [atlas]) or by setting
the ATLAS environment variable.
self.calc_info()
blas_info:
No module named ‘numpy.distutils._msvccompiler’ in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries blas not found in [‘c:usersleoappdatalocalprogramspythonpython38lib’, ‘C:’, ‘c:usersleoappdatalocalprogramspythonpython38libs’]
NOT AVAILABLE
C:UsersLeoAppDataLocalTemppip-install-cy037osinumpynumpydistutilssystem_info.py:638: UserWarning:
Blas (http://www.netlib.org/blas/) libraries not found.
Directories to search for the libraries can be specified in the
numpy/distutils/site.cfg file (section [blas]) or by setting
the BLAS environment variable.
self.calc_info()
blas_src_info:
NOT AVAILABLE
C:UsersLeoAppDataLocalTemppip-install-cy037osinumpynumpydistutilssystem_info.py:638: UserWarning:
Blas (http://www.netlib.org/blas/) sources not found.
Directories to search for the sources can be specified in the
numpy/distutils/site.cfg file (section [blas_src]) or by setting
the BLAS_SRC environment variable.
self.calc_info()
NOT AVAILABLE
‘svnversion’ nÆo ‚ reconhecido como um comando interno
ou externo, um programa oper vel ou um arquivo em lotes.
non-existing path in ‘numpydistutils’: ‘site.cfg’
lapack_opt_info:
lapack_mkl_info:
No module named ‘numpy.distutils._msvccompiler’ in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries mkl_rt not found in [‘c:usersleoappdatalocalprogramspythonpython38lib’, ‘C:’, ‘c:usersleoappdatalocalprogramspythonpython38libs’]
NOT AVAILABLE
openblas_lapack_info:
No module named ‘numpy.distutils._msvccompiler’ in numpy.distutils; trying from distutils
customize MSVCCompiler
No module named ‘numpy.distutils._msvccompiler’ in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries openblas not found in [‘c:usersleoappdatalocalprogramspythonpython38lib’, ‘C:’, ‘c:usersleoappdatalocalprogramspythonpython38libs’]
NOT AVAILABLE
openblas_clapack_info:
No module named ‘numpy.distutils._msvccompiler’ in numpy.distutils; trying from distutils
customize MSVCCompiler
No module named ‘numpy.distutils._msvccompiler’ in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries openblas,lapack not found in [‘c:usersleoappdatalocalprogramspythonpython38lib’, ‘C:’, ‘c:usersleoappdatalocalprogramspythonpython38libs’]
NOT AVAILABLE
atlas_3_10_threads_info:
Setting PTATLAS=ATLAS
No module named ‘numpy.distutils._msvccompiler’ in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries lapack_atlas not found in c:usersleoappdatalocalprogramspythonpython38lib
No module named ‘numpy.distutils._msvccompiler’ in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries tatlas,tatlas not found in c:usersleoappdatalocalprogramspythonpython38lib
No module named ‘numpy.distutils._msvccompiler’ in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries lapack_atlas not found in C:
No module named ‘numpy.distutils._msvccompiler’ in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries tatlas,tatlas not found in C:
No module named ‘numpy.distutils._msvccompiler’ in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries lapack_atlas not found in c:usersleoappdatalocalprogramspythonpython38libs
No module named ‘numpy.distutils._msvccompiler’ in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries tatlas,tatlas not found in c:usersleoappdatalocalprogramspythonpython38libs
<class ‘numpy.distutils.system_info.atlas_3_10_threads_info’>
NOT AVAILABLE
atlas_3_10_info:
No module named ‘numpy.distutils._msvccompiler’ in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries lapack_atlas not found in c:usersleoappdatalocalprogramspythonpython38lib
No module named ‘numpy.distutils._msvccompiler’ in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries satlas,satlas not found in c:usersleoappdatalocalprogramspythonpython38lib
No module named ‘numpy.distutils._msvccompiler’ in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries lapack_atlas not found in C:
No module named ‘numpy.distutils._msvccompiler’ in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries satlas,satlas not found in C:
No module named ‘numpy.distutils._msvccompiler’ in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries lapack_atlas not found in c:usersleoappdatalocalprogramspythonpython38libs
No module named ‘numpy.distutils._msvccompiler’ in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries satlas,satlas not found in c:usersleoappdatalocalprogramspythonpython38libs
<class ‘numpy.distutils.system_info.atlas_3_10_info’>
NOT AVAILABLE
atlas_threads_info:
Setting PTATLAS=ATLAS
No module named ‘numpy.distutils._msvccompiler’ in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries lapack_atlas not found in c:usersleoappdatalocalprogramspythonpython38lib
No module named ‘numpy.distutils._msvccompiler’ in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries ptf77blas,ptcblas,atlas not found in c:usersleoappdatalocalprogramspythonpython38lib
No module named ‘numpy.distutils._msvccompiler’ in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries lapack_atlas not found in C:
No module named ‘numpy.distutils._msvccompiler’ in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries ptf77blas,ptcblas,atlas not found in C:
No module named ‘numpy.distutils._msvccompiler’ in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries lapack_atlas not found in c:usersleoappdatalocalprogramspythonpython38libs
No module named ‘numpy.distutils._msvccompiler’ in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries ptf77blas,ptcblas,atlas not found in c:usersleoappdatalocalprogramspythonpython38libs
<class ‘numpy.distutils.system_info.atlas_threads_info’>
NOT AVAILABLE
atlas_info:
No module named ‘numpy.distutils._msvccompiler’ in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries lapack_atlas not found in c:usersleoappdatalocalprogramspythonpython38lib
No module named ‘numpy.distutils._msvccompiler’ in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries f77blas,cblas,atlas not found in c:usersleoappdatalocalprogramspythonpython38lib
No module named ‘numpy.distutils._msvccompiler’ in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries lapack_atlas not found in C:
No module named ‘numpy.distutils._msvccompiler’ in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries f77blas,cblas,atlas not found in C:
No module named ‘numpy.distutils._msvccompiler’ in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries lapack_atlas not found in c:usersleoappdatalocalprogramspythonpython38libs
No module named ‘numpy.distutils._msvccompiler’ in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries f77blas,cblas,atlas not found in c:usersleoappdatalocalprogramspythonpython38libs
<class ‘numpy.distutils.system_info.atlas_info’>
NOT AVAILABLE
lapack_info:
No module named ‘numpy.distutils._msvccompiler’ in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries lapack not found in [‘c:usersleoappdatalocalprogramspythonpython38lib’, ‘C:’, ‘c:usersleoappdatalocalprogramspythonpython38libs’]
NOT AVAILABLE
C:UsersLeoAppDataLocalTemppip-install-cy037osinumpynumpydistutilssystem_info.py:638: UserWarning:
Lapack (http://www.netlib.org/lapack/) libraries not found.
Directories to search for the libraries can be specified in the
numpy/distutils/site.cfg file (section [lapack]) or by setting
the LAPACK environment variable.
self.calc_info()
lapack_src_info:
NOT AVAILABLE
C:UsersLeoAppDataLocalTemppip-install-cy037osinumpynumpydistutilssystem_info.py:638: UserWarning:
Lapack (http://www.netlib.org/lapack/) sources not found.
Directories to search for the sources can be specified in the
numpy/distutils/site.cfg file (section [lapack_src]) or by setting
the LAPACK_SRC environment variable.
self.calc_info()
NOT AVAILABLE
c:usersleoappdatalocalprogramspythonpython38libdistutilsdist.py:274: UserWarning: Unknown distribution option: ‘define_macros’
warnings.warn(msg)
running bdist_wheel
running build
running config_cc
unifing config_cc, config, build_clib, build_ext, build commands —compiler options
running config_fc
unifing config_fc, config, build_clib, build_ext, build commands —fcompiler options
running build_src
build_src
building py_modules sources
creating build
creating buildsrc.win-amd64-3.8
creating buildsrc.win-amd64-3.8numpy
creating buildsrc.win-amd64-3.8numpydistutils
building library «npymath» sources
No module named ‘numpy.distutils._msvccompiler’ in numpy.distutils; trying from distutils
error: Microsoft Visual C++ 14.0 is required. Get it with «Microsoft Visual C++ Build Tools»: https://visualstudio.microsoft.com/downloads/
ERROR: Failed building wheel for numpy
Running setup.py clean for numpy
ERROR: Complete output from command ‘c:usersleoappdatalocalprogramspythonpython38python.exe’ -u -c ‘import setuptools, tokenize;file='»‘»‘C:UsersLeoAppDataLocalTemppip-install-cy037osinumpysetup.py'»‘»‘;f=getattr(tokenize, ‘»‘»‘open'»‘»‘, open)(file);code=f.read().replace(‘»‘»‘rn'»‘»‘, ‘»‘»‘n'»‘»‘);f.close();exec(compile(code, file, ‘»‘»‘exec'»‘»‘))’ clean —all:
ERROR: Running from numpy source directory.
setup.py clean
is not supported, use one of the following instead:
- `git clean -xdf` (cleans all files)
- `git clean -Xdf` (cleans all versioned files, doesn't touch
files that aren't checked into the git repo)
Add --force
to your command to use it anyway if you must (unsupported).
ERROR: Failed cleaning build dir for numpy
Failed to build numpy
Installing collected packages: numpy
Running setup.py install for numpy … error
ERROR: Complete output from command ‘c:usersleoappdatalocalprogramspythonpython38python.exe’ -u -c ‘import setuptools, tokenize;file='»‘»‘C:UsersLeoAppDataLocalTemppip-install-cy037osinumpysetup.py'»‘»‘;f=getattr(tokenize, ‘»‘»‘open'»‘»‘, open)(file);code=f.read().replace(‘»‘»‘rn'»‘»‘, ‘»‘»‘n'»‘»‘);f.close();exec(compile(code, file, ‘»‘»‘exec'»‘»‘))’ install —record ‘C:UsersLeoAppDataLocalTemppip-record-sy0t4rybinstall-record.txt’ —single-version-externally-managed —compile:
ERROR: Running from numpy source directory.
Note: if you need reliable uninstall behavior, then install
with pip instead of using `setup.py install`:
- `pip install .` (from a git repo or downloaded source
release)
- `pip install numpy` (last NumPy release on PyPi)
blas_opt_info:
blas_mkl_info:
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries mkl_rt not found in ['c:\users\leo\appdata\local\programs\python\python38\lib', 'C:\', 'c:\users\leo\appdata\local\programs\python\python38\libs']
NOT AVAILABLE
blis_info:
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries blis not found in ['c:\users\leo\appdata\local\programs\python\python38\lib', 'C:\', 'c:\users\leo\appdata\local\programs\python\python38\libs']
NOT AVAILABLE
openblas_info:
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries openblas not found in ['c:\users\leo\appdata\local\programs\python\python38\lib', 'C:\', 'c:\users\leo\appdata\local\programs\python\python38\libs']
get_default_fcompiler: matching types: '['gnu', 'intelv', 'absoft', 'compaqv', 'intelev', 'gnu95', 'g95', 'intelvem', 'intelem', 'flang']'
customize GnuFCompiler
Could not locate executable g77
Could not locate executable f77
customize IntelVisualFCompiler
Could not locate executable ifort
Could not locate executable ifl
customize AbsoftFCompiler
Could not locate executable f90
customize CompaqVisualFCompiler
Could not locate executable DF
customize IntelItaniumVisualFCompiler
Could not locate executable efl
customize Gnu95FCompiler
Could not locate executable gfortran
Could not locate executable f95
customize G95FCompiler
Could not locate executable g95
customize IntelEM64VisualFCompiler
customize IntelEM64TFCompiler
Could not locate executable efort
Could not locate executable efc
customize PGroupFlangCompiler
Could not locate executable flang
don't know how to compile Fortran code on platform 'nt'
NOT AVAILABLE
atlas_3_10_blas_threads_info:
Setting PTATLAS=ATLAS
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries tatlas not found in ['c:\users\leo\appdata\local\programs\python\python38\lib', 'C:\', 'c:\users\leo\appdata\local\programs\python\python38\libs']
NOT AVAILABLE
atlas_3_10_blas_info:
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries satlas not found in ['c:\users\leo\appdata\local\programs\python\python38\lib', 'C:\', 'c:\users\leo\appdata\local\programs\python\python38\libs']
NOT AVAILABLE
atlas_blas_threads_info:
Setting PTATLAS=ATLAS
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries ptf77blas,ptcblas,atlas not found in ['c:\users\leo\appdata\local\programs\python\python38\lib', 'C:\', 'c:\users\leo\appdata\local\programs\python\python38\libs']
NOT AVAILABLE
atlas_blas_info:
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries f77blas,cblas,atlas not found in ['c:\users\leo\appdata\local\programs\python\python38\lib', 'C:\', 'c:\users\leo\appdata\local\programs\python\python38\libs']
NOT AVAILABLE
accelerate_info:
NOT AVAILABLE
C:UsersLeoAppDataLocalTemppip-install-cy037osinumpynumpydistutilssystem_info.py:638: UserWarning:
Atlas (http://math-atlas.sourceforge.net/) libraries not found.
Directories to search for the libraries can be specified in the
numpy/distutils/site.cfg file (section [atlas]) or by setting
the ATLAS environment variable.
self.calc_info()
blas_info:
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries blas not found in ['c:\users\leo\appdata\local\programs\python\python38\lib', 'C:\', 'c:\users\leo\appdata\local\programs\python\python38\libs']
NOT AVAILABLE
C:UsersLeoAppDataLocalTemppip-install-cy037osinumpynumpydistutilssystem_info.py:638: UserWarning:
Blas (http://www.netlib.org/blas/) libraries not found.
Directories to search for the libraries can be specified in the
numpy/distutils/site.cfg file (section [blas]) or by setting
the BLAS environment variable.
self.calc_info()
blas_src_info:
NOT AVAILABLE
C:UsersLeoAppDataLocalTemppip-install-cy037osinumpynumpydistutilssystem_info.py:638: UserWarning:
Blas (http://www.netlib.org/blas/) sources not found.
Directories to search for the sources can be specified in the
numpy/distutils/site.cfg file (section [blas_src]) or by setting
the BLAS_SRC environment variable.
self.calc_info()
NOT AVAILABLE
'svnversion' nÆo ‚ reconhecido como um comando interno
ou externo, um programa oper vel ou um arquivo em lotes.
non-existing path in 'numpy\distutils': 'site.cfg'
lapack_opt_info:
lapack_mkl_info:
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries mkl_rt not found in ['c:\users\leo\appdata\local\programs\python\python38\lib', 'C:\', 'c:\users\leo\appdata\local\programs\python\python38\libs']
NOT AVAILABLE
openblas_lapack_info:
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries openblas not found in ['c:\users\leo\appdata\local\programs\python\python38\lib', 'C:\', 'c:\users\leo\appdata\local\programs\python\python38\libs']
NOT AVAILABLE
openblas_clapack_info:
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries openblas,lapack not found in ['c:\users\leo\appdata\local\programs\python\python38\lib', 'C:\', 'c:\users\leo\appdata\local\programs\python\python38\libs']
NOT AVAILABLE
atlas_3_10_threads_info:
Setting PTATLAS=ATLAS
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries lapack_atlas not found in c:usersleoappdatalocalprogramspythonpython38lib
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries tatlas,tatlas not found in c:usersleoappdatalocalprogramspythonpython38lib
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries lapack_atlas not found in C:
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries tatlas,tatlas not found in C:
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries lapack_atlas not found in c:usersleoappdatalocalprogramspythonpython38libs
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries tatlas,tatlas not found in c:usersleoappdatalocalprogramspythonpython38libs
<class 'numpy.distutils.system_info.atlas_3_10_threads_info'>
NOT AVAILABLE
atlas_3_10_info:
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries lapack_atlas not found in c:usersleoappdatalocalprogramspythonpython38lib
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries satlas,satlas not found in c:usersleoappdatalocalprogramspythonpython38lib
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries lapack_atlas not found in C:
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries satlas,satlas not found in C:
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries lapack_atlas not found in c:usersleoappdatalocalprogramspythonpython38libs
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries satlas,satlas not found in c:usersleoappdatalocalprogramspythonpython38libs
<class 'numpy.distutils.system_info.atlas_3_10_info'>
NOT AVAILABLE
atlas_threads_info:
Setting PTATLAS=ATLAS
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries lapack_atlas not found in c:usersleoappdatalocalprogramspythonpython38lib
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries ptf77blas,ptcblas,atlas not found in c:usersleoappdatalocalprogramspythonpython38lib
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries lapack_atlas not found in C:
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries ptf77blas,ptcblas,atlas not found in C:
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries lapack_atlas not found in c:usersleoappdatalocalprogramspythonpython38libs
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries ptf77blas,ptcblas,atlas not found in c:usersleoappdatalocalprogramspythonpython38libs
<class 'numpy.distutils.system_info.atlas_threads_info'>
NOT AVAILABLE
atlas_info:
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries lapack_atlas not found in c:usersleoappdatalocalprogramspythonpython38lib
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries f77blas,cblas,atlas not found in c:usersleoappdatalocalprogramspythonpython38lib
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries lapack_atlas not found in C:
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries f77blas,cblas,atlas not found in C:
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries lapack_atlas not found in c:usersleoappdatalocalprogramspythonpython38libs
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries f77blas,cblas,atlas not found in c:usersleoappdatalocalprogramspythonpython38libs
<class 'numpy.distutils.system_info.atlas_info'>
NOT AVAILABLE
lapack_info:
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
libraries lapack not found in ['c:\users\leo\appdata\local\programs\python\python38\lib', 'C:\', 'c:\users\leo\appdata\local\programs\python\python38\libs']
NOT AVAILABLE
C:UsersLeoAppDataLocalTemppip-install-cy037osinumpynumpydistutilssystem_info.py:638: UserWarning:
Lapack (http://www.netlib.org/lapack/) libraries not found.
Directories to search for the libraries can be specified in the
numpy/distutils/site.cfg file (section [lapack]) or by setting
the LAPACK environment variable.
self.calc_info()
lapack_src_info:
NOT AVAILABLE
C:UsersLeoAppDataLocalTemppip-install-cy037osinumpynumpydistutilssystem_info.py:638: UserWarning:
Lapack (http://www.netlib.org/lapack/) sources not found.
Directories to search for the sources can be specified in the
numpy/distutils/site.cfg file (section [lapack_src]) or by setting
the LAPACK_SRC environment variable.
self.calc_info()
NOT AVAILABLE
c:usersleoappdatalocalprogramspythonpython38libdistutilsdist.py:274: UserWarning: Unknown distribution option: 'define_macros'
warnings.warn(msg)
running install
running build
running config_cc
unifing config_cc, config, build_clib, build_ext, build commands --compiler options
running config_fc
unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options
running build_src
build_src
building py_modules sources
building library "npymath" sources
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/
----------------------------------------
ERROR: Command «‘c:usersleoappdatalocalprogramspythonpython38python.exe’ -u -c ‘import setuptools, tokenize;file='»‘»‘C:UsersLeoAppDataLocalTemppip-install-cy037osinumpysetup.py'»‘»‘;f=getattr(tokenize, ‘»‘»‘open'»‘»‘, open)(file);code=f.read().replace(‘»‘»‘rn'»‘»‘, ‘»‘»‘n'»‘»‘);f.close();exec(compile(code, file, ‘»‘»‘exec'»‘»‘))’ install —record ‘C:UsersLeoAppDataLocalTemppip-record-sy0t4rybinstall-record.txt’ —single-version-externally-managed —compile» failed with error code 1 in C:UsersLeoAppDataLocalTemppip-install-cy037osinumpy`
Note
Since this information may be updated regularly, please ensure you are
viewing the most up-to-date version.
ImportError#
In certain cases a failed installation or setup issue can cause you to
see the following error message:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE! Importing the numpy c-extensions failed. This error can happen for different reasons, often due to issues with your setup.
The error also has additional information to help you troubleshoot:
-
Your Python version
-
Your NumPy version
Please check both of these carefully to see if they are what you expect.
You may need to check your PATH
or PYTHONPATH
environment variables
(see Check Environment Variables below).
The following sections list commonly reported issues depending on your setup.
If you have an issue/solution that you think should appear please open a
NumPy issue so that it will be added.
There are a few commonly reported issues depending on your system/setup.
If none of the following tips help you, please be sure to note the following:
-
how you installed Python
-
how you installed NumPy
-
your operating system
-
whether or not you have multiple versions of Python installed
-
if you built from source, your compiler versions and ideally a build log
when investigating further and asking for support.
Using Python from conda
(Anaconda)#
Please make sure that you have activated your conda environment.
See also the conda user-guide.
If you use an external editor/development environment it will have to be set
up correctly. See below for solutions for some common setups.
Using PyCharm with Anaconda/conda Python#
There are fairly common issues when using PyCharm together with Anaconda,
please see the PyCharm support
Using VSCode with Anaconda/conda Python (or environments)#
A commonly reported issue is related to the environment activation within
VSCode. Please see the VSCode support
for information on how to correctly set up VSCode with virtual environments
or conda.
Using Eclipse/PyDev with Anaconda/conda Python (or environments)#
Please see the
Anaconda Documentation
on how to properly configure Eclipse/PyDev to use Anaconda Python with specific
conda environments.
Raspberry Pi#
There are sometimes issues reported on Raspberry Pi setups when installing
using pip3 install
(or pip
install). These will typically mention:
libf77blas.so.3: cannot open shared object file: No such file or directory
The solution will be to either:
sudo apt-get install libatlas-base-dev
to install the missing libraries expected by the self-compiled NumPy
(ATLAS is a possible provider of linear algebra).
Alternatively use the NumPy provided by Raspbian. In which case run:
pip3 uninstall numpy # remove previously installed version apt install python3-numpy
Debug build on Windows#
Rather than building your project in DEBUG
mode on windows, try
building in RELEASE
mode with debug symbols and no optimization.
Full DEBUG
mode on windows changes the names of the DLLs python
expects to find, so if you wish to truly work in DEBUG
mode you will
need to recompile the entire stack of python modules you work with
including NumPy
All Setups#
Occasionally there may be simple issues with old or bad installations
of NumPy. In this case you may just try to uninstall and reinstall NumPy.
Make sure that NumPy is not found after uninstalling.
Development Setup#
If you are using a development setup, make sure to run git clean -xdf
to delete all files not under version control (be careful not to lose
any modifications you made, e.g. site.cfg
).
In many cases files from old builds may lead to incorrect builds.
Check Environment Variables#
In general how to set and check your environment variables depends on
your system. If you can open a correct python shell, you can also run the
following in python:
import os print("PYTHONPATH:", os.environ.get('PYTHONPATH')) print("PATH:", os.environ.get('PATH'))
This may mainly help you if you are not running the python and/or NumPy
version you are expecting to run.
C-API incompatibility#
If you see an error like:
RuntimeError: module compiled against API version v1 but this version of numpy is v2
You may have:
-
A bad extension “wheel” (binary install) that should use
oldest-support-numpy (
with manual constraints if necessary) to build their binary packages. -
An environment issue messing with package versions.
-
Incompatible package versions somehow enforced manually.
-
An extension module compiled locally against a very recent version
followed by a NumPy downgrade. -
A compiled extension copied to a different computer with an
older NumPy version.
The best thing to do if you see this error is to contact
the maintainers of the package that is causing problem
so that they can solve the problem properly.
However, while you wait for a solution, a work around
that usually works is to upgrade the NumPy version:
pip install numpy --upgrade
Segfaults or crashes#
NumPy tries to use advanced CPU features (SIMD) to speed up operations. If you
are getting an “illegal instruction” error or a segfault, one cause could be
that the environment claims it can support one or more of these features but
actually cannot. This can happen inside a docker image or a VM (qemu, VMWare,
…)
You can use the output of np.show_runtime()
to show which SIMD features are
detected. For instance:
>>> np.show_runtime() WARNING: `threadpoolctl` not found in system! Install it by `pip install threadpoolctl`. Once installed, try `np.show_runtime` again for more detailed build information [{'simd_extensions': {'baseline': ['SSE', 'SSE2', 'SSE3'], 'found': ['SSSE3', 'SSE41', 'POPCNT', 'SSE42', 'AVX', 'F16C', 'FMA3', 'AVX2'], 'not_found': ['AVX512F', 'AVX512CD', 'AVX512_KNL', 'AVX512_KNM', 'AVX512_SKX', 'AVX512_CLX', 'AVX512_CNL', 'AVX512_ICL']}}]
In this case, it shows AVX2 and FMA3 under the found
section, so you can
try disabling them by setting NPY_DISABLE_CPU_FEATURES="AVX2,FMA3"
in your
environment before running python (for cmd.exe on windows):
>SET NPY_DISABLE_CPU_FEATURES="AVX2,FMA3" >python <myprogram.py>
By installing threadpoolctl np.show_runtime()
will show additional information:
... {'architecture': 'Zen', 'filepath': '/tmp/venv3/lib/python3.9/site-packages/numpy.libs/libopenblas64_p-r0-15028c96.3.21.so', 'internal_api': 'openblas', 'num_threads': 24, 'prefix': 'libopenblas', 'threading_layer': 'pthreads', 'user_api': 'blas', 'version': '0.3.21'}]
If you use the wheel from PyPI, it contains code from the OpenBLAS project to
speed up matrix operations. This code too can try to use SIMD instructions. It
has a different mechanism for choosing which to use, based on a CPU
architecture, You can override this architecture by setting
OPENBLAS_CORETYPE
: a minimal value for x86_64
is
OPENBLAS_CORETYPE=Haswell
. This too needs to be set before running your
python (this time for posix):
$ OPENBLAS_CORETYPE=Haswell python <myprogram.py>
17 авг. 2022 г.
читать 1 мин
Одна распространенная ошибка, с которой вы можете столкнуться при использовании Python:
Import error: no module named ' numpy '
Эта ошибка возникает, когда Python не обнаруживает библиотеку NumPy в вашей текущей среде.
В этом руководстве представлены точные шаги, которые вы можете использовать для устранения этой ошибки.
Шаг 1: pip установить numpy
Поскольку NumPy не устанавливается автоматически вместе с Python, вам нужно будет установить его самостоятельно. Самый простой способ сделать это — использовать pip , менеджер пакетов для Python.
Вы можете запустить следующую команду pip для установки NumPy:
pip install numpy
Для python 3 вы можете использовать:
pip3 install numpy
В большинстве случаев это исправит ошибку.
Шаг 2: Установите пип
Если вы все еще получаете сообщение об ошибке, вам может потребоваться установить pip. Используйте эти шаги , чтобы сделать это.
Вы также можете использовать эти шаги для обновления pip до последней версии, чтобы убедиться, что он работает.
Затем вы можете запустить ту же команду pip, что и раньше, чтобы установить NumPy:
pip install numpy
На этом этапе ошибка должна быть устранена.
Шаг 3: проверьте версию NumPy
После успешной установки NumPy вы можете использовать следующую команду для отображения версии NumPy в вашей среде:
pip show numpy
Name: numpy
Version: 1.20.3
Summary: NumPy is the fundamental package for array computing with Python.
Home-page: https://www.numpy.org
Author: Travis E. Oliphant et al.
Author-email: None
License: BSD
Location: /srv/conda/envs/notebook/lib/python3.7/site-packages
Requires:
Required-by: tensorflow, tensorflow-estimator, tensorboard, statsmodels, seaborn,
scipy, scikit-learn, PyWavelets, patsy, pandas, matplotlib, Keras-Preprocessing,
Keras-Applications, imageio, h5py, bqplot, bokeh, altair
Note: you may need to restart the kernel to use updated packages.
Дополнительные ресурсы
В следующих руководствах объясняется, как исправить другие распространенные проблемы в Python:
Как исправить: нет модуля с именем pandas
Как исправить: нет модуля с именем plotly
Как исправить: имя NameError ‘pd’ не определено
Как исправить: имя NameError ‘np’ не определено
6 / 6 / 0 Регистрация: 06.03.2014 Сообщений: 108 |
|
1 |
|
19.09.2015, 21:34. Показов 6564. Ответов 13
Здравствуйте, столкнулся с такой проблемой: когда пытаюсь установить библиотеку numpy через PIP, выдаёт ошибку. Миниатюры
0 |
6 / 6 / 0 Регистрация: 06.03.2014 Сообщений: 108 |
|
20.09.2015, 20:46 [ТС] |
3 |
Скачал файлик numpy-1.9.2.whl . теперь не могу понять как его поставить. Если не трудно объясните новичку.
0 |
6 / 6 / 0 Регистрация: 06.03.2014 Сообщений: 108 |
|
20.09.2015, 23:07 [ТС] |
4 |
нашел инструкцию, нада сначала установить пакет wheel, затем перейти в папку где лежит numpy.whl , и прописать pip install numpy.whl . Но всё равно выдает ошибку. Как с этим боротся ? Миниатюры
0 |
298 / 256 / 57 Регистрация: 11.06.2012 Сообщений: 1,557 |
|
20.09.2015, 23:11 |
5 |
Swartex, возможно ты не правильно пишешь название .whl файла, возможно запускаешь комманду не из той папки где находится этот файл. Эти 2 варианта не подойдут — предложу еще пару
0 |
6 / 6 / 0 Регистрация: 06.03.2014 Сообщений: 108 |
|
20.09.2015, 23:17 [ТС] |
6 |
скачаный файлик numpy-1.9.2.whl спецом перименовал в numpy.whl для установки использую команду pip install numpy.whl . Если где то ошибся поправьте меня.
0 |
298 / 256 / 57 Регистрация: 11.06.2012 Сообщений: 1,557 |
|
20.09.2015, 23:19 |
7 |
и этот скачанный файлик у вас лежит прямо по адресу с:numpy.whl? И как вариант — попробуйте переименовать его обратно.
0 |
298 / 256 / 57 Регистрация: 11.06.2012 Сообщений: 1,557 |
|
20.09.2015, 23:27 |
9 |
ок, уже проще. У вас винда х64 или х32? Смотриться это дело мой_компьютер—свойства
0 |
6 / 6 / 0 Регистрация: 06.03.2014 Сообщений: 108 |
|
20.09.2015, 23:28 [ТС] |
10 |
х64
0 |
298 / 256 / 57 Регистрация: 11.06.2012 Сообщений: 1,557 |
|
20.09.2015, 23:34 |
11 |
Введите в коммандной строке python и покажите что выведет. Вы просто скачали файл не для вашей версии питона.
0 |
6 / 6 / 0 Регистрация: 06.03.2014 Сообщений: 108 |
|
20.09.2015, 23:35 [ТС] |
12 |
вот Миниатюры
0 |
298 / 256 / 57 Регистрация: 11.06.2012 Сообщений: 1,557 |
|
20.09.2015, 23:39 |
13 |
Сообщение было отмечено Swartex как решение Решениеа питон вы себе поставили версии х32. Качать вам нужно файлик numpy‑1.9.2+mkl‑cp35‑none‑win32.whl . И да — изменять имя файла не нужно.
1 |
6 / 6 / 0 Регистрация: 06.03.2014 Сообщений: 108 |
|
20.09.2015, 23:48 [ТС] |
14 |
Zuzik спасибо вам добрый человек)
0 |