学习笔记:记录TensorSpace项目遇到的问题(一)

Anaconda虚拟环境tsc

1.主要用到的包

-------------------------------keras 2.2.2
-------------------------------tensorflow 1.12.0
-------------------------------tensorflowjs 0.8.0
-------------------------------tensorspacejs 0.2.0

(tsc) C:\Users\Le>pip list
Package                       Version
----------------------------- ---------
absl-py                       0.11.0
astor                         0.8.1
backports.functools-lru-cache 1.6.1
cached-property               1.5.2
certifi                       2020.12.5
chardet                       3.0.4
colorama                      0.4.4
cycler                        0.10.0
decorator                     4.4.2
gast                          0.4.0
grpcio                        1.33.2
h5py                          2.8.0
idna                          2.10
imageio                       2.9.0
importlib-metadata            3.1.0
ipykernel                     5.3.4
ipython                       5.8.0
ipython-genutils              0.2.0
jupyter-client                6.1.7
jupyter-core                  4.7.0
Keras                         2.2.2
Keras-Applications            1.0.4
Keras-Preprocessing           1.0.2
kiwisolver                    1.3.1
Markdown                      3.3.3
matplotlib                    3.3.3
mock                          4.0.2
networkx                      2.5
node                          0.9.25
npm                           0.1.1
numpy                         1.15.1
odict                         1.7.0
optional-django               0.1.0
pickleshare                   0.7.5
Pillow                        8.0.1
pip                           20.3.1
plumber                       1.6
prompt-toolkit                1.0.15
protobuf                      3.14.0
Pygments                      2.7.3
pyparsing                     2.4.7
python-dateutil               2.8.1
PyWavelets                    1.1.1
pywin32                       228
PyYAML                        5.3.1
pyzmq                         20.0.0
relaxml                       0.1.3
requests                      2.25.0
scikit-image                  0.17.2
scipy                         1.5.4
setuptools                    36.4.0
simplegeneric                 0.8.1
simplejson                    3.17.2
six                           1.15.0
SQLAlchemy                    1.3.20
tensorboard                   1.12.2
tensorflow                    1.12.0
tensorflow-hub                0.1.1
tensorflowjs                  0.8.0
tensorspacejs                 0.2.0
termcolor                     1.1.0
three                         0.8.0
tifffile                      2020.9.3
tornado                       6.1
tqdm                          4.53.0
traitlets                     4.3.3
urllib3                       1.26.2
wcwidth                       0.2.5
Werkzeug                      1.0.1
wheel                         0.29.0
wincertstore                  0.2
zipp                          3.4.0
zope.component                4.6.2
zope.deferredimport           4.3.1
zope.deprecation              4.4.0
zope.event                    4.5.0
zope.hookable                 5.0.1
zope.interface                5.2.0
zope.lifecycleevent           4.3
zope.proxy                    4.3.5

2.查看下载的TensorSpace-Converter版本

(tsc) C:\Users\Le>tensorspacejs_converter -v
Using TensorFlow backend.

tensorspacejs 0.2.0

Dependency versions:
python 3.6
node 11.3+
npm 6.5+
tensorflow 1.12.0
keras 2.2.2
tensorflowjs 0.8.0

3.初始化TensorSpace Converter

(tsc) C:\Users\Le>tensorspacejs_converter -init
Using TensorFlow backend.
Initializing TensorSpace Converter...
Traceback (most recent call last):
  File "e:\anaconda3\envs\tsc\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "e:\anaconda3\envs\tsc\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "E:\Anaconda3\envs\tsc\Scripts\tensorspacejs_converter.exe\__main__.py", line 7, in <module>
  File "e:\anaconda3\envs\tsc\lib\site-packages\tensorspacejs\tsp_converters.py", line 110, in main
    install()
  File "e:\anaconda3\envs\tsc\lib\site-packages\tensorspacejs\install.py", line 19, in install
    install_tfjs()
  File "e:\anaconda3\envs\tsc\lib\site-packages\tensorspacejs\install.py", line 29, in install_tfjs
    "install"
  File "e:\anaconda3\envs\tsc\lib\subprocess.py", line 306, in check_call
    retcode = call(*popenargs, **kwargs)
  File "e:\anaconda3\envs\tsc\lib\subprocess.py", line 287, in call
    with Popen(*popenargs, **kwargs) as p:
  File "e:\anaconda3\envs\tsc\lib\subprocess.py", line 729, in __init__
    restore_signals, start_new_session)
  File "e:\anaconda3\envs\tsc\lib\subprocess.py", line 1017, in _execute_child
    startupinfo)
FileNotFoundError: [WinError 2] 系统找不到指定的文件。

这一步报错,查找网上资料,找到*subprocess.py文件,将__init__中的参数shell==False改为True,这个WinError 2错误消失了,然后出现了新的错误。。。(绝望)

