概要
ccxtを用いたソースをgithubからCloneし、Cloud9で動かすときにはまったので防備録
Gitのインストール
sudo yum -y update
sudo yum -y install git
Gitのconfig設定
git IDとメールアドレスを登録
git config --global user.name "USER_NAME"
git config --global user.email mailaddress
GithubからClone
Cloneしたいgithubのページに行って、cloneしてくるレポジトリのURLをコピーし、
git clone "URL"
Cloneできた!
permissions関連のエラー?
ccxtを使っているソースコードをRunしようとした際にエラーが出たのでpipで入れたいと思い、
pip3 install ccxt
とするがなんかエラーがでる。
Collecting ccxt
Using cached https://files.pythonhosted.org/packages/ea/49/1675b8d8e4cf90e19a717aa09e877dd155da2c10a0b30b5491fc586b0bec/ccxt-1.16.68-py2.py3-none-any.whl
Collecting yarl==1.1.0; python_version >= "3.5.3" (from ccxt)
Downloading https://files.pythonhosted.org/packages/9a/fe/1fc0d9e277f1ff0d29ac44742f769c55f12cc7e66a89ab340f5321937179/yarl-1.1.0-cp36-cp36m-manylinux1_x86_64.whl (255kB)
100% |████████████████████████████████| 256kB 5.6MB/s
Collecting cchardet==2.1.1; python_version >= "3.5.3" (from ccxt)
Downloading https://files.pythonhosted.org/packages/f9/0a/330740ba16f34599173fe7567baf4d847f31772bafd99f74c08e608701f6/cchardet-2.1.1-cp36-cp36m-manylinux1_x86_64.whl (202kB)
100% |████████████████████████████████| 204kB 6.2MB/s
Collecting certifi>=2018.1.18 (from ccxt)
Using cached https://files.pythonhosted.org/packages/7c/e6/92ad559b7192d846975fc916b65f667c7b8c3a32bea7372340bfe9a15fa5/certifi-2018.4.16-py2.py3-none-any.whl
Collecting setuptools>=38.5.1 (from ccxt)
Downloading https://files.pythonhosted.org/packages/ff/f4/385715ccc461885f3cedf57a41ae3c12b5fec3f35cce4c8706b1a112a133/setuptools-40.0.0-py2.py3-none-any.whl (567kB)
100% |████████████████████████████████| 573kB 8.3MB/s
Collecting aiodns==1.1.1; python_version >= "3.5.3" (from ccxt)
Downloading https://files.pythonhosted.org/packages/bd/f5/b69cb930fd5ab0569396659afe3f3c0d37d4098e5d0ba6afdf6fd9388cb0/aiodns-1.1.1-py2.py3-none-any.whl
Collecting requests>=2.18.4 (from ccxt)
Using cached https://files.pythonhosted.org/packages/65/47/7e02164a2a3db50ed6d8a6ab1d6d60b69c4c3fdf57a284257925dfc12bda/requests-2.19.1-py2.py3-none-any.whl
Collecting aiohttp>=3.0.1; python_version >= "3.5.3" (from ccxt)
Downloading https://files.pythonhosted.org/packages/54/f9/8b47199ceae89a867edc45c43dc908384fd2e1ac22406b60d101d988752b/aiohttp-3.3.2-cp36-cp36m-manylinux1_x86_64.whl (876kB)
100% |████████████████████████████████| 880kB 10.6MB/s
Collecting idna>=2.0 (from yarl==1.1.0; python_version >= "3.5.3"->ccxt)
Using cached https://files.pythonhosted.org/packages/4b/2a/0276479a4b3caeb8a8c1af2f8e4355746a97fab05a372e4a2c6a6b876165/idna-2.7-py2.py3-none-any.whl
Collecting multidict>=4.0 (from yarl==1.1.0; python_version >= "3.5.3"->ccxt)
Downloading https://files.pythonhosted.org/packages/cc/30/508a22a28dfb50cf9079cd9d0cf9b0d7dbae5afdf9823977351cbd548897/multidict-4.3.1-cp36-cp36m-manylinux1_x86_64.whl (476kB)
100% |████████████████████████████████| 481kB 11.0MB/s
Collecting pycares>=1.0.0 (from aiodns==1.1.1; python_version >= "3.5.3"->ccxt)
Downloading https://files.pythonhosted.org/packages/e1/77/911ea81174e050ec854f19eeed9ddc40f9e6d3fd1e45d79ac2d5c26c15c1/pycares-2.3.0-cp36-cp36m-manylinux1_x86_64.whl (200kB)
100% |████████████████████████████████| 204kB 12.2MB/s
Collecting urllib3<1.24,>=1.21.1 (from requests>=2.18.4->ccxt)
Using cached https://files.pythonhosted.org/packages/bd/c9/6fdd990019071a4a32a5e7cb78a1d92c53851ef4f56f62a3486e6a7d8ffb/urllib3-1.23-py2.py3-none-any.whl
Collecting chardet<3.1.0,>=3.0.2 (from requests>=2.18.4->ccxt)
Using cached https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl
Collecting idna-ssl>=1.0 (from aiohttp>=3.0.1; python_version >= "3.5.3"->ccxt)
Downloading https://files.pythonhosted.org/packages/46/03/07c4894aae38b0de52b52586b24bf189bb83e4ddabfe2e2c8f2419eec6f4/idna-ssl-1.1.0.tar.gz
Collecting async-timeout<4.0,>=3.0 (from aiohttp>=3.0.1; python_version >= "3.5.3"->ccxt)
Downloading https://files.pythonhosted.org/packages/96/0f/e6357458c87fb4ed8f3df215773f3caad40968f10e05552cbd8bd28415e4/async_timeout-3.0.0-py3-none-any.whl
Collecting attrs>=17.3.0 (from aiohttp>=3.0.1; python_version >= "3.5.3"->ccxt)
Downloading https://files.pythonhosted.org/packages/41/59/cedf87e91ed541be7957c501a92102f9cc6363c623a7666d69d51c78ac5b/attrs-18.1.0-py2.py3-none-any.whl
Building wheels for collected packages: idna-ssl
Running setup.py bdist_wheel for idna-ssl ... done
Stored in directory: /home/ec2-user/.cache/pip/wheels/d3/00/b3/32d613e19e08a739751dd6bf998cfed277728f8b2127ad4eb7
Successfully built idna-ssl
Installing collected packages: idna, multidict, yarl, cchardet, certifi, setuptools, pycares, aiodns, urllib3, chardet, requests, idna-ssl, async-timeout, attrs, aiohttp, ccxt
Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/usr/lib/python3.6/dist-packages/idna'
Consider using the `--user` option or check the permissions.
#pipが使えなくなる
sudo pip install ccxt
sudo: pip: command not found
pipをもう一度インストール
sudo python get-pip.py
Collecting pip
Using cached https://files.pythonhosted.org/packages/0f/74/ecd13431bcc456ed390b44c8a6e917c1820365cbebcb6a8974d1cd045ab4/pip-10.0.1-py2.py3-none-any.whl
Collecting wheel
Using cached https://files.pythonhosted.org/packages/81/30/e935244ca6165187ae8be876b6316ae201b71485538ffac1d718843025a9/wheel-0.31.1-py2.py3-none-any.whl
cloud-init 0.7.6 requires argparse, which is not installed.
cloud-init 0.7.6 requires cheetah, which is not installed.
cloud-init 0.7.6 requires oauth, which is not installed.
cloud-init 0.7.6 requires PrettyTable, which is not installed.
cloud-init 0.7.6 requires pyserial, which is not installed.
Installing collected packages: pip, wheel
Found existing installation: pip 10.0.1
Uninstalling pip-10.0.1:
Successfully uninstalled pip-10.0.1
The script wheel is installed in '/usr/local/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 pip-10.0.1 wheel-0.31.1
これは成功
ccxtをさがす
pip3 search ccxt
ccxt (1.16.68) - A JavaScript / Python / PHP cryptocurrency trading library with support for 100+ exchanges
ccxt-python (0.0.1) - A JavaScript / Python / PHP cryptocurrency trading library with support for 100+ exchanges
見つかるようだ
ここでもう一回
pip3 install ccxt
とかやると上に戻ってしまうので
先ほど出てたエラー
"Consider using the --user
option or check the permissions"
に対処するにはpip3のフルパスを指定∧sudoで実行のようだ。
pip3のパスを探す
which pip3
/usr/local/bin/pip3
sudo でフルパスでpip3でccxtをインストール
sudo /usr/local/bin/pip3 install ccxt
......
Successfully installed aiodns-1.1.1 aiohttp-3.3.2 async-timeout-3.0.0 attrs-18.1.0 cchardet-2.1.1 ccxt-1.16.68 certifi-2018.4.16 chardet-3.0.4 idna-2.7 idna-ssl-1.1.0 multidict-4.3.1 pycares-2.3.0 requests-2.19.1 setuptools-40.0.0 urllib3-1.23 yarl-1.1.0
インストールできた!!
参考にしたサイト
AWS Cloud9にgithubからcloneしてくる:
http://niki12260714.hatenablog.com/entry/2018/04/20/092339
AWS Cloud 9 で CCXT が見つからない時の対処法:
https://note.mu/mman/n/n78b93fedd7d9
pip自体のインストール方法:
https://gist.github.com/wifecooky/944d4e871b9daee1ac2f88f0573f4e90