安装

您好,请问现在 d2l 支持 M1 系列的 pytorch GPU 加速了吗,我看到 d2l 的版本貌似并不兼容,是我没有更新吗?谢谢

在安装cuda toolkits的时候,cuda11.3的win版本只有win10,server2016和server2019可选择。但是我电脑是win11的,难道只能重装系统吗…想问下大家有没有遇到的问题,咋解决的。

是不是因为我用的是python3.10,当我运行jupyter notebook时候,报错了

报错日志如下(我用的是mac)

Traceback (most recent call last):
  File "/Users/wjunshen/miniconda3/envs/d2l/bin/jupyter-notebook", line 8, in <module>
    sys.exit(main())
  File "/Users/wjunshen/miniconda3/envs/d2l/lib/python3.10/site-packages/jupyter_core/application.py", line 269, in launch_instance
    return super().launch_instance(argv=argv, **kwargs)
  File "/Users/wjunshen/miniconda3/envs/d2l/lib/python3.10/site-packages/traitlets/config/application.py", line 982, in launch_instance
    app.start()
  File "/Users/wjunshen/miniconda3/envs/d2l/lib/python3.10/site-packages/notebook/notebookapp.py", line 2320, in start
    success = self._bind_http_server()
  File "/Users/wjunshen/miniconda3/envs/d2l/lib/python3.10/site-packages/notebook/notebookapp.py", line 1795, in _bind_http_server
    return self._bind_http_server_unix() if self.sock else self._bind_http_server_tcp()
  File "/Users/wjunshen/miniconda3/envs/d2l/lib/python3.10/site-packages/notebook/notebookapp.py", line 1821, in _bind_http_server_tcp
    self.http_server.listen(port, self.ip)
  File "/Users/wjunshen/miniconda3/envs/d2l/lib/python3.10/site-packages/tornado/tcpserver.py", line 183, in listen
    sockets = bind_sockets(
  File "/Users/wjunshen/miniconda3/envs/d2l/lib/python3.10/site-packages/tornado/netutil.py", line 162, in bind_sockets
    sock.bind(sockaddr)
OSError: [Errno 49] Can't assign requested address

请问大家安装d2l的时候遇到了这个问题吗(Could not build wheels for pandas, which is required to install pyproject.toml-based projects),一直解决不了,请大佬解疑

2 Likes

装了cudatoolkit 11.1 和 nividia driver 450.216.04, 但是torch.cuda.is_available() 还是false怎么办

我的win10的系统,安装d2l时这个一直报错,求问大佬,这个该怎么解决,有人碰到吗

Have you sovled that? I met the same problem

我在执行 pip install d2l==0.17.6 时遇到一下错误,但是我在环境中单独安装pandas是没有问题的,提示所需的c++ build tools 我应该也安装了,但不确定安装的对不对,多次尝试后仍不能解决

本机已安装的c++相关的软件如下

解决了,通过各种尝试之后,都没有成功。索性使用python3.9(之前用的3.10),重新创建环境,一次性成功了,看到程序列表里自动下载了c++ build tools,确认过不是我手动安装的版本(重新尝试前已经卸载干净了,且对比版本号自动下载的与我手动下载的包版本不同),所以到最后就是一个简单的版本问题。

我已经安装成功,以下是我的一点总结,可以进行一些参考:

  1. cuda必须低于pytorch的版本,不能太新,所以应当先检查pytorch版本再下相应的cuda版本
  2. Miniconda内部有python,因此不用和当前电脑上的python版本配套。但用最新版本在安装jupyter时可能会卡住,因此建议用辅助视频里沐神下的3.8版本。

如果是在公司,得用管理员权限打开miniconda,让miniconda自动安装在C>programdata才行,powershell会自动寻路,否则会报错。

Miniconda如果下了好几个版本,即使卸载了,他们的shell界面可能还存在,可以打开但会报错*不是以base开头。所以重启一下电脑,去找到有目录的那个shell再打开

  1. 如何打开notebook : 参考 python - ‘Jupyter’ is not recognized as an internal or external command - Stack Overflow. 在打开notebook时,不遵从jupyter notebook,而是打出python -m notebook, 此时该notebook也会和d2l上的云端gpu联动,代码会同时运行

重要: jupyter notebook实际上可以用colab代替,同样可以打开文档并运行代码。

1 Like

我表示Windows环境下 mxnet 配置太麻烦了。我根据教程安装完 mxnet 后,安装 d2l 各种冲突报错,主要是 numpy 的。小白还是 pytorch 好上手。


请问一下,怎么才能只卸载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

同样的问题,如何解决啊