カテゴリー: Mac

  • pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.

    pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.

    はじめに Introduction

    macでpip installを行った際、以下のようなエラーが出てinstallができなかった。

    When pip install was performed on mac, the following error occurred and installation failed.

     

    $ pip3 install numpy
    pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
    Collecting numpy
      Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/numpy/
      Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/numpy/
      Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/numpy/
      Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/numpy/
      Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/numpy/
      Could not fetch URL https://pypi.org/simple/numpy/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/numpy/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
      Could not find a version that satisfies the requirement numpy (from versions: )
    No matching distribution found for numpy
    pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
    Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping

    原因 Cause of the problem

    SSL通信ができない?

    Can’t SSL communication?

    対処 countermeasure

    admin権限を持つアカウントで同様のコマンドを実行したところ、無事インストールができた。 おそらく権限周りの問題が根幹にあるようだ。

    When I executed the same command with an account with admin privileges, the installation was successful. Perhaps there is a problem around authority.

  • macでcronがうまく動かない

    macでcronがうまく動かない

    はじめに

    決まった時間に処理を行いたい時、cronを設定することが多い。しかし、時間を設定するとなぜかうまく動かない。ということが発生した。

    ダメだった例

    0 0 * * * mkdir -p ~/Documents/Downloads/`/bin/date +%Y%m%d`

    毎日0時0分にディレクトリを作りたい。
    ~/Documents/Downloads/配下に日付ディレクトリを作りたかったが、うまく動かなかった。

    対処

    macでは%は区切り文字として認識されてしまう。 そのため、%の前では¥でエスケープしてあげる必要があることがわかった。

    0 0 * * * mkdir -p ~/Documents/Downloads/`/bin/date +\%Y\%m\%d`

    Linuxでは必要ないが、macでは必要らしい。 これで期待通りディレクトリが作成されるようになった。