LoginSignup
1
0

More than 1 year has passed since last update.

pip3 installでエラー [Errno 13] Permission denied

Last updated at Posted at 2021-08-28

やりたいこと

NanoPlotツールをPyPIからダウンロードして、インストールする

PyPIとは?
インターネット上にあるPythonパッケージの貯蔵庫
https://pypi.python.org/pypi

実行結果

Terminal
% pip3 install NanoPlot      
DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621
Collecting NanoPlot
  Using cached NanoPlot-1.38.1-py3-none-any.whl
Requirement already satisfied: python-dateutil in /usr/local/lib/python3.9/site-packages (from NanoPlot) (2.8.2)
Collecting kaleido
  Using cached kaleido-0.2.1-py2.py3-none-macosx_10_11_x86_64.whl (85.2 MB)
Collecting pandas>=1.1.0
  Using cached pandas-1.3.2-cp39-cp39-macosx_10_9_x86_64.whl (11.6 MB)
Collecting pysam>0.10.0.0
  Using cached pysam-0.16.0.1.tar.gz (3.6 MB)
Collecting pyarrow
  Using cached pyarrow-5.0.0-cp39-cp39-macosx_10_13_x86_64.whl (17.6 MB)
Collecting plotly>=4.1.0
  Using cached plotly-5.2.2-py2.py3-none-any.whl (21.8 MB)
Collecting nanoget>=1.14.0
  Using cached nanoget-1.16.1-py3-none-any.whl
Collecting scipy
  Using cached scipy-1.7.1-cp39-cp39-macosx_10_9_x86_64.whl (32.8 MB)
Requirement already satisfied: numpy>=1.16.5 in /usr/local/lib/python3.9/site-packages (from NanoPlot) (1.21.2)
Collecting biopython
  Using cached biopython-1.79-cp39-cp39-macosx_10_9_x86_64.whl (2.3 MB)
Collecting nanomath>=1.0.0
  Using cached nanomath-1.2.1-py3-none-any.whl
Requirement already satisfied: Python-Deprecated in /usr/local/lib/python3.9/site-packages (from nanomath>=1.0.0->NanoPlot) (1.1.0)
Requirement already satisfied: pytz>=2017.3 in /usr/local/lib/python3.9/site-packages (from pandas>=1.1.0->NanoPlot) (2021.1)
Requirement already satisfied: six in /usr/local/lib/python3.9/site-packages (from plotly>=4.1.0->NanoPlot) (1.16.0)
Requirement already satisfied: tenacity>=6.2.0 in /usr/local/lib/python3.9/site-packages (from plotly>=4.1.0->NanoPlot) (8.0.1)
Building wheels for collected packages: pysam
  Building wheel for pysam (setup.py) ... done
  Created wheel for pysam: filename=pysam-0.16.0.1-cp39-cp39-macosx_11_0_x86_64.whl size=2723096 sha256=b40d087b736e7f1b7d83bba01eadb34c8778fe93802fdb64bb844e1fdd671ea7
  Stored in directory: /Users/You/Library/Caches/pip/wheels/fb/96/5b/d62b12ccae437c41f0368bca424aa34b6d3f9fef4a38640edc
Successfully built pysam
Installing collected packages: pysam, pandas, biopython, scipy, pyarrow, plotly, nanomath, nanoget, kaleido, NanoPlot
  DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621
  DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621
  DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621
  DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621
  DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621
  DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621
ERROR: Could not install packages due to an OSError: [Errno 13] Permission denied: '/usr/local/LICENSE'
Consider using the `--user` option or check the permissions.
%

最後にエラーが出てますね。

Terminal
ERROR: Could not install packages due to an OSError: [Errno 13] Permission denied: '/usr/local/LICENSE'
Consider using the `--user` option or check the permissions.

エラーメッセージによると--userオプションを使うか、実行権限を確認しろとのこと。
--userオプションについてヘルプを見てみる。

Terminal
% pip3 install --help
・・・以下省略
  --user                      Install to the Python user install directory for
                              your platform. Typically ~/.local/, or
                              %APPDATA%\Python on Windows. (See the Python
                              documentation for site.USER_BASE for full
                              details.)

--userオプションをつけるとパッケージがインストールされるディレクトリが違う。
user install では管理者権限の必要ないホームディレクトリ下の ~/.local下にパッケージがインストールされる。
※ちなみに--userオプションなしのpip installでは管理者権限が必要な /usr下にパッケージがインストールされる。

エラーメッセージにある通りに--userオプションをつけて実行

