简体   繁体   English

在Windows上构建自定义Anaconda安装程序时出错

[英]Error while constructing custom Anaconda installer on Windows

I am creating a custom Anaconda installer on Windows 10 64bit. 我正在Windows 10 64bit上创建自定义的Anaconda安装程序。 I have created construct.yaml like : 我已经创建了construct.yaml像:

name : TensorFlowEnv
version : 1.0.0
specs :
   - numpy
channels :
   - https://conda.anaconda.org/anaconda/win-64

After running the construcor command , I am getting the following error 运行construcor命令后,出现以下错误

platform: win-64
Collecting package metadata: done
Solving environment: done
Checking for duplicate files ...

Checking for 'C:\Users\Equip\Anaconda3\envs\TensorFlowEnv\NSIS\makensis.exe'
NSIS version: v3.01
Traceback (most recent call last):
  File "C:\Users\Equip\Anaconda3\envs\TensorFlowEnv\Scripts\constructor-script.py", line 10, in <module>
    sys.exit(main())

  File "C:\Users\Equip\Anaconda3\envs\TensorFlowEnv\lib\site-packages\constructor\main.py", line 221, in main
    dry_run=opts.dry_run)
  File "C:\Users\Equip\Anaconda3\envs\TensorFlowEnv\lib\site-packages\constructor\main.py", line 128, in main_build
    create(info, verbose=verbose)
File "C:\Users\Equip\Anaconda3\envs\TensorFlowEnv\lib\site-packages\constructor\winexe.py", line 218, in create
    preconda_write_files(info, tmp_dir)
  File "C:\Users\Equip\Anaconda3\envs\TensorFlowEnv\lib\site-packages\constructor\preconda.py", line 135, in write_files
    write_index_cache(info, dst_dir)
 File "C:\Users\Equip\Anaconda3\envs\TensorFlowEnv\lib\site-packages\constructor\preconda.py", line 40, in write_index_cache
    write_repodata(cache_dir, url)
  File "C:\Users\Equip\Anaconda3\envs\TensorFlowEnv\lib\site-packages\constructor\conda_interface.py", line 61, in write_repodata
    fh.write(raw_repodata_str)
TypeError: write() argument must be str, not None

The error is : 错误是:

TypeError: write() argument must be str, not None TypeError:write()参数必须为str,而不是None

Any help would be appreciated. 任何帮助,将不胜感激。

I had this error and resolved it. 我有此错误并解决了。 First the steps taken to get this error: 首先,采取步骤来获取此错误:

I was using a local conda server. 我正在使用本地conda服务器。 I had gone into /envs/someenv/conda-bld and ran 'python -m http.server' in there, after doing a 'conda index .' 在执行“ conda索引”之后,我进入/ envs / someenv / conda-bld并在其中运行“ python -m http.server”。 in that folder. 在那个文件夹中。 Which works. 哪个有效。 And in my construct.yaml I had ' http://localhost:8000 ' as a channel. 在我的Construct.yaml中,我使用了“ http:// localhost:8000 ”作为频道。 This worked until I updated my conda package to a later version. 这一直有效,直到我将conda软件包更新为更高版本。 It would not update in that conda channel. 它不会在该conda频道中更新。

Now the steps to resolve the error: 现在,解决错误的步骤:

I did a 'conda clean -i', then manually had to delete all the repodata.json and index.html in that build folder. 我做了一个“ conda clean -i”,然后手动删除了该构建文件夹中的所有repodata.json和index.html。 And deleted all the cache folders. 并删除所有缓存文件夹。 And also in the win64 folde.r Then I did 'conda index .' 然后在win64 folde.r中,我做了'conda index'。 and the index files and repodata generated where then all correct. 然后生成索引文件和repodata,然后全部正确。 Then once that was done I did conda construct again and the installer works. 然后,一旦完成,我就再次进行了conda构建,安装程序开始工作。

Note I have to force 'conda install conda=4.5.13 constructor=2.3.0' and NOT use constructor v3 and some later versions of conda as they build installers that look right but have missing files. 注意,我必须强制使用“ conda install conda = 4.5.13构造函数= 2.3.0”,并且不要使用构造函数v3和conda的某些更高版本,因为它们会生成看起来正确但缺少文件的安装程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM