【问题标题】:pip install trains failspip install tr​​ains 失败
【发布时间】:2021-01-26 01:32:07
【问题描述】:

在我的虚拟环境中运行 pip install trains

我得到了

    ERROR: Command errored out with exit status 1:
     command: /home/epdadmin/noam/code/venv_linux/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-owzh8lnl/retrying/setup.py'"'"'; __file__='"'"'/tmp/pip-install-owzh8lnl/retrying/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-lxz5t8pu/install-record.txt --single-version-externally-managed --compile --install-headers /home/epdadmin/noam/code/venv_linux/include/site/python3.8/retrying
         cwd: /tmp/pip-install-owzh8lnl/retrying/
    Complete output (10 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib
    copying retrying.py -> build/lib
    running install_lib
    copying build/lib/retrying.py -> /home/epdadmin/noam/code/venv_linux/lib/python3.8/site-packages
    byte-compiling /home/epdadmin/noam/code/venv_linux/lib/python3.8/site-packages/retrying.py to retrying.cpython-38.pyc
    error: [Errno 13] Permission denied: '/home/epdadmin/noam/code/venv_linux/lib/python3.8/site-packages/__pycache__/retrying.cpython-38.pyc.139678407381360'
    ----------------------------------------
ERROR: Command errored out with exit status 1: /home/epdadmin/noam/code/venv_linux/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-owzh8lnl/retrying/setup.py'"'"'; __file__='"'"'/tmp/pip-install-owzh8lnl/retrying/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-lxz5t8pu/install-record.txt --single-version-externally-managed --compile --install-headers /home/epdadmin/noam/code/venv_linux/include/site/python3.8/retrying Check the logs for full command output.

我知道I am not supposed to run under sudo when using a venv,所以我不太明白这个问题

例如运行pip install pandas 确实有效。

Python 3.8

如何安装火车?


编辑:

运行pip install trains --userpip install --user trains 给出

ERROR: Can not perform a '--user' install. User site-packages are not visible in this virtualenv.

【问题讨论】:

  • 看起来你已经通过在激活 venv 时以 root 身份运行命令来破坏你的 venv。恢复所有权:运行id -un 获取名称,运行id -gn 获取组,然后运行sudo chown -R name:grp /home/epdadmin/noam/code/venv_linux/,将namegrp 替换为您之前获得的值。然后重试pip install trains
  • pip install pandas 可能只起作用,因为您已经安装了pandas,所以pip 没有做任何事情。尝试例如pip install pandas --force-reinstall,很可能它也会失败。
  • @hoefling 强制重新安装没有失败

标签: python pip trains clearml


【解决方案1】:

我在 Ubuntu 18 中安装 matplotlib 时遇到了同样的错误。

运行这些行对我有用:

sudo apt-get install python3-dev
apt-get install build-essential

setup script exited with error: command 'x86_64-linux-gnu-gcc' failed with exit status 1上发现

【讨论】:

    【解决方案2】:

    问题是 venv 的权限问题。 另一个问题是 train 需要一些 Python3.8 上还没有带轮子的包,所以我不得不将 Python 降级到 3.7

    该 venv 是使用 Pycharm 创建的,出于某种原因,它是使用低权限创建的。

    可能有一种方法可以提升它的权限,但我只是删除了它并使用命令行创建了另一个

    python -m virtualenv --python=/usr/bin/python3.7 venv
    

    现在pip install trains 工作了。

    很烦人。

    【讨论】:

      【解决方案3】:

      你有两个选择:

      1. 创建一个虚拟环境并在其中安装你的包(首选)

      2. 通过传递 --user 标志在你的用户主目录中安装你的包

        pip install --user

      【讨论】:

      • 谢谢。 1. 我已经在虚拟环境中,现在将编辑(虽然它在日志中)。 2.我试过了,得到ERROR: Can not perform a '--user' install. User site-packages are not visible in this virtualenv.
      • @Gulzar 你能卸载retrying 包并重试吗?
      • 怎么样?我会输入你告诉我的命令。我是 Windows 的老用户,我只需要让我的 Python 在远程 linux 机器上工作,所以我真的不知道 linux 命令
      • @Martin.B 在卸载后尝试pip install retrying 时出现同样的错误。如何解决此权限问题?它只发生在某些安装上,而不是其他安装上。
      猜你喜欢
      • 1970-01-01
      • 2015-12-22
      • 2012-09-24
      • 2018-10-11
      • 2015-05-05
      • 2021-03-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多