Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
104 views
in Technique[技术] by (71.8m points)

python - Numpy Does Not Install

I’m basically trying to install Pandas, but to do that I’m supposedly supposed to be installing Numpy.

I type this into the terminal:

pip install numpy

And I get an error which basically says I need Microsoft Visual Studio C++ 14.0. After I downloaded it from the link it provided, I have absolutely no idea how to work with it. I’ve tried to use a YouTube tutorial on how to use Visual Studio, but when they create a project I don’t have any of their options. The only option I have is to create a blank solution.

If the rest of the error message is necessary please alert me of that, I’ve only started to work with Python for a couple months, so I’m not very experienced.

Error Message:

(venv) C:UserspcPycharmProjectsTutorials>pip install numpy
Collecting numpy
  Using cached https://files.pythonhosted.org/packages/84/1e/ff467ac56bfeaea51d4a2e72d315c1fe440b20192fea7e460f0f248acac8/numpy-1.18.2.zip
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... error
    Complete output from command C:UserspcPycharmProjectsTutorialsvenvScriptspython.exe C:UserspcPycharmProjectsTutorialsvenvlibsite-packagespip-19.0.3-py3.8.eggpip\_vendorpep517\_in_process.py prepare_meta
data_for_build_wheel C:UserspcAppDataLocalTempmp7lo0j8qw:
    Processing numpy/random\_bounded_integers.pxd.in
    Processing numpy/randommtrand.pyx
    Processing numpy/random\_bit_generator.pyx
    Processing numpy/random\_bounded_integers.pyx.in
    Processing numpy/random\_common.pyx
    Processing numpy/random\_generator.pyx
    Processing numpy/random\_mt19937.pyx
    Processing numpy/random\_pcg64.pyx
    Processing numpy/random\_philox.pyx
    Processing numpy/random\_sfc64.pyx
    Cythonizing sources
    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\pc\PycharmProjects\Tutorials\venv\lib', 'C:\']
      NOT AVAILABLE

    blis_info:
      libraries blis not found in ['C:\Users\pc\PycharmProjects\Tutorials\venv\lib', 'C:\']
      NOT AVAILABLE

    openblas_info:
      libraries openblas not found in ['C:\Users\pc\PycharmProjects\Tutorials\venv\lib', 'C:\']
    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
      libraries tatlas not found in ['C:\Users\pc\PycharmProjects\Tutorials\venv\lib', 'C:\']
      NOT AVAILABLE

    atlas_3_10_blas_info:
      libraries satlas not found in ['C:\Users\pc\PycharmProjects\Tutorials\venv\lib', 'C:\']
      NOT AVAILABLE

    atlas_blas_threads_info:
    Setting PTATLAS=ATLAS
      libraries ptf77blas,ptcblas,atlas not found in ['C:\Users\pc\PycharmProjects\Tutorials\venv\lib', 'C:\']
      NOT AVAILABLE

    atlas_blas_info:
      libraries f77blas,cblas,atlas not found in ['C:\Users\pc\PycharmProjects\Tutorials\venv\lib', 'C:\']
      NOT AVAILABLE

    accelerate_info:
      NOT AVAILABLE

    blas_info:
      libraries blas not found in ['C:\Users\pc\PycharmProjects\Tutorials\venv\lib', 'C:\']
      NOT AVAILABLE

    blas_src_info:
      NOT AVAILABLE

      NOT AVAILABLE

    non-existing path in 'numpy\distutils': 'site.cfg'
    lapack_opt_info:
    lapack_mkl_info:
      libraries mkl_rt not found in ['C:\Users\pc\PycharmProjects\Tutorials\venv\lib', 'C:\']
      NOT AVAILABLE

    openblas_lapack_info:
      libraries openblas not found in ['C:\Users\pc\PycharmProjects\Tutorials\venv\lib', 'C:\']
      NOT AVAILABLE

    openblas_clapack_info:
      libraries openblas,lapack not found in ['C:\Users\pc\PycharmProjects\Tutorials\venv\lib', 'C:\']
      NOT AVAILABLE

    flame_info:
      libraries flame not found in ['C:\Users\pc\PycharmProjects\Tutorials\venv\lib', 'C:\']
      NOT AVAILABLE

    atlas_3_10_threads_info:
    Setting PTATLAS=ATLAS
      libraries lapack_atlas not found in C:UserspcPycharmProjectsTutorialsvenvlib
      libraries tatlas,tatlas not found in C:UserspcPycharmProjectsTutorialsvenvlib
      libraries lapack_atlas not found in C:
      libraries tatlas,tatlas not found in C:
    <class 'numpy.distutils.system_info.atlas_3_10_threads_info'>
      NOT AVAILABLE

    atlas_3_10_info:
      libraries lapack_atlas not found in C:UserspcPycharmProjectsTutorialsvenvlib
      libraries satlas,satlas not found in C:UserspcPycharmProjectsTutorialsvenvlib
      libraries lapack_atlas not found in C:
      libraries satlas,satlas not found in C:
    <class 'numpy.distutils.system_info.atlas_3_10_info'>
      NOT AVAILABLE

    atlas_threads_info:
    Setting PTATLAS=ATLAS
      libraries lapack_atlas not found in C:UserspcPycharmProjectsTutorialsvenvlib
      libraries ptf77blas,ptcblas,atlas not found in C:UserspcPycharmProjectsTutorialsvenvlib
      libraries lapack_atlas not found in C:
      libraries ptf77blas,ptcblas,atlas not found in C:
    <class 'numpy.distutils.system_info.atlas_threads_info'>
      NOT AVAILABLE

    atlas_info:
      libraries lapack_atlas not found in C:UserspcPycharmProjectsTutorialsvenvlib
      libraries f77blas,cblas,atlas not found in C:UserspcPycharmProjectsTutorialsvenvlib
      libraries lapack_atlas not found in C:
      libraries f77blas,cblas,atlas not found in C:
    <class 'numpy.distutils.system_info.atlas_info'>
      NOT AVAILABLE

    lapack_info:
      libraries lapack not found in ['C:\Users\pc\PycharmProjects\Tutorials\venv\lib', 'C:\']
      NOT AVAILABLE

    lapack_src_info:
      NOT AVAILABLE

      NOT AVAILABLE

    running dist_info
    running build_src
    build_src
    building py_modules sources
    creating build
    creating buildsrc.win-amd64-3.8
    creating buildsrc.win-amd64-3.8
umpy
    creating buildsrc.win-amd64-3.8
umpydistutils
    building library "npymath" sources
    Running from numpy source directory.
    setup.py:461: UserWarning: Unrecognized setuptools command, proceeding with generating Cython sources and expanding templates
      run_build = parse_setuppy_commands()
    C:UserspcAppDataLocalTemppip-install-az7mvo02
umpy
umpydistutilssystem_info.py:1896: UserWarning:
        Optimized (vendor) Blas libraries are not found.
        Falls back to netlib Blas library which has worse performance.
        A better performance should be easily gained by switching
        Blas library.
      if self._calc_info(blas):
    C:UserspcAppDataLocalTemppip-install-az7mvo02
umpy
umpydistutilssystem_info.py:1896: 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.
      if self._calc_info(blas):
    C:UserspcAppDataLocalTemppip-install-az7mvo02
umpy
umpydistutilssystem_info.py:1896: 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.
      if self._calc_info(blas):
    C:UserspcAppDataLocalTemppip-install-az7mvo02
umpy
umpydistutilssystem_info.py:1730: 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.
      return getattr(self, '_calc_info_{}'.format(name))()
    C:UserspcAppDataLocalTemppip-install-az7mvo02
umpy
umpydistutilssystem_info.py:1730: 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.
      return getattr(self, '_calc_info_{}'.format(name))()
    C:UserspcAppDataLocalProgramsPythonPython38libdistutilsdist.py:274: UserWarning: Unknown distribution option: 'define_macros'
      warnings.warn(msg)
    error: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/

    ----------------------------------------
Command "C:UserspcPycharmProjectsTutorialsvenvScriptspython.exe C:UserspcPycharmProjectsTutorialsvenvlibsite-packagespip-19.0.3-py3.8.eggpip\_vendorpep517\_in_process.py prepare_metadata_for_build_wheel C:
UserspcAppDataLocalTempmp7lo0j8qw" failed with error code 1 in C:UserspcAppDataLocalTemppip-install-az7mvo02
umpy

Error when upgrading pip:

(venv) C:UserspcPycharmProjectsTutorials>python -m pip install --upgrade pip
Collecting pip
  Downloading https://files.pythonhosted.org/packages/54/0c/d01aa759fdc501a58f431eb594a17495f15b88da142ce14b5845662c13f3/pip-20.0.2-py2.py3-none-any.whl (1.4MB)
    100% |████████████████████████████████| 1.4MB 2.2MB/s
Installing collected packages: pip
  Found existing installation: pip 19.0.3
    Uninstalling pip-19.0.3:
      Successfully uninstalled pip-19.0.3
  Rolling back uninstall of pip
  Moving to c:userspcpycharmprojectsutorialsvenvlibsite-packagespip-19.0.3-py3.8.egg
   from C:UserspcPycharmProjectsTutorialsvenvLibsite-packages~ip-19.0.3-py3.8.egg
  Moving to c:userspcpycharmprojectsutorialsvenvscriptspip-script.py
   from C:UserspcAppDataLocalTemppip-uninstall-hqx4h1fbpip-script.py
  Moving to c:userspcpycharmprojectsutorialsvenvscriptspip.exe
   from C:UserspcAppDataLocalTemppip-uninstall-hqx4h1fbpip.exe
  Moving to c:userspcpycharmprojectsutorialsvenvscriptspip3-script.py
   from C:UserspcAppDataLocalTemppip-uninstall-hqx4h1fbpip3-script.py
  Moving to c:userspcpycharmprojectsutorialsvenvscriptspip3.8-script.py
   from C:UserspcAppDataLocalTemppip-uninstall-hqx4h1fbpip3.8-script.py
  Moving to c:userspcpycharmprojectsutorialsvenvscriptspip3.8.exe
   from C:UserspcAppDataLocalTemppip-uninstall-hqx4h1fbpip3.8.exe
  Moving to c:userspcpycharmprojectsutorialsvenvscriptspip3.exe
   from C:UserspcAppDataLocalTemppip-uninstall-hqx4h1fbpip3.exe
Exception:
Traceback (most recent call last):
  File "C:UserspcPycharmProjectsTutorialsvenvlibsite-packagespip-19.0.3-py3.8.eggpip\_internalcliase_command.py", line 179, in main
    status = self.run(options, args)
  File "C:UserspcPycharmProjectsTutorialsvenvlibsite-packagespip-19.0.3-py3.8.eggpip\_internalcommandsinstall.py", line 384, in run
    installed = install_given_reqs(
  File "C:UserspcPycharmProjectsTutorialsvenvlibsite-packagespip-19.0.3-py3.8.eggpip\_int

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Got a couple options:

1) Download the Binary from Unofficial Windows Binaries for Python Extension Packages

For projects which don’t provide their own Windows installers (and even some which do), Christoph Gohlke at the University of California provides a collection of Windows installers. Many Python users on Windows have reported a positive experience with these prebuilt versions. Source

https://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy

Search for and download:

numpy?1.18.2+mkl?cp38?cp38?win_amd64.whl

Open terminal, activate your env, and install (change the path to where file downloaded):

pip install C:Userspcdownloads
umpy?1.18.2+mkl?cp38?cp38?win_amd64.whl

2) Since you are using Windows (like I do), I would highly recommend taking advantage of Anaconda distribution of Python. Will save you a lot of time in the long run. Basically, it install the binary packages rather than requiring you to compile resources using pip.

Since you are using Pycharm, after you install Anaconda, go back to Pycharm, create a new environment using Conda and then pip install numpy.

3) Try to Compile (Good Luck)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

56.9k users

...