安装

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

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

1 Like

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

参照文档,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

教大家一个非常简单安装d2l包的方法,首先去开源仓库【https://github.com/d2l-ai/d2l-zh/tree/master/d2l 】把里面的d2l文件夹下载到本地,然后把d2l文件夹移入你的pycharm项目里面,并且把d2l文件夹搞成pycharm的模块,后续使用【from d2l import torch as d2l】的时候就可以直接调用本地的d2l包了,这样也就没有安装不上的烦恼了。不过这种方法可能不适用于jupyter(没有验证过)

请问下载用CPU的mxnet时遇到这样的情况应该如何解决?

还想请问一下cuda版本12.0(?)有支持的mxnet版本吗?还是说需要downgradeCUDA的版本?


为什么我是这样的jupyter,不能类似powerpoint播放

安装d2l 出错,错误内容似乎在register_finder(pkgutil.ImpImporter, find_on_path),怎么解决呢?:

运行线性回归模型一直出现这个怎么解决啊?电脑内存16G,占用的还不到2G,但一运行就这样
Kernel Restarting

The kernel for d2l-zh/test/linear regression.ipynb appears to have died. It will restart automatically.

你好,我电脑比较老,显卡是K2000M,查了表,对应CUDA最高支持到10.1。我安装了10.1版本的CUDA,Miniconda3-py39_24.3.0-0-Windows-x86_64.exe。运行d2l-zh\pytorch\chapter_convolutional-modern\resnet.ipynb时报错,说GPU too old,不再支持。请问,应该安装哪个版本?或者不使用GPU,用CPU可以吗?

根据第二版p9地提示,登录https://conda.io/en/latest/miniconda.html,1) * [Latest Miniconda installer links by Python version];2) * [Installing Miniconda]