インストールはうまくいった!

% pip3 install NanoPlot --user
Collecting NanoPlot
  Using cached NanoPlot-1.38.1-py3-none-any.whl
Requirement already satisfied: scipy in /usr/local/lib/python3.9/site-packages (from NanoPlot) (1.7.1)
Requirement already satisfied: numpy>=1.16.5 in /usr/local/lib/python3.9/site-packages (from NanoPlot) (1.21.2)
Collecting nanoget>=1.14.0
  Using cached nanoget-1.16.1-py3-none-any.whl
Requirement already satisfied: pysam>0.10.0.0 in /usr/local/lib/python3.9/site-packages (from NanoPlot) (0.16.0.1)
Requirement already satisfied: pandas>=1.1.0 in /usr/local/lib/python3.9/site-packages (from NanoPlot) (1.3.2)
Requirement already satisfied: plotly>=4.1.0 in /usr/local/lib/python3.9/site-packages (from NanoPlot) (5.2.2)
Requirement already satisfied: pyarrow in /usr/local/lib/python3.9/site-packages (from NanoPlot) (5.0.0)
Requirement already satisfied: nanomath>=1.0.0 in /usr/local/lib/python3.9/site-packages (from NanoPlot) (1.2.1)
Requirement already satisfied: python-dateutil in /usr/local/lib/python3.9/site-packages (from NanoPlot) (2.8.2)
Collecting kaleido
  Using cached kaleido-0.2.1-py2.py3-none-macosx_10_11_x86_64.whl (85.2 MB)
Requirement already satisfied: biopython in /usr/local/lib/python3.9/site-packages (from NanoPlot) (1.79)
Requirement already satisfied: Python-Deprecated in /usr/local/lib/python3.9/site-packages (from nanomath>=1.0.0->NanoPlot) (1.1.0)
Requirement already satisfied: pytz>=2017.3 in /usr/local/lib/python3.9/site-packages (from pandas>=1.1.0->NanoPlot) (2021.1)
Requirement already satisfied: six in /usr/local/lib/python3.9/site-packages (from plotly>=4.1.0->NanoPlot) (1.16.0)
Requirement already satisfied: tenacity>=6.2.0 in /usr/local/lib/python3.9/site-packages (from plotly>=4.1.0->NanoPlot) (8.0.1)
Installing collected packages: nanoget, kaleido, NanoPlot
  WARNING: The script NanoPlot is installed in '/Users/You/Library/Python/3.9/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed NanoPlot-1.38.1 kaleido-0.2.1 nanoget-1.16.1
%

実行してみる。

Terminal
% NanoPlot
zsh: command not found: NanoPlot

あれ、動かない。
よくみるとインストールの時、最後に警告メッセージがついてた。

Terminal
WARNING: The script NanoPlot is installed in '/Users/You/Library/Python/3.9/bin' which is not on PATH.
  Consider adding this directory to PATH

PATHが通っていないらいい。--userオプションをつけたからか。
エラーメッセージの通りにパスを通す。

Terminal
% export PATH=/Users/You/Library/Python/3.9/bin:$PATH

動作確認。

Terminal

% NanoPlot                                              
usage: NanoPlot [-h] [-v] [-t THREADS] [--verbose] [--store] [--raw] [--huge] [-o OUTDIR] [-p PREFIX]
                [--tsv_stats] [--info_in_report] [--maxlength N] [--minlength N] [--drop_outliers]
                [--downsample N] [--loglength] [--percentqual] [--alength] [--minqual N]
                [--runtime_until N] [--readtype {1D,2D,1D2}] [--barcoded] [--no_supplementary]
                [-c COLOR] [-cm COLORMAP] [-f {png,jpg,jpeg,webp,svg,pdf,eps,json}]
                [--plots [{kde,hex,dot} ...]] [--legacy [{kde,dot,hex} ...]] [--listcolors]
                [--listcolormaps] [--no-N50] [--N50] [--title TITLE] [--font_scale FONT_SCALE]
                [--dpi DPI] [--hide_stats]
                (--fastq file [file ...] | --fasta file [file ...] | --fastq_rich file [file ...] | --fastq_minimal file [file ...] | --summary file [file ...] | --bam file [file ...] | --ubam file [file ...] | --cram file [file ...] | --pickle pickle | --feather file [file ...])
NanoPlot: error: one of the arguments --fastq --fasta --fastq_rich --fastq_minimal --summary --bam --ubam --cram --pickle --feather is required

できた!
以上です。

参考にした記事

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0