ablog

不器用で落着きのない技術者のメモ

Python shell ジョブで six と python_dateutil をインストールする

閉域構成(ジョブにダミー接続をアタッチしてVPC内のみアクセス可能

  • Python ライブラリパス
s3://az2-pypi-org/six-1.14.0-py2.py3-none-any.whl,s3://az2-pypi-org/python_dateutil-2.8.1-py2.py3-none-any.whl
  • ログ
Processing ./glue-python-libs-y3k8nvty/six-1.14.0-py2.py3-none-any.whl
Installing collected packages: six
Successfully installed six-1.14.0
Processing ./glue-python-libs-y3k8nvty/python_dateutil-2.8.1-py2.py3-none-any.whl
  • エラーログ
ERROR: Could not find a version that satisfies the requirement six>=1.5 (from python-dateutil==2.8.1) (from versions: none)
ERROR: No matching distribution found for six>=1.5 (from python-dateutil==2.8.1)
Traceback (most recent call last):
  File "/tmp/runscript.py", line 112, in <module>
    download_and_install(args.extra_py_files)
  File "/tmp/runscript.py", line 62, in download_and_install
    subprocess.check_call([sys.executable, "-m", "pip", "install", "--target=
{}
".format(install_path), local_file_path])
  File "/usr/local/lib/python3.6/subprocess.py", line 311, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/usr/local/bin/python', '-m', 'pip', 'install', '--target=/glue/lib/installation', '/tmp/glue-python-libs-y3k8nvty/python_dateutil-2.8.1-py2.py3-none-any.whl']' returned non-zero exit status 1.

インターネットに接続可能な構成(ダミー接続をアタッチしない)

  • Python ライブラリパス
s3://az2-pypi-org/six-1.14.0-py2.py3-none-any.whl,s3://az2-pypi-org/python_dateutil-2.8.1-py2.py3-none-any.whl
  • ログ
2020-05-06 06:11:44
Processing ./glue-python-libs-s9pm1m37/six-1.14.0-py2.py3-none-any.whl
Installing collected packages: six
Successfully installed six-1.14.0
Processing ./glue-python-libs-s9pm1m37/python_dateutil-2.8.1-py2.py3-none-any.whl
Collecting six>=1.5
  Downloading https://files.pythonhosted.org/packages/65/eb/1f97cb97bfc2390a276969c6fae16075da282f5058082d4cb10c6c5c1dba/six-1.14.0-py2.py3-none-any.whl
Installing collected packages: six, python-dateutil
Successfully installed python-dateutil-2.8.1 six-1.14.0
1.13.0

閉域構成で six のみインストールしてバージョンを表示させてみる

import six as s
print(s.__version__)
  • Python ライブラリパス
s3://az2-pypi-org/six-1.14.0-py2.py3-none-any.whl
  • ログ
2020-05-16 13:39:03
Processing ./glue-python-libs-pfjk11d6/six-1.14.0-py2.py3-none-any.whl
Installing collected packages: six
Successfully installed six-1.14.0
1.13.01.14 をインストールしているのに、1.13 と表示されている

閉域構成で six をインストールせずにバージョンを表示する

import six as s
print(s.__version__)
print(s.__file__)
print(s.__loader__)
print(s.__package__ )
  • ログ
1.13.0
/usr/local/lib/python3.6/site-packages/six.py ★/glue/lib/installation ではなくデフォルトのライブラリパスを参照している
<_frozen_importlib_external.SourceFileLoader object at 0x7f102c3dad68>
six

EC2 で確認

$ pyenv versions
  system
* 3.6.9 (set by /home/ec2-user/.pyenv/version)
$ pip install six
Collecting six
  Using cached https://files.pythonhosted.org/packages/65/eb/1f97cb97bfc2390a276969c6fae16075da282f5058082d4cb10c6c5c1dba/six-1.14.0-py2.py3-none-any.whl
Installing collected packages: six
Successfully installed six-1.14.0
$ pip install python_dateutil
Collecting python_dateutil
  Using cached https://files.pythonhosted.org/packages/d4/70/d60450c3dd48ef87586924207ae8907090de0b306af2bce5d134d78615cb/python_dateutil-2.8.1-py2.py3-none-any.whl
Requirement already satisfied: six>=1.5 in ./.pyenv/versions/3.6.9/lib/python3.6/site-packages (from python_dateutil) (1.14.0) ★インストール済と認識されている
Installing collected packages: python-dateutil
Successfully installed python-dateutil-2.8.1

設定

import six as s
print(s.__package__ )
print(s.__version__)
print(s.__file__)
print(s.__loader__)
  • Python ライブラリパス
s3://az2-pypi-org/six-1.14.0-py2.py3-none-any.whl,s3://az2-pypi-org/python_dateutil-2.8.1-py2.py3-none-any.whl
  • 接続
    • タイプ: JDBC
    • JDBC URL: jdbc:mysql://example.com:3306/example
    • VPC ID: vpc-******
    • サブネット: subnet-******
    • セキュリティグループ: sg-******
    • ユーザー名: dummy