安装

试着把pip 改成 pip3, pip3 默认安装python3.x 的包

Windows10,python3.8,conda11.2安装 mxnet出现的环境问题,请问大家如何解决?
似乎是mxnet与conda11.2的版本不兼容,但是conda降版本又会带来其他的配置问题,能否在不降其版本的情况下进行配置?

在安装d2l的时候报错了

ERROR: Could not find a version that satisfies the requirement numpy==1.18.5 (from d2l)

有人遇到这个问题吗


问题暂时解决了:
该报错是在python3.9环境下出现的
更换python换为3.8之后就可以正常使用了

AMD显卡,没办法安装cuda,那怎么带GPU呢

请问您解决了吗?我用的VScode打开jupyter,也遇到了这样的渲染问题。

经过尝试,独立显卡版安装的安装命令会出错,建议使用官网的命令选择适合的版本来安装。

地址为:


2022.1.26时长期支持版的独立显卡安装命令如下:
conda install pytorch torchvision torchaudio cudatoolkit=10.2 -c pytorch-lts

注意:在安装时,我配置了清华源,但是链接好像还是走了conda的源,不过如果conda官方源安装失败,可以更换成清华源的链接

%MU`8F)ZFT$ZF~6D%53X
请问这个问题应该怎么解决

请问有没有一个关于如何在colab上搭建环境的教程呀,超级感谢!!!

2 Likes

https://www.yuque.com/docs/share/74ef2801-8acc-4bc5-88b4-0dde22acb4c6?#(密码:yhm4) 《03 安装》 制作了一个Docker版本教程

m1 mac , conda python3.8 环境下安装 d2l 报错, 有几页的log,节选如下
有人遇到过么

pip3 install d2l
Collecting d2l
Using cached d2l-0.17.3-py3-none-any.whl (82 kB)
Collecting requests==2.25.1
Using cached requests-2.25.1-py2.py3-none-any.whl (61 kB)
Collecting numpy==1.18.5
Using cached numpy-1.18.5.zip (5.4 MB)
Installing build dependencies … done
Getting requirements to build wheel … done
Preparing metadata (pyproject.toml) … done
Collecting matplotlib==3.3.3
Using cached matplotlib-3.3.3.tar.gz (37.9 MB)
Preparing metadata (setup.py) … done
Collecting jupyter==1.0.0
Using cached jupyter-1.0.0-py2.py3-none-any.whl (2.7 kB)
Collecting pandas==1.2.2
Using cached pandas-1.2.2.tar.gz (5.5 MB)
Installing build dependencies … error
error: subprocess-exited-with-error

× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> [3382 lines of output]
Ignoring numpy: markers ‘python_version == “3.7” and platform_system != “AIX”’ don’t match your environment
Ignoring numpy: markers ‘python_version == “3.7” and platform_system == “AIX”’ don’t match your environment
Ignoring numpy: markers ‘python_version == “3.8” and platform_system == “AIX”’ don’t match your environment
Ignoring numpy: markers ‘python_version >= “3.9”’ don’t match your environment
Collecting setuptools
Using cached setuptools-60.8.1-py3-none-any.whl (1.1 MB)
Collecting wheel
Using cached wheel-0.37.1-py2.py3-none-any.whl (35 kB)
Collecting Cython<3,>=0.29.21
Using cached Cython-0.29.27-py2.py3-none-any.whl (983 kB)
Collecting numpy==1.17.3
Using cached numpy-1.17.3.zip (6.4 MB)
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status ‘done’
Building wheels for collected packages: numpy
Building wheel for numpy (setup.py): started
Building wheel for numpy (setup.py): finished with status ‘error’
error: subprocess-exited-with-error

    × python setup.py bdist_wheel did not run successfully.
    │ exit code: 1
    ╰─> [3012 lines of output]
        Running from numpy source directory.
        blas_opt_info:
        blas_mkl_info:
        customize UnixCCompiler
          libraries mkl_rt not found in ['/opt/homebrew/Caskroom/miniforge/base/envs/d2l/lib', '/usr/local/lib', '/usr/lib']
          NOT AVAILABLE
  
        blis_info:
        customize UnixCCompiler
          libraries blis not found in ['/opt/homebrew/Caskroom/miniforge/base/envs/d2l/lib', '/usr/local/lib', '/usr/lib']
          NOT AVAILABLE
  
        openblas_info:
        customize UnixCCompiler
        customize UnixCCompiler
          libraries openblas not found in ['/opt/homebrew/Caskroom/miniforge/base/envs/d2l/lib', '/usr/local/lib', '/usr/lib']
          NOT AVAILABLE
  
        atlas_3_10_blas_threads_info:
        Setting PTATLAS=ATLAS
        customize UnixCCompiler
          libraries tatlas not found in ['/opt/homebrew/Caskroom/miniforge/base/envs/d2l/lib', '/usr/local/lib', '/usr/lib']
          NOT AVAILABLE
  
        atlas_3_10_blas_info:
        customize UnixCCompiler
          libraries satlas not found in ['/opt/homebrew/Caskroom/miniforge/base/envs/d2l/lib', '/usr/local/lib', '/usr/lib']
          NOT AVAILABLE
  
        atlas_blas_threads_info:
        Setting PTATLAS=ATLAS
        customize UnixCCompiler
          libraries ptf77blas,ptcblas,atlas not found in ['/opt/homebrew/Caskroom/miniforge/base/envs/d2l/lib', '/usr/local/lib', '/usr/lib']
          NOT AVAILABLE
  
        atlas_blas_info:
        customize UnixCCompiler
          libraries f77blas,cblas,atlas not found in ['/opt/homebrew/Caskroom/miniforge/base/envs/d2l/lib', '/usr/local/lib', '/usr/lib']
          NOT AVAILABLE
  
        accelerate_info:
        customize UnixCCompiler
          libraries accelerate not found in ['/opt/homebrew/Caskroom/miniforge/base/envs/d2l/lib', '/usr/local/lib', '/usr/lib']
        Library accelerate was not found. Ignoring
        customize UnixCCompiler
          libraries veclib not found in ['/opt/homebrew/Caskroom/miniforge/base/envs/d2l/lib', '/usr/local/lib', '/usr/lib']
        Library veclib was not found. Ignoring
          FOUND:
            extra_compile_args = ['-faltivec', '-I/System/Library/Frameworks/vecLib.framework/Headers']
            extra_link_args = ['-Wl,-framework', '-Wl,Accelerate']
            define_macros = [('NO_ATLAS_INFO', 3), ('HAVE_CBLAS', None)]
  
          FOUND:
            extra_compile_args = ['-faltivec', '-I/System/Library/Frameworks/vecLib.framework/Headers']
            extra_link_args = ['-Wl,-framework', '-Wl,Accelerate']
            define_macros = [('NO_ATLAS_INFO', 3), ('HAVE_CBLAS', None)]
  
        /bin/sh: svnversion: command not found
        non-existing path in 'numpy/distutils': 'site.cfg'
        lapack_opt_info:
        lapack_mkl_info:
        customize UnixCCompiler
          libraries mkl_rt not found in ['/opt/homebrew/Caskroom/miniforge/base/envs/d2l/lib', '/usr/local/lib', '/usr/lib']
          NOT AVAILABLE
  
        openblas_lapack_info:
        customize UnixCCompiler
        customize UnixCCompiler
          libraries openblas not found in ['/opt/homebrew/Caskroom/miniforge/base/envs/d2l/lib', '/usr/local/lib', '/usr/lib']
          NOT AVAILABLE
  
        openblas_clapack_info:
        customize UnixCCompiler
        customize UnixCCompiler
          libraries openblas,lapack not found in ['/opt/homebrew/Caskroom/miniforge/base/envs/d2l/lib', '/usr/local/lib', '/usr/lib']
          NOT AVAILABLE
  
        flame_info:
        customize UnixCCompiler
          libraries flame not found in ['/opt/homebrew/Caskroom/miniforge/base/envs/d2l/lib', '/usr/local/lib', '/usr/lib']
          NOT AVAILABLE
  
        atlas_3_10_threads_info:
        Setting PTATLAS=ATLAS
        customize UnixCCompiler
          libraries lapack_atlas not found in /opt/homebrew/Caskroom/miniforge/base/envs/d2l/lib
        customize UnixCCompiler
          libraries tatlas,tatlas not found in /opt/homebrew/Caskroom/miniforge/base/envs/d2l/lib
        customize UnixCCompiler
          libraries lapack_atlas not found in /usr/local/lib
        customize UnixCCompiler
          libraries tatlas,tatlas not found in /usr/local/lib
        customize UnixCCompiler
          libraries lapack_atlas not found in /usr/lib
        customize UnixCCompiler
          libraries tatlas,tatlas not found in /usr/lib
        <class 'numpy.distutils.system_info.atlas_3_10_threads_info'>
          NOT AVAILABLE
  
        atlas_3_10_info:
        customize UnixCCompiler
          libraries lapack_atlas not found in /opt/homebrew/Caskroom/miniforge/base/envs/d2l/lib
        customize UnixCCompiler
          libraries satlas,satlas not found in /opt/homebrew/Caskroom/miniforge/base/envs/d2l/lib
        customize UnixCCompiler
          libraries lapack_atlas not found in /usr/local/lib
        customize UnixCCompiler
          libraries satlas,satlas not found in /usr/local/lib
        customize UnixCCompiler
          libraries lapack_atlas not found in /usr/lib
        customize UnixCCompiler
          libraries satlas,satlas not found in /usr/lib
        <class 'numpy.distutils.system_info.atlas_3_10_info'>
          NOT AVAILABLE
  
        atlas_threads_info:
        Setting PTATLAS=ATLAS
        customize UnixCCompiler
          libraries lapack_atlas not found in /opt/homebrew/Caskroom/miniforge/base/envs/d2l/lib
        customize UnixCCompiler
          libraries ptf77blas,ptcblas,atlas not found in /opt/homebrew/Caskroom/miniforge/base/envs/d2l/lib
        customize UnixCCompiler
          libraries lapack_atlas not found in /usr/local/lib
        customize UnixCCompiler
          libraries ptf77blas,ptcblas,atlas not found in /usr/local/lib
        customize UnixCCompiler
          libraries lapack_atlas not found in /usr/lib
        customize UnixCCompiler
          libraries ptf77blas,ptcblas,atlas not found in /usr/lib
        <class 'numpy.distutils.system_info.atlas_threads_info'>
          NOT AVAILABLE
  
        atlas_info:
        customize UnixCCompiler
          libraries lapack_atlas not found in /opt/homebrew/Caskroom/miniforge/base/envs/d2l/lib
        customize UnixCCompiler
          libraries f77blas,cblas,atlas not found in /opt/homebrew/Caskroom/miniforge/base/envs/d2l/lib
        customize UnixCCompiler
          libraries lapack_atlas not found in /usr/local/lib
        customize UnixCCompiler
          libraries f77blas,cblas,atlas not found in /usr/local/lib
        customize UnixCCompiler
          libraries lapack_atlas not found in /usr/lib
        customize UnixCCompiler
          libraries f77blas,cblas,atlas not found in /usr/lib
        <class 'numpy.distutils.system_info.atlas_info'>
          NOT AVAILABLE
  
          FOUND:
            extra_compile_args = ['-faltivec', '-I/System/Library/Frameworks/vecLib.framework/Headers']
            extra_link_args = ['-Wl,-framework', '-Wl,Accelerate']
            define_macros = [('NO_ATLAS_INFO', 3), ('HAVE_CBLAS', None)]
  
        /opt/homebrew/Caskroom/miniforge/base/envs/d2l/lib/python3.8/site-packages/setuptools/_distutils/dist.py:275: 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
        building library "npymath" sources
        get_default_fcompiler: matching types: '['gnu95', 'nag', 'absoft', 'ibm', 'intel', 'gnu', 'g95', 'pg']'
        customize Gnu95FCompiler
        Found executable /opt/homebrew/bin/gfortran
        customize Gnu95FCompiler
        customize Gnu95FCompiler using config
        C compiler: gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/opt/homebrew/Caskroom/miniforge/base/envs/d2l/include -arch arm64 -I/opt/homebrew/Caskroom/miniforge/base/envs/d2l/include -arch arm64
  
        compile options: '-Inumpy/core/src/common -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/src/npysort -I/opt/homebrew/Caskroom/miniforge/base/envs/d2l/include/python3.8 -c'
        gcc: _configtest.c
        gcc _configtest.o -o _configtest
        success!
        removing: _configtest.c _configtest.o _configtest.o.d _configtest
        C compiler: gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/opt/homebrew/Caskroom/miniforge/base/envs/d2l/include -arch arm64 -I/opt/homebrew/Caskroom/miniforge/base/envs/d2l/include -arch arm64
  
        compile options: '-Inumpy/core/src/common -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/src/npysort -I/opt/homebrew/Caskroom/miniforge/base/envs/d2l/include/python3.8 -c'
        gcc: _configtest.c
        _configtest.c:1:5: warning: incompatible redeclaration of library function 'exp' [-Wincompatible-library-redeclaration]
        int exp (void);
            ^
        _configtest.c:1:5: note: 'exp' is a builtin with type 'double (double)'
        1 warning generated.
        gcc _configtest.o -o _configtest
        success!
        removing: _configtest.c _configtest.o _configtest.o.d _configtest
        conv_template:> build/src.macosx-11.0-arm64-3.8/numpy/core/src/npymath/npy_math_internal.h
          adding 'build/src.macosx-11.0-arm64-3.8/numpy/core/src/npymath' to include_dirs.
        conv_template:> build/src.macosx-11.0-arm64-3.8/numpy/core/src/npymath/ieee754.c
        conv_template:> build/src.macosx-11.0-arm64-3.8/numpy/core/src/npymath/npy_math_complex.c
        None - nothing done with h_files = ['build/src.macosx-11.0-arm64-3.8/numpy/core/src/npymath/npy_math_internal.h']
        building library "npysort" sources
        conv_template:> build/src.macosx-11.0-arm64-3.8/numpy/core/src/common/npy_sort.h
          adding 'build/src.macosx-11.0-arm64-3.8/numpy/core/src/common' to include_dirs.
        conv_template:> build/src.macosx-11.0-arm64-3.8/numpy/core/src/npysort/quicksort.c
        conv_template:> build/src.macosx-11.0-arm64-3.8/numpy/core/src/npysort/mergesort.c
        conv_template:> build/src.macosx-11.0-arm64-3.8/numpy/core/src/npysort/timsort.c
        conv_template:> build/src.macosx-11.0-arm64-3.8/numpy/core/src/npysort/heapsort.c
        conv_template:> build/src.macosx-11.0-arm64-3.8/numpy/core/src/npysort/radixsort.c
        conv_template:> build/src.macosx-11.0-arm64-3.8/numpy/core/src/common/npy_partition.h
        conv_template:> build/src.macosx-11.0-arm64-3.8/numpy/core/src/npysort/selection.c
        conv_template:> build/src.macosx-11.0-arm64-3.8/numpy/core/src/common/npy_binsearch.h
        conv_template:> build/src.macosx-11.0-arm64-3.8/numpy/core/src/npysort/binsearch.c
        None - nothing done with h_files = ['build/src.macosx-11.0-arm64-
  

        success!
        removing: _configtest.c _configtest.o _configtest.o.d _configtest
          adding 'build/src.macosx-11.0-arm64-3.8/numpy/core/src/npymath' to include_dirs.
        None - nothing done with h_files = ['build/src.macosx-11.0-arm64-3.8/numpy/core/src/npymath/npy_math_internal.h']
        building library "npysort" sources
          adding 'build/src.macosx-11.0-arm64-3.8/numpy/core/src/common' to include_dirs.
        None - nothing done with h_files = ['build/src.macosx-11.0-arm64-3.8/numpy/core/src/common/npy_sort.h', 'build/src.macosx-11.0-arm64-3.8/numpy/core/src/common/npy_partition.h', 'build/src.macosx-11.0-arm64-3.8/numpy/core/src/common/npy_binsearch.h']
        building extension "numpy.core._dummy" sources
          adding 'build/src.macosx-11.0-arm64-3.8/numpy/core/include/numpy/config.h' to sources.
          adding 'build/src.macosx-11.0-arm64-3.8/numpy/core/include/numpy/_numpyconfig.h' to sources.
        executing numpy/core/code_generators/generate_numpy_api.py
          adding 'build/src.macosx-11.0-arm64-3.8/numpy/core/include/numpy/__multiarray_api.h' to sources.
        numpy.core - nothing done with h_files = ['build/src.macosx-11.0-arm64-3.8/numpy/core/include/numpy/config.h', 'build/src.macosx-11.0-arm64-3.8/numpy/core/include/numpy/_numpyconfig.h', 'build/src.macosx-11.0-arm64-3.8/numpy/core/include/numpy/__multiarray_api.h']
        building extension "numpy.core._multiarray_tests" sources
        building extension "numpy.core._multiarray_umath" sources
          adding 'build/src.macosx-11.0-arm64-3.8/numpy/core/include/numpy/config.h' to sources.
          adding 'build/src.macosx-11.0-arm64-3.8/numpy/core/include/numpy/_numpyconfig.h' to sources.
        executing numpy/core/code_generators/generate_numpy_api.py
          adding 'build/src.macosx-11.0-arm64-3.8/numpy/core/include/numpy/__multiarray_api.h' to sources.
        executing numpy/core/code_generators/generate_ufunc_api.py
          adding 'build/src.macosx-11.0-arm64-3.8/numpy/core/include/numpy/__ufunc_api.h' to sources.
          adding 'build/src.macosx-11.0-arm64-3.8/numpy/core/src/umath' to include_dirs.
          adding 'build/src.macosx-11.0-arm64-3.8/numpy/core/src/npymath' to include_dirs.
          adding 'build/src.macosx-11.0-arm64-3.8/numpy/core/src/common' to include_dirs.
        numpy.core - nothing done with h_files = ['build/src.macosx-11.0-arm64-3.8/numpy/core/src/umath/funcs.inc', 'build/src.macosx-11.0-arm64-3.8/numpy/core/src/umath/simd.inc', 'build/src.macosx-11.0-arm64-3.8/numpy/core/src/umath/loops.h', 'build/src.macosx-11.0-arm64-3.8/numpy/core/src/umath/matmul.h', 'build/src.macosx-11.0-arm64-3.8/numpy/core/src/umath/clip.h', 'build/src.macosx-11.0-arm64-3.8/numpy/core/src/npymath/npy_math_internal.h', 'build/src.macosx-11.0-arm64-3.8/numpy/core/src/common/templ_common.h', 'build/src.macosx-11.0-arm64-3.8/numpy/core/include/numpy/config.h', 'build/src.macosx-11.0-arm64-3.8/numpy/core/include/numpy/_numpyconfig.h', 'build/src.macosx-11.0-arm64-3.8/numpy/core/include/numpy/__multiarray_api.h', 'build/src.macosx-11.0-arm64-3.8/numpy/core/include/numpy/__ufunc_api.h']
        building extension "numpy.core._umath_tests" sources
        building extension "numpy.core._rational_tests" sources
        building extension "numpy.core._struct_ufunc_tests" sources
        building extension "numpy.core._operand_flag_tests" sources
        building extension "numpy.fft._pocketfft_internal" sources
        building extension "numpy.linalg.lapack_lite" sources
          adding 'numpy/linalg/lapack_lite/python_xerbla.c' to sources.
        building extension "numpy.linalg._umath_linalg" sources
          adding 'numpy/linalg/lapack_lite/python_xerbla.c' to sources.
        building extension "numpy.random.mt19937" sources
        building extension "numpy.random.philox" sources
        building extension "numpy.random.pcg64" sources
        building extension "numpy.random.sfc64" sources
        building extension "numpy.random.common" sources
        building extension "numpy.random.bit_generator" sources
        building extension "numpy.random.generator" sources
        building extension "numpy.random.bounded_integers" sources
        building extension "numpy.random.mtrand" sources
        building data_files sources
        build_src: building npy-pkg config files
        running build_py
        running build_clib
        customize UnixCCompiler
        customize UnixCCompiler using build_clib
        running build_ext
        customize UnixCCompiler
        customize UnixCCompiler using build_ext
        building 'numpy.core._multiarray_umath' extension
        compiling C sources
        C compiler: gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/opt/homebrew/Caskroom/miniforge/base/envs/d2l/include -arch arm64 -I/opt/homebrew/Caskroom/miniforge/base/envs/d2l/include -arch arm64
  
        compile options: '-DNPY_INTERNAL_BUILD=1 -DHAVE_NPY_CONFIG_H=1 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -DNO_ATLAS_INFO=3 -DHAVE_CBLAS -Ibuild/src.macosx-11.0-arm64-3.8/numpy/core/src/umath -Ibuild/src.macosx-11.0-arm64-3.8/numpy/core/src/npymath -Ibuild/src.macosx-11.0-arm64-3.8/numpy/core/src/common -Inumpy/core/include -Ibuild/src.macosx-11.0-arm64-3.8/numpy/core/include/numpy -Inumpy/core/src/common -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/src/npysort -I/opt/homebrew/Caskroom/miniforge/base/envs/d2l/include/python3.8 -Ibuild/src.macosx-11.0-arm64-3.8/numpy/core/src/common -Ibuild/src.macosx-11.0-arm64-3.8/numpy/core/src/npymath -Ibuild/src.macosx-11.0-arm64-3.8/numpy/core/src/common -Ibuild/src.macosx-11.0-arm64-3.8/numpy/core/src/npymath -c'
        extra options: '-faltivec -I/System/Library/Frameworks/vecLib.framework/Headers'
        gcc: numpy/core/src/multiarray/alloc.c
        gcc: numpy/core/src/multiarray/buffer.c
        gcc: numpy/core/src/multiarray/common.c
        gcc: numpy/core/src/multiarray/array_assign_scalar.c
        gcc: numpy/core/src/multiarray/conversion_utils.c
        gcc: numpy/core/src/multiarray/datetime_strings.c
        gcc: numpy/core/src/multiarray/descriptor.c
        gcc: build/src.macosx-11.0-arm64-3.8/numpy/core/src/multiarray/einsum.c
        clang: error: the clang compiler does not support 'faltivec', please use -maltivec and include altivec.h explicitly
        clang: error: the clang compiler does not support 'faltivec', please use -maltivec and include altivec.h explicitly
        gcc: numpy/core/src/multiarray/hashdescr.c
        clang: error: the clang compiler does not support 'faltivec', please use -maltivec and include altivec.h explicitly
        clang: error: the clang compiler does not support 'faltivec', please use -maltivec and include altivec.h explicitly
        gcc: build/src.macosx-11.0-arm64-3.8/numpy/core/src/multiarray/lowlevel_strided_loops.c
        clang: error: the clang compiler does not support 'faltivec', please use -maltivec and include altivec.h explicitly
        gcc: numpy/core/src/multiarray/multiarraymodule.cclang: error: the clang compiler does not support 'faltivec', please use -maltivec and include altivec.h explicitly
        gcc: numpy/core/src/multiarray/nditer_constr.c
        clang: error: the clang compiler does not support 'faltivec', please use -maltivec and include altivec.h explicitly
        gcc: numpy/core/src/multiarray/refcount.c
  
        clang: error: the clang compiler does not support 'faltivec', please use -maltivec and include altivec.h explicitly
        gcc: numpy/core/src/multiarray/scalarapi.c
        gcc: numpy/core/src/multiarray/temp_elide.c
        gcc: numpy/core/src/multiarray/vdot.c
        clang: error: the clang compiler does not support 'faltivec', please use -maltivec and include altivec.h explicitly
        clang: error: the clang compiler does not support 'faltivec', please use -maltivec and include altivec.h explicitly
        gcc: numpy/core/src/umath/ufunc_object.c
        clang: error: the clang compiler does not support 'faltivec', please use -maltivec and include altivec.h explicitly
        clang: error: the clang compiler does not support 'faltivec', please use -maltivec and include altivec.h explicitly
        gcc: build/src.macosx-11.0-arm64-3.8/numpy/core/src/umath/loops.c
        gcc: build/src.macosx-11.0-arm64-3.8/numpy/core/src/umath/scalarmath.c
        clang: error: the clang compiler does not support 'faltivec', please use -maltivec and include altivec.h explicitly
        clang: error: the clang compiler does not support 'faltivec', please use -maltivec and include altivec.h explicitly
        gcc: numpy/core/src/common/npy_longdouble.c
        clang: error: the clang compiler does not support 'faltivec', please use -maltivec and include altivec.h explicitly
        gcc: numpy/core/src/npymath/npy_math.c
        gcc: numpy/core/src/npymath/halffloat.c
        clang: error: the clang compiler does not support 'faltivec', please use -maltivec and include altivec.h explicitly
        gcc: numpy/core/src/common/numpyos.c
        gcc: /private/var/folders/5y/pqfqz2md0njg2slq29yxp12w0000gn/T/pip-install-eoeg8q4z/numpy_db18e06efcc64efda4604fc226e1dd5d/numpy/_build_utils/src/apple_sgemv_fix.c
        clang: error: the clang compiler does not support 'faltivec', please use -maltivec and include altivec.h explicitly
        clang: error: the clang compiler does not support 'faltivec', please use -maltivec and include altivec.h explicitly
        clang: error: the clang compiler does not support 'faltivec', please use -maltivec and include altivec.h explicitly
        clang: error: the clang compiler does not support 'faltivec', please use -maltivec and include altivec.h explicitly
        clang: error: the clang compiler does not support 'faltivec', please use -maltivec and include altivec.h explicitly
        clang: error: the clang compiler does not support 'faltivec', please use -maltivec and include altivec.h explicitly
        clang: error: the clang compiler does not support 'faltivec', please use -maltivec and include altivec.h explicitly
        clang: error: the clang compiler does not support 'faltivec', please use -maltivec and include altivec.h explicitly
        error: Command "gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/opt/homebrew/Caskroom/miniforge/base/envs/d2l/include -arch arm64 -I/opt/homebrew/Caskroom/miniforge/base/envs/d2l/include -arch arm64 -DNPY_INTERNAL_BUILD=1 -DHAVE_NPY_CONFIG_H=1 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -DNO_ATLAS_INFO=3 -DHAVE_CBLAS -Ibuild/src.macosx-11.0-arm64-3.8/numpy/core/src/umath -Ibuild/src.macosx-11.0-arm64-3.8/numpy/core/src/npymath -Ibuild/src.macosx-11.0-arm64-3.8/numpy/core/src/common -Inumpy/core/include -Ibuild/src.macosx-11.0-arm64-3.8/numpy/core/include/numpy -Inumpy/core/src/common -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/src/npysort -I/opt/homebrew/Caskroom/miniforge/base/envs/d2l/include/python3.8 -Ibuild/src.macosx-11.0-arm64-3.8/numpy/core/src/common -Ibuild/src.macosx-11.0-arm64-3.8/numpy/core/src/npymath -Ibuild/src.macosx-11.0-arm64-3.8/numpy/core/src/common -Ibuild/src.macosx-11.0-arm64-3.8/numpy/core/src/npymath -c numpy/core/src/multiarray/conversion_utils.c -o build/temp.macosx-11.0-arm64-3.8/numpy/core/src/multiarray/conversion_utils.o -MMD -MF build/temp.macosx-11.0-arm64-3.8/numpy/core/src/multiarray/conversion_utils.o.d -faltivec -I/System/Library/Frameworks/vecLib.framework/Headers" failed with exit status 1
        [end of output]
  
    note: This error originates from a subprocess, and is likely not a problem with pip.
  error: legacy-install-failure
  
  × Encountered error while trying to install package.
  ╰─> numpy
  
  note: This is an issue with the package mentioned above, not pip.
  hint: See above for output from the failure.
  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

1 Like

记录一个conda小技巧(安装pytorch):

  1. 先查询自己驱动版本,可以运行nvidia-smi的话查询到自己可以达到到cuda版本xx.x(跳到3),只找到驱动版本号跳到2。
  2. 根据Table 3. CUDA Toolkit and Corresponding Driver Versions查找适合自己到cuda版本xx.x。
  3. 配置清华源以后执行:

conda create -n d2l cudatoolkit=xx.x cudnn pytorch=1.8.1=*cu* torchvision=0.9.1=*cu* -c pytorch -c conda-forge -c main -c nvidia && conda activate d2l && pip config set global.index-url Simple Index && pip install d2l==0.17.3

说明:

  1. 通配符cu用来匹配用cuda构建的版本,省略的版本可以由conda来匹配
  2. 多个-c用来引用多个conda源
  3. pip config用来配置清华源
    4.建议加入正文以减少配置问题:)

附录-验证pytorch使用cuda与cudnn(梯度反向传播),可以同时打开nvidia-smi观察gpu显存用量:

import torch
torch.cuda.is_available()
t=torch.nn.Linear(256,256).cuda()
input=torch.rand((256,256)).requires_grad_().cuda()
output=t(input)
loss=torch.sum(output)
torch.autograd.grad(loss,input,retain_graph=True)
loss.backward()

抱歉,我搜了好一圈,仍没有解决这个问题。

在m1的mac上安装d2l时报错,求解决,谢谢!:pray:

更新pip版本至22.0.3后又报新错误

把python从3.9降到3.8最终解决了

1 Like

请问d2l包支持的最老的pytorch版本是多少呢?谢谢

请问为什么每次都要重装torch后才能启动jupyter?

pip install torch==1.8.1+cu111 torchvision==0.9.1+cu111 torchaudio==0.8.1 -f https://download.pytorch.org/whl/torch_stable.html可以安装好和本书对应的gpu版本

ModuleNotFoundError: No module named ‘d21’
image
问一下这是什么原因呢,我安装了d21包但是导入的时候显示没有