简体   繁体   English

无法使用 Anaconda 安装 fairseq?

[英]cannot install fairseq using Anaconda?

I install the package fairseq but it raises some errors as bellow.我安装了 package fairseq,但它会引发一些错误,如下所示。 I'm using Anaconda Prompt to install on the base environment.我正在使用 Anaconda 提示安装在基础环境中。 Could anyone help to fix this problem??谁能帮忙解决这个问题?? Thanks so much!非常感谢!

(base) PS C:\WINDOWS\system32> pip install fairseq --user
Collecting fairseq
  Using cached fairseq-0.10.1.tar.gz (924 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  ERROR: Command errored out with exit status 1:
   command: 'C:\Users\johnn\Anaconda3\python.exe' 'C:\Users\johnn\Anaconda3\lib\site-packages\pip\_vendor\pep517\_in_process.py' get_requires_for_build_wheel 'C:\Users\johnn\AppData\Local\Temp\tmpr4o1lvo4'
       cwd: C:\Users\johnn\AppData\Local\Temp\pip-install-5efwp00y\fairseq_8f7b526c143c4da7b9cf30edcc3c3ab0
  Complete output (31 lines):
  Traceback (most recent call last):
    File "setup.py", line 214, in <module>
      do_setup(package_data)
    File "setup.py", line 136, in do_setup
      setup(
    File "C:\Users\johnn\AppData\Local\Temp\pip-build-env-8dy_kf5o\overlay\Lib\site-packages\setuptools\__init__.py", line 152, in setup
      _install_setup_requires(attrs)
    File "C:\Users\johnn\AppData\Local\Temp\pip-build-env-8dy_kf5o\overlay\Lib\site-packages\setuptools\__init__.py", line 147, in _install_setup_requires
      dist.fetch_build_eggs(dist.setup_requires)
    File "C:\Users\johnn\AppData\Local\Temp\pip-build-env-8dy_kf5o\overlay\Lib\site-packages\setuptools\build_meta.py", line 60, in fetch_build_eggs
      raise SetupRequirementsError(specifier_list)
  setuptools.build_meta.SetupRequirementsError: ['cython', 'numpy', 'setuptools>=18.0']

  During handling of the above exception, another exception occurred:

  Traceback (most recent call last):
    File "C:\Users\johnn\Anaconda3\lib\site-packages\pip\_vendor\pep517\_in_process.py", line 280, in <module>
      main()
    File "C:\Users\johnn\Anaconda3\lib\site-packages\pip\_vendor\pep517\_in_process.py", line 263, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "C:\Users\johnn\Anaconda3\lib\site-packages\pip\_vendor\pep517\_in_process.py", line 114, in get_requires_for_build_wheel
      return hook(config_settings)
    File "C:\Users\johnn\AppData\Local\Temp\pip-build-env-8dy_kf5o\overlay\Lib\site-packages\setuptools\build_meta.py", line 149, in get_requires_for_build_wheel
      return self._get_build_requires(
    File "C:\Users\johnn\AppData\Local\Temp\pip-build-env-8dy_kf5o\overlay\Lib\site-packages\setuptools\build_meta.py", line 130, in _get_build_requires
      self.run_setup()
    File "C:\Users\johnn\AppData\Local\Temp\pip-build-env-8dy_kf5o\overlay\Lib\site-packages\setuptools\build_meta.py", line 145, in run_setup
      exec(compile(code, __file__, 'exec'), locals())
    File "setup.py", line 217, in <module>
      os.unlink(fairseq_examples)
  PermissionError: [WinError 5] Access is denied: 'fairseq\\examples'
  ----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\johnn\Anaconda3\python.exe' 'C:\Users\johnn\Anaconda3\lib\site-packages\pip\_vendor\pep517\_in_process.py' get_requires_

my solution is below我的解决方案如下

git clone https://github.com/pytorch/fairseq
cd fairseq

activate env(that you created existed)
pip install --editable .

TL; TL; DR: conda install fairseq --channel conda-forge DR: conda install fairseq --channel conda-forge


Conda Channels康达频道

Unfortunately, fairseq is not in the list of default conda channel.不幸的是, fairseq不在默认 conda 频道列表中。 However, you can use但是,您可以使用

conda install fairseq --channel conda-forge

to install fairseq .安装fairseq The option --channel ( -c for short) specifies the channel (it uses conda-forge in here) for conda to retrieve packages.选项--channel (简称-c )指定通道(它在这里使用conda-forge )供 conda 检索包。 You get a more detailed description in Conda channels |您可以在Conda 频道中获得更详细的描述 | Conda Dos . 康达·多斯

A similar example is when you follow the offical guide to install PyTorch with conda, it gives一个类似的例子是当你按照官方指南使用 conda 安装 PyTorch时,它给出

conda install pytorch torchvision torchaudio cudatoolkit=11.3 -c pytorch

which means you install these 3 packages through channel pytorch .这意味着您通过通道pytorch安装这 3 个软件包。

About fairseq关于fairseq

If you simply would like to use fairseq rather than doing some specialized modifications (eg create an experimental neural network structure for research), conda install is enough.如果您只是想使用fairseq而不是进行一些专门的修改(例如创建一个实验性神经网络结构进行研究), conda install就足够了。 Otherwise, it is recommended to install as @yeonsook kwak said.否则,建议按照@yeonsook kwak说的安装。 The option --editable ( -e for short) means you can directly do editions in this pulled repository.选项--editable (简称-e )意味着您可以直接在这个拉取的存储库中进行编辑。

conda install vs pip install康达conda installpip install

One advantage of doing conda install (instead of pip install ) is that you can share the packages through all conda environments, which may save disk spaces.进行 conda conda install (而不是pip install )的一个优点是您可以通过所有 conda 环境共享包,这可以节省磁盘空间。 However, if you would like to install the same package but with different versions in different environments, you should use pip install .但是,如果您想在不同的环境中安装相同的 package 但版本不同,则应使用pip install

A possible drawback for conda install is the package from external channels may not be the lastest comparing to those from PyPI/offical source. conda conda install的一个可能缺点是来自外部渠道的 package 与来自 PyPI/官方来源的相比可能不是最新的。

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

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