安装


请问一下,怎么才能只卸载CPU的torch?

ERROR: Could not build wheels for pandas, which is required to install pyproject.toml-based projects
我也遇到这个问题,我查了一下,python 支持直接走本地安装

  1. 把 d2l-1.0.0b0-py3-none-any.whl下载到本地:d2l · PyPI
  2. 根据官方文档按以下命令安装,路径换成你的下载路径,如:
    py -m pip install "C:\Users\xxx\Downloads\d2l-1.0.0b0-py3-none-any.whl"
  3. 再运行一遍 pip install d2l==0.17.6 让 pip 把本地安装的包对应上 d2l 名称,测试 import d2l 就可以成功了

亲测有效

我整理成了一篇文章,详见:解决 Could not build wheels for pandas, which is required to install pyproject.toml-based projects_sriting的博客-CSDN博客

每次启动notebook之前都要activate吗?

确实有时候python版本过高是个问题,比如我更新为python 3.11后,旧版本的torch 1.12就用不了了

好像是因为Jupyter的路径问题。
试试:
~/.local/bin/jupyter notebook

     22 from pandas.compat.numpy import (
     23     np_version_under1p17 as _np_version_under1p17,
     24     np_version_under1p18 as _np_version_under1p18,
     25     is_numpy_dev as _is_numpy_dev,
     26 )
     28 try:
---> 29     from pandas._libs import hashtable as _hashtable, lib as _lib, tslib as _tslib
     30 except ImportError as e:  # pragma: no cover
...
     22 )

File pandas/_libs/interval.pyx:1, in init pandas._libs.interval()

ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject

这个版本不兼容大家是怎么解决的呀,大家使用的 numpy,pandas,d2l, python 都是什么版本呀

1 Like
pip install jupyter d2l  后报错,请问这个要怎么解决啊?

error: command ‘C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe’ failed with exit code 2
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for pandas
Failed to build matplotlib numpy pandas
ERROR: Could not build wheels for numpy, pandas, which is required to install pyproject.toml-based projects

同样的问题,如何解决啊

纯净的环境也安装不上d2l,python3.9能装上,运行就报错。

各位别像我一样耍小聪明用 python 3.10, 当前 d2l包和相关依赖只支持Python 3.9

1 Like

Python 的 版本装错了, 只能装 python 3.9,然后 pandas 的版本得退回到 1.2.4

1 Like

参照文档,M2机器,在python3.9下,
pip install torch==1.12.0
pip install torchvision==0.13.0
pip install d2l==0.17.6

执行导入d2l包之后报错

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In[1], line 6
      4 import torch
      5 from torch import nn
----> 6 from d2l import torch as d2l

File ~/anaconda3/envs/d2l4/lib/python3.9/site-packages/d2l/torch.py:32
     30 import zipfile
     31 from collections import defaultdict
---> 32 import pandas as pd
     33 import requests
     34 from IPython import display

File ~/anaconda3/envs/d2l4/lib/python3.9/site-packages/pandas/__init__.py:29
     22 from pandas.compat.numpy import (
     23     np_version_under1p17 as _np_version_under1p17,
     24     np_version_under1p18 as _np_version_under1p18,
     25     is_numpy_dev as _is_numpy_dev,
     26 )
     28 try:
---> 29     from pandas._libs import hashtable as _hashtable, lib as _lib, tslib as _tslib
     30 except ImportError as e:  # pragma: no cover
     31     # hack but overkill to use re
     32     module = str(e).replace("cannot import name ", "")

File ~/anaconda3/envs/d2l4/lib/python3.9/site-packages/pandas/_libs/__init__.py:13
      1 __all__ = [
      2     "NaT",
      3     "NaTType",
   (...)
      9     "Interval",
     10 ]
---> 13 from pandas._libs.interval import Interval
     14 from pandas._libs.tslibs import (
     15     NaT,
     16     NaTType,
   (...)
     21     iNaT,
     22 )

File pandas/_libs/interval.pyx:1, in init pandas._libs.interval()

ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject

同样报错,兄弟解决了嘛。。。。。。。。。。

@Bill_Jin @WYWY 解决了!使用pip install d2l==1.0.0b0

还在吗,我是这样弄好的
pip install d2l ——> pip install d2l pandas==1.5.3

1 Like

运行代码jupyter notebook后显示,‘jupyter’ 不是内部或外部命令,也不是可运行的程序
或批处理文件。请问这里应该如何解决?

这个是用来把notebook编译成PDF文件时用的标签,具体代码在:https://github.com/d2l-ai/d2l-book/tree/master/d2lbook

Why is it that my CUDA is installed, but I can’t call it in my program. Entering nvcc -V in cmd displays the version number correctly, and the cuDNN files are configured according to the tutorial.

windows下推荐使用wsl:
https://segmentfault.com/a/1190000044364889

下图说明可以用到gpu:

如果没有独立显卡,已安装conda或miniconda后,通过如下命令安装pytorch:

conda install pytorch torchvision torchaudio cpuonly -c pytorch