// 路径
E:\Anaconda3\envs\tsc\Lib\subprocess.py
// 找到其中Popen(object)类的__init__
Using TensorFlow backend.
Initializing TensorSpace Converter...

> @tensorflow/tfjs-node@1.0.0-alpha2 install e:\anaconda3\envs\tsc\lib\site-packages\tensorspacejs\tfjs\node_modules\@tensorflow\tfjs-node
> node scripts/install.js

* Downloading libtensorflow
[==========================    ] 3620444/bps 87% 0.6sevents.js:287
      throw er; // Unhandled 'error' event
      ^

Error: read ECONNRESET
    at TLSWrap.onStreamRead (internal/stream_base_commons.js:205:27)
Emitted 'error' event on ClientRequest instance at:
    at TLSSocket.socketErrorListener (_http_client.js:426:9)
    at TLSSocket.emit (events.js:310:20)
    at emitErrorNT (internal/streams/destroy.js:92:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
    at processTicksAndRejections (internal/process/task_queues.js:84:21) {
  errno: 'ECONNRESET',
  code: 'ECONNRESET',
  syscall: 'read'
}
npm WARN rollback Rolling back node-fetch@2.3.0 failed (this is probably harmless): EPERM: operation not permitted, lstat 'e:\anaconda3\envs\tsc\lib\site-packages\tensorspacejs\tfjs\node_modules\@tensorflow\tfjs-node\node_modules'
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @tensorflow/tfjs-node@1.0.0-alpha2 install: `node scripts/install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @tensorflow/tfjs-node@1.0.0-alpha2 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Le\AppData\Roaming\npm-cache\_logs\2021-03-21T23_23_12_990Z-debug.log
Traceback (most recent call last):
  File "e:\anaconda3\envs\tsc\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "e:\anaconda3\envs\tsc\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "E:\Anaconda3\envs\tsc\Scripts\tensorspacejs_converter.exe\__main__.py", line 7, in <module>
  File "e:\anaconda3\envs\tsc\lib\site-packages\tensorspacejs\tsp_converters.py", line 110, in main
    install()
  File "e:\anaconda3\envs\tsc\lib\site-packages\tensorspacejs\install.py", line 19, in install
    install_tfjs()
  File "e:\anaconda3\envs\tsc\lib\site-packages\tensorspacejs\install.py", line 29, in install_tfjs
    "install"
  File "e:\anaconda3\envs\tsc\lib\subprocess.py", line 311, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['npm', 'install']' returned non-zero exit status 1.

查看C:\Users\Le\AppData\Roaming\npm-cache_logs\2021-03-21T23_23_12_990Z-debug.log发现:735 verbose stack Error: @tensorflow/tfjs-node@1.0.0-alpha2 install:node scripts/install.js``
------------------------------------------分割线--------------------------------------
熬了两个通宵,终于在一个博主的博客上发现了同样的问题(他是执行npm install的时候出现了和我一样的报错):

参考博客
链接: windows下的tfjs-node安装异常总结.

TensorSpace的初始化 TensorSpace Converter这一步骤本质上好像是安装tfjs-node,但是过程极其繁琐,看我尝试了那么多次就知道了,改完一个错出来新的错,那真的是太绝望了。

  • 博客里提到这样一段话:

⭐tfjs-node依赖于python和C++的,其实是一种将node和python下的tensorflow框架融合的技术,我猜测tfjs-node并没有完整使用js语言开发出神经网络框架,而是需要大量调用原生tf(C++,py)的库。
所以这里报的错误应该是执行python脚本和其他编译过程抛出的错误,而npm并不能定位到这样的异常或错误。

  • 根据博客指示,我输入了以下指令:
npm install -g --production windows-build-tools

接着之前的libtensorflow的Downloading进度条就加载地飞起~~真是米奇妙妙屋妙到家了啊,卡了好久的问题终于解决了,然后再去执行初始化语句:

tensorspacejs_converter -init
Using TensorFlow backend.
Initializing TensorSpace Converter...
audited 44 packages in 1.194s
found 5 vulnerabilities (4 low, 1 high)
  run `npm audit fix` to fix them, or `npm audit` for details

> protobufjs@6.8.8 postinstall e:\anaconda3\envs\tsc\lib\site-packages\tensorspacejs\tf\pb2json\node_modules\protobufjs
> node scripts/postinstall

added 41 packages from 92 contributors and audited 41 packages in 13.532s
found 2 low severity vulnerabilities
  run `npm audit fix` to fix them, or `npm audit` for details
TensorSpace Converter Initialization Completed!

⭐看到这个“TensorSpace Converter Initialization Completed!”了吗?这真的是最美的字符啊。

完帖!滚去午休会儿了!

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值