我试着研究神经网络和深度学习(http://neuralnetworksanddeeplearning.com/chap1.html).使用MichalDanielDobrzanski (https://github.com/MichalDanielDobrzanski/DeepLearningPython)为Python3更新的版本。尝试在我的命令控制台中运行它,它在下面给出了一个错误。我尝试过卸载和重新安装setuptools、theano和numpy,但到目前为止还没有一个能工作。任何帮助都是非常感谢的!
以下是完整的错误日志:
WARNING (theano.configdefaults): g++ not available, if using conda: `conda install m2w64-toolchain`
C:\Users\ASUS\AppData\Local\Programs\Python\Python39\lib\site-packages\theano\configdefaults.py:560: UserWarning: DeprecationWarning: there is no c++ compiler.This is deprecated and with Theano 0.11 a c++ compiler will be mandatory
warnings.warn("DeprecationWarning: there is no c++ compiler."
WARNING (theano.configdefaults): g++ not detected ! Theano will be unable to execute optimized C-implementations (for both CPU and GPU) and will default to Python implementations. Performance will be severely degraded. To remove this warning, set Theano flags cxx to an empty string.
Traceback (most recent call last):
File "C:\Users\ASUS\AppData\Local\Programs\Python\Python39\lib\site-packages\theano\configparser.py", line 168, in fetch_val_for_key
return theano_cfg.get(section, option)
File "C:\Users\ASUS\AppData\Local\Programs\Python\Python39\lib\configparser.py", line 781, in get
d = self._unify_values(section, vars)
File "C:\Users\ASUS\AppData\Local\Programs\Python\Python39\lib\configparser.py", line 1149, in _unify_values
raise NoSectionError(section) from None
configparser.NoSectionError: No section: 'blas'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\ASUS\AppData\Local\Programs\Python\Python39\lib\site-packages\theano\configparser.py", line 327, in __get__
val_str = fetch_val_for_key(self.fullname,
File "C:\Users\ASUS\AppData\Local\Programs\Python\Python39\lib\site-packages\theano\configparser.py", line 172, in fetch_val_for_key
raise KeyError(key)
KeyError: 'blas.ldflags'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\ASUS\Documents\GitHub\Neural-network-and-deep-learning-but-for-python-3\test.py", line 156, in <module>
import network3
File "C:\Users\ASUS\Documents\GitHub\Neural-network-and-deep-learning-but-for-python-3\network3.py", line 37, in <module>
import theano
File "C:\Users\ASUS\AppData\Local\Programs\Python\Python39\lib\site-packages\theano\__init__.py", line 124, in <module>
from theano.scan_module import (scan, map, reduce, foldl, foldr, clone,
File "C:\Users\ASUS\AppData\Local\Programs\Python\Python39\lib\site-packages\theano\scan_module\__init__.py", line 41, in <module>
from theano.scan_module import scan_opt
File "C:\Users\ASUS\AppData\Local\Programs\Python\Python39\lib\site-packages\theano\scan_module\scan_opt.py", line 60, in <module>
from theano import tensor, scalar
File "C:\Users\ASUS\AppData\Local\Programs\Python\Python39\lib\site-packages\theano\tensor\__init__.py", line 17, in <module>
from theano.tensor import blas
File "C:\Users\ASUS\AppData\Local\Programs\Python\Python39\lib\site-packages\theano\tensor\blas.py", line 155, in <module>
from theano.tensor.blas_headers import blas_header_text
File "C:\Users\ASUS\AppData\Local\Programs\Python\Python39\lib\site-packages\theano\tensor\blas_headers.py", line 987, in <module>
if not config.blas.ldflags:
File "C:\Users\ASUS\AppData\Local\Programs\Python\Python39\lib\site-packages\theano\configparser.py", line 332, in __get__
val_str = self.default()
File "C:\Users\ASUS\AppData\Local\Programs\Python\Python39\lib\site-packages\theano\configdefaults.py", line 1284, in default_blas_ldflags
blas_info = np.distutils.__config__.blas_opt_info
AttributeError: module 'numpy.distutils.__config__' has no attribute 'blas_opt_info'
发布于 2022-01-31 09:57:16
我也遇到了同样的问题,并通过以下方式将numpy降级为1.20.3版本:
pip3 install --upgrade numpy==1.20.3
发布于 2022-05-21 05:08:36
Monkey-修补NumPy.
import numpy as np
try:
np.distutils.__config__.blas_opt_info = np.distutils.__config__.blas_ilp64_opt_info
except Exception:
pass
这个工作片段直接来自NumPy维护者拉尔夫·戈默斯(@rgommers),他首先定义了一个子模。然后,提交人Alex Rogozhnikov (@arogozhnikov)通过子模块代替对其进行了改进。
对于主动维护的软件(我要说的是...so,而不是theano
),相反:
np.distutils.__config__.blas_opt_info
的所有中断引用替换为对np.distutils.__config__.blas_ilp64_opt_info
的工作引用。危险威尔·罗宾逊!危险!
然而,所有这些都附带了一个重要的警告:所有这些都将再次打破的,在未来的一些尚未决定的NumPy发布中。为什么?引用NumPy维护者拉尔夫·戈默斯(@rgommers) https://github.com/numpy/numpy/issues/21079#issuecomment-1043862232的话
当我们改变构建系统时,这一切都会改变,我们不会保留
system_info
类型的输出。
</gulp>
发布于 2022-03-17 10:50:09
其他信息:
theano
是一个过时的软件包,不能与numpy的现代版本一起使用。然而,一些遗留代码库将使用theano
,因此需要解决将numpy < 1.22降级的方法,就像接受的答案一样。否决是在numpy 1.22中进行的:请参见numpy问题#21079。
如果您需要坚持使用numpy 1.22+,那么blas_opt_info
位于numpy.distutils.system_info.blas_opt_info
中,因此手动修补theano以使用正确的符号将是另一种解决方法。
https://stackoverflow.com/questions/70839312
复制相似问题