簡體   English   中英

Conda 軟件包安裝 [Errno 13] 安裝 conda-forge::protobuf-3.8.0 時權限被拒絕

[英]Conda package install [Errno 13] Permission denied while installing conda-forge::protobuf-3.8.0

我有一個使用 Python 3.6 的 conda 環境,但我的 Pytorch 安裝出現問題,所以我嘗試再次安裝它。 在安裝結束時,我收到此錯誤:

ERROR conda.core.link:_execute(700): An error occurred while installing package 'conda-forge::protobuf-3.8.0-py36h6de7cb9_1'.
Rolling back transaction: done

[Errno 13] Permission denied: '/Users/myusername/anaconda3/envs/torch/lib/python3.6/site-packages/google/protobuf/__init__.py'
()

此外,它說“環境不一致”,這可能是一個線索已經出了問題。

完整細節:

$ conda install pytorch torchvision -c pytorch
Collecting package metadata (current_repodata.json): done
Solving environment: - 
The environment is inconsistent, please check the package plan carefully
The following packages are causing the inconsistency:

  - conda-forge/osx-64::tensorboard==1.14.0=py36_0
  - conda-forge/noarch::tensorboardx==1.9=py_0
done

## Package Plan ##

  environment location: /Users/myusername/anaconda3/envs/torch

  added / updated specs:
    - pytorch
    - torchvision


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    intel-openmp-2019.4        |              233         887 KB
    mkl-2019.4                 |              233       101.9 MB
    pytorch-1.3.1              |          py3.6_0        32.7 MB  pytorch
    torchvision-0.4.2          |         py36_cpu         5.9 MB  pytorch
    ------------------------------------------------------------
                                           Total:       141.4 MB

The following NEW packages will be INSTALLED:

  intel-openmp       pkgs/main/osx-64::intel-openmp-2019.4-233
  libprotobuf        conda-forge/osx-64::libprotobuf-3.8.0-hfbae3c0_0
  mkl                pkgs/main/osx-64::mkl-2019.4-233
  protobuf           conda-forge/osx-64::protobuf-3.8.0-py36h6de7cb9_1
  pytorch            pytorch/osx-64::pytorch-1.3.1-py3.6_0
  torchvision        pytorch/osx-64::torchvision-0.4.2-py36_cpu

The following packages will be UPDATED:

  openssl                                 1.1.1c-h01d97ff_0 --> 1.1.1d-h0b31af3_0


Proceed ([y]/n)? y


Downloading and Extracting Packages
pytorch-1.3.1        | 32.7 MB   | ##################################### | 100% 
torchvision-0.4.2    | 5.9 MB    | ##################################### | 100% 
mkl-2019.4           | 101.9 MB  | ##################################### | 100% 
intel-openmp-2019.4  | 887 KB    | ##################################### | 100% 
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
ERROR conda.core.link:_execute(700): An error occurred while installing package 'conda-forge::protobuf-3.8.0-py36h6de7cb9_1'.
Rolling back transaction: done

[Errno 13] Permission denied: '/Users/myusername/anaconda3/envs/torch/lib/python3.6/site-packages/google/protobuf/__init__.py'
()

更新:我嘗試卸載 tensorboard 和 tensorboardx 但發生了同樣的錯誤,阻止了卸載。

還:

嘗試pip uninstall protobuf但這導致了類似的錯誤:

Uninstalling protobuf-3.10.0:
  Would remove:
...


ERROR: Exception:
Traceback (most recent call last):
  File "/Users/myusername/anaconda3/envs/torch/lib/python3.6/shutil.py", line 544, in move
    os.rename(src, real_dst)
PermissionError: [Errno 13] Permission denied: '/Users/myusername/anaconda3/envs/torch/lib/python3.6/site-packages/google/protobuf/' -> '/Users/myusername/anaconda3/envs/torch/lib/python3.6/site-packages/google/~-otobuf'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/myusername/anaconda3/envs/torch/lib/python3.6/site-packages/pip/_internal/cli/base_command.py", line 153, in _main
    status = self.run(options, args)
  File "/Users/myusername/anaconda3/envs/torch/lib/python3.6/site-packages/pip/_internal/commands/uninstall.py", line 79, in run
    auto_confirm=options.yes, verbose=self.verbosity > 0,
  File "/Users/myusername/anaconda3/envs/torch/lib/python3.6/site-packages/pip/_internal/req/req_install.py", line 755, in uninstall
    uninstalled_pathset.remove(auto_confirm, verbose)
  File "/Users/myusername/anaconda3/envs/torch/lib/python3.6/site-packages/pip/_internal/req/req_uninstall.py", line 394, in remove
    moved.stash(path)
  File "/Users/myusername/anaconda3/envs/torch/lib/python3.6/site-packages/pip/_internal/req/req_uninstall.py", line 283, in stash
    renames(path, new_path)
  File "/Users/myusername/anaconda3/envs/torch/lib/python3.6/site-packages/pip/_internal/utils/misc.py", line 338, in renames
    shutil.move(old, new)
  File "/Users/myusername/anaconda3/envs/torch/lib/python3.6/shutil.py", line 556, in move
    rmtree(src)
  File "/Users/myusername/anaconda3/envs/torch/lib/python3.6/shutil.py", line 494, in rmtree
    return _rmtree_unsafe(path, onerror)
  File "/Users/myusername/anaconda3/envs/torch/lib/python3.6/shutil.py", line 389, in _rmtree_unsafe
    onerror(os.unlink, fullname, sys.exc_info())
  File "/Users/myusername/anaconda3/envs/torch/lib/python3.6/shutil.py", line 387, in _rmtree_unsafe
    os.unlink(fullname)
PermissionError: [Errno 13] Permission denied: '/Users/myusername/anaconda3/envs/torch/lib/python3.6/site-packages/google/protobuf/descriptor.py'

除了刪除整個環境並重新開始之外,我不知道如何解決這個問題。

當我嘗試從我的環境中更新/卸載 python 包(matplotlib)時,我遇到了類似的錯誤。 原因原來是我有另一個正在運行的 python 應用程序,並且打開了一個 matplotlib 繪圖窗口,因此由於進程正在訪問該包,因此無法刪除它。 當我關閉所有 python 程序時,我能夠在沒有權限錯誤的情況下升級包。

故事如此寓意,如果您嘗試更新/卸載軟件包,請確保所有 python 腳本都沒有運行

感謝這個答案,我找到了一個似乎解決了問題的解決方案:

sudo pip uninstall protobuf

其次是

conda install pytorch torchvision -c pytorch

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM