Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Bug Unable to install mlagents due to errors with NumPy and Microsoft Visual Studio C++

Discussion in 'ML-Agents' started by bobbete, Jan 15, 2023.

  1. bobbete


    Dec 1, 2018
    I've been trying to install mlagents without success for a full day, but nothing I do works to bypass this error message. I am trying to install it on a virtual environment on a Windows 10, using Python 3.10.8, NumPy 1.22.4, PyTorch 1.13.1. I don't understand the error because I have a different versionof NumPy than the one the error says. And I also installed Visual Studio C++, which is an error at the end. Any help is appreciated, thanks :)

    Code (CSharp):
    1. Building wheels for collected packages: numpy
    2.   Building wheel for numpy (pyproject.toml) ... error
    3.   error: subprocess-exited-with-error
    5.   × Building wheel for numpy (pyproject.toml) did not run successfully.
    6.   │ exit code: 1
    7.   ╰─> [198 lines of output]
    8. RuntimeWarning: NumPy 1.21.2 may not yet support Python 3.10.
    9.         warnings.warn(
    10.       Running from numpy source directory.
    11.       Processing numpy/random\
    12.       Processing numpy/random\bit_generator.pyx
    13.       Processing numpy/random\mtrand.pyx
    14.       Processing numpy/random\
    15.       Processing numpy/random\_common.pyx
    16.       Processing numpy/random\_generator.pyx
    17.       Processing numpy/random\_mt19937.pyx
    18.       Processing numpy/random\_pcg64.pyx
    19.       Processing numpy/random\_philox.pyx
    20.       Processing numpy/random\_sfc64.pyx
    21.       Cythonizing sources
    22.       blas_opt_info:
    23.       blas_mkl_info:
    24.       No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
    25.       customize MSVCCompiler
    26.         libraries mkl_rt not found in ['D:\\Unity\\ReinforcementLeaning_InfoProject\\venv\\lib', 'C:\\']
    27.         NOT AVAILABLE
    29.       blis_info:
    30.         libraries blis not found in ['D:\\Unity\\ReinforcementLeaning_InfoProject\\venv\\lib', 'C:\\']
    31.         NOT AVAILABLE
    33.       openblas_info:
    34.         libraries openblas not found in ['D:\\Unity\\ReinforcementLeaning_InfoProject\\venv\\lib', 'C:\\']
    35.       get_default_fcompiler: matching types: '['gnu', 'intelv', 'absoft', 'compaqv', 'intelev', 'gnu95', 'g95', 'intelvem', 'intelem', 'flang']'
    36.       customize GnuFCompiler
    37.       Could not locate executable g77
    38.       Could not locate executable f77
    39.       customize IntelVisualFCompiler
    40.       Could not locate executable ifort
    41.       Could not locate executable ifl
    42.       customize AbsoftFCompiler
    43.       Could not locate executable f90
    44.       customize CompaqVisualFCompiler
    45.       Could not locate executable DF
    46.       customize IntelItaniumVisualFCompiler
    47.       Could not locate executable efl
    48.       customize Gnu95FCompiler
    49.       Could not locate executable gfortran
    50.       Could not locate executable f95
    51.       customize G95FCompiler
    52.       Could not locate executable g95
    53.       customize IntelEM64VisualFCompiler
    54.       customize IntelEM64TFCompiler
    55.       Could not locate executable efort
    56.       Could not locate executable efc
    57.       customize PGroupFlangCompiler
    58.       Could not locate executable flang
    59.       don't know how to compile Fortran code on platform 'nt'
    60.        NOT AVAILABLE
    62.      accelerate_info:
    63.        NOT AVAILABLE
    65.      atlas_3_10_blas_threads_info:
    66.      Setting PTATLAS=ATLAS
    67.        libraries tatlas not found in ['D:\\Unity\\ReinforcementLeaning_InfoProject\\venv\\lib', 'C:\\']
    68.        NOT AVAILABLE
    70.      atlas_3_10_blas_info:
    71.        libraries satlas not found in ['D:\\Unity\\ReinforcementLeaning_InfoProject\\venv\\lib', 'C:\\']
    72.        NOT AVAILABLE
    74.      atlas_blas_threads_info:
    75.      Setting PTATLAS=ATLAS
    76.        libraries ptf77blas,ptcblas,atlas not found in ['D:\\Unity\\ReinforcementLeaning_InfoProject\\venv\\lib', 'C:\\']
    77.        NOT AVAILABLE
    79.      atlas_blas_info:
    80.        libraries f77blas,cblas,atlas not found in ['D:\\Unity\\ReinforcementLeaning_InfoProject\\venv\\lib', 'C:\\']
    81.        NOT AVAILABLE
    83.      C:\Users\GorillaPenguin\AppData\Local\Temp\pip-install-dtzunq9p\numpy_77a55582e5d344b497a4063966d72ff1\numpy\distutils\ UserWarning:
    84.          Optimized (vendor) Blas libraries are not found.
    85.          Falls back to netlib Blas library which has worse performance.
    86.          A better performance should be easily gained by switching
    87.          Blas library.
    88.        if self._calc_info(blas):
    89.      blas_info:
    90.        libraries blas not found in ['D:\\Unity\\ReinforcementLeaning_InfoProject\\venv\\lib', 'C:\\']
    91.        NOT AVAILABLE
    93.      C:\Users\GorillaPenguin\AppData\Local\Temp\pip-install-dtzunq9p\numpy_77a55582e5d344b497a4063966d72ff1\numpy\distutils\ UserWarning:
    94.          Blas ( libraries not found.
    95.          Directories to search for the libraries can be specified in the
    96.          numpy/distutils/site.cfg file (section [blas]) or by setting
    97.          the BLAS environment variable.
    98.        if self._calc_info(blas):
    99.      blas_src_info:
    100.        NOT AVAILABLE
    102.      C:\Users\GorillaPenguin\AppData\Local\Temp\pip-install-dtzunq9p\numpy_77a55582e5d344b497a4063966d72ff1\numpy\distutils\ UserWarning:
    103.          Blas ( sources not found.
    104.          Directories to search for the sources can be specified in the
    105.          numpy/distutils/site.cfg file (section [blas_src]) or by setting
    106.          the BLAS_SRC environment variable.
    107.        if self._calc_info(blas):
    108.        NOT AVAILABLE
    110.      non-existing path in 'numpy\\distutils': 'site.cfg'
    111.      lapack_opt_info:
    112.      lapack_mkl_info:
    113.        libraries mkl_rt not found in ['D:\\Unity\\ReinforcementLeaning_InfoProject\\venv\\lib', 'C:\\']
    114.        NOT AVAILABLE
    116.      openblas_lapack_info:
    117.        libraries openblas not found in ['D:\\Unity\\ReinforcementLeaning_InfoProject\\venv\\lib', 'C:\\']
    118.        NOT AVAILABLE
    120.      openblas_clapack_info:
    121.        libraries openblas,lapack not found in ['D:\\Unity\\ReinforcementLeaning_InfoProject\\venv\\lib', 'C:\\']
    122.        NOT AVAILABLE
    124.      flame_info:
    125.        libraries flame not found in ['D:\\Unity\\ReinforcementLeaning_InfoProject\\venv\\lib', 'C:\\']
    126.        NOT AVAILABLE
    128.      atlas_3_10_threads_info:
    129.      Setting PTATLAS=ATLAS
    130.        libraries lapack_atlas not found in D:\Unity\ReinforcementLeaning_InfoProject\venv\lib
    131.        libraries tatlas,tatlas not found in D:\Unity\ReinforcementLeaning_InfoProject\venv\lib
    132.        libraries lapack_atlas not found in C:\
    133.        libraries tatlas,tatlas not found in C:\
    134.      <class 'numpy.distutils.system_info.atlas_3_10_threads_info'>
    135.        NOT AVAILABLE
    137.      atlas_3_10_info:
    138.        libraries lapack_atlas not found in D:\Unity\ReinforcementLeaning_InfoProject\venv\lib
    139.        libraries satlas,satlas not found in D:\Unity\ReinforcementLeaning_InfoProject\venv\lib
    140.        libraries lapack_atlas not found in C:\
    141.        libraries satlas,satlas not found in C:\
    142.      <class 'numpy.distutils.system_info.atlas_3_10_info'>
    143.        NOT AVAILABLE
    145.      atlas_threads_info:
    146.      Setting PTATLAS=ATLAS
    147.        libraries lapack_atlas not found in D:\Unity\ReinforcementLeaning_InfoProject\venv\lib
    148.        libraries ptf77blas,ptcblas,atlas not found in D:\Unity\ReinforcementLeaning_InfoProject\venv\lib
    149.        libraries lapack_atlas not found in C:\
    150.        libraries ptf77blas,ptcblas,atlas not found in C:\
    151.      <class 'numpy.distutils.system_info.atlas_threads_info'>
    152.        NOT AVAILABLE
    154.      atlas_info:
    155.        libraries lapack_atlas not found in D:\Unity\ReinforcementLeaning_InfoProject\venv\lib
    156.        libraries f77blas,cblas,atlas not found in D:\Unity\ReinforcementLeaning_InfoProject\venv\lib
    157.        libraries lapack_atlas not found in C:\
    158.        libraries f77blas,cblas,atlas not found in C:\
    159.      <class 'numpy.distutils.system_info.atlas_info'>
    160.        NOT AVAILABLE
    162.      lapack_info:
    163.        libraries lapack not found in ['D:\\Unity\\ReinforcementLeaning_InfoProject\\venv\\lib', 'C:\\']
    164.        NOT AVAILABLE
    166.      C:\Users\GorillaPenguin\AppData\Local\Temp\pip-install-dtzunq9p\numpy_77a55582e5d344b497a4063966d72ff1\numpy\distutils\ UserWarning:
    167.          Lapack ( libraries not found.
    168.          Directories to search for the libraries can be specified in the
    169.          numpy/distutils/site.cfg file (section [lapack]) or by setting
    170.          the LAPACK environment variable.
    171.        return getattr(self, '_calc_info_{}'.format(name))()
    172.      lapack_src_info:
    173.        NOT AVAILABLE
    175.      C:\Users\GorillaPenguin\AppData\Local\Temp\pip-install-dtzunq9p\numpy_77a55582e5d344b497a4063966d72ff1\numpy\distutils\ UserWarning:
    176.          Lapack ( sources not found.
    177.          Directories to search for the sources can be specified in the
    178.          numpy/distutils/site.cfg file (section [lapack_src]) or by setting
    179.          the LAPACK_SRC environment variable.
    180.        return getattr(self, '_calc_info_{}'.format(name))()
    181.        NOT AVAILABLE
    183.      numpy_linalg_lapack_lite:
    184.        FOUND:
    185.          language = c
    186.          define_macros = [('HAVE_BLAS_ILP64', None), ('BLAS_SYMBOL_SUFFIX', '64_')]
    188.      Warning: attempted relative import with no known parent package
    189.      C:\Users\GorillaPenguin\AppData\Local\Temp\pip-build-env-lxfte5ec\overlay\Lib\site-packages\setuptools\_distutils\ UserWarning: Unknown distribution option: 'define_macros'
    190.        warnings.warn(msg)
    191.      running bdist_wheel
    192.      running build
    193.      running config_cc
    194.      unifing config_cc, config, build_clib, build_ext, build commands --compiler options
    195.      running config_fc
    196.      unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options
    197.      running build_src
    198.      build_src
    199.      building py_modules sources
    200.      creating build
    201.      creating build\
    202.      creating build\\numpy
    203.      creating build\\numpy\distutils
    204.      building library "npymath" sources
    205.      error: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio":
    206.      [end of output]
    208.  note: This error originates from a subprocess, and is likely not a problem with pip.
    209.  ERROR: Failed building wheel for numpy
    210. Failed to build numpy
    211. ERROR: Could not build wheels for numpy, which is required to install pyproject.toml-based projects
  2. bobbete


    Dec 1, 2018
    I have fixed it by uninstalling everything and following the official installation tutorial using Python 3.9
    hughperkins likes this.
  3. JustnTrying


    Sep 24, 2021
    This is a known bug, and a fix is hopefully soon merged and deployed
  4. sambutle


    Sep 6, 2022
    When attempting a relative import in Python, you may encounter an error message that says "attempted relative import with no known parent package." This error message is usually triggered when you are trying to import a module from a package using a relative import, but the package's name is not recognized by Python as a valid package.

    To fix this error, you need to make sure that the module being imported is part of a package, and that the package is on the Python path. You can do this by adding an empty file to the package's directory, and by making sure that the directory containing the package is on the Python path.

    Also, you can try one or more of the following solutions:
    • Use an absolute import instead of a relative import.
    • Ensure that the package's name is spelled correctly and that the package is located in a directory that Python can find.
    • Make sure that the package's directory contains an file, which is required for Python to recognize the directory as a package.
    • Check that you are running your Python script or program from the correct directory, which contains the package you are trying to import.
    • Consider restructuring your project to avoid using relative imports altogether.