遵循文档时无法从源安装 CKAN 2.8.3

Failing to install CKAN 2.8.3 from source when following documentation

我正在尝试在新配置的 Ubuntu 18.4 VM 上安装 CKAN 2.8.3。在开始之前我已经更新了所有的 apt 包。

我按照 https://docs.ckan.org/en/latest/maintaining/installing/install-from-source.html

上的说明进行操作

我可以按照指南进行操作,直到步骤 "For Python 2 adjust the filename to: requirements-py2.txt",我认为这意味着我应该 运行 命令 "pip install -r /usr/lib/ckan/default/src/ckan/requirements-py2.txt"。该文件不存在,但 /usr/lib/ckan/default/src/ckan/requirements.txt 存在。我哪里做错了,或者文档是否已过时?

说明在普通 Ubuntu 18.4 Azure VM 上执行了哪些命令:

#Added by me
sudo apt update
sudo apt upgrade
#From the guide
mkdir -p ~/ckan/lib
sudo ln -s ~/ckan/lib /usr/lib/ckan
mkdir -p ~/ckan/etc
sudo ln -s ~/ckan/etc /etc/ckan
sudo mkdir -p /usr/lib/ckan/default
sudo chown `whoami` /usr/lib/ckan/default
virtualenv --python=/usr/bin/python2.7 --no-site-packages /usr/lib/ckan/default
. /usr/lib/ckan/default/bin/activate
pip install setuptools==36.1
pip install --upgrade pip
pip install -e 'git+https://github.com/ckan/ckan.git@ckan-2.8.3#egg=ckan'
pip install -r /usr/lib/ckan/default/src/ckan/requirements-py2.txt

此时报错没有需求-py2.txt file:

(default) myusername@myhostname:~$ pip install -r /usr/lib/ckan/default/src/ckan/requirements-py2.txt
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
ERROR: Could not open requirements file: [Errno 2] No such file or directory: '/usr/lib/ckan/default/src/ckan/requirements-py2.txt'
(default) myusername@myhostname:~$

编辑:更正 - 我不小心写了 1.8.3,而不是 2.8.3

补充: 我在这一点上也尝试过 运行

pip install -r /usr/lib/ckan/default/src/ckan/requirements.txt

这很好用,但是,如果我继续:

sudo -u postgres createuser -S -D -R -P ckan_default
sudo -u postgres createdb -O ckan_default ckan_default -E utf-8
sudo mkdir -p /etc/ckan/default
sudo chown -R `whoami` /etc/ckan/
ckan generate config /etc/ckan/default/ckan.ini

由于无法找到命令 ckan 而失败:

(default) myusername@myhostname:~$ ckan generate config /etc/ckan/default/ckan.ini

Command 'ckan' not found, did you mean:

  command 'cpan' from deb perl
  command 'ckon' from deb ckon

Try: sudo apt install <deb name>

(default) myusername@myhostname:~$

关于您在 requirements-py2.txt 文件上执行 pip requirements 命令时遇到的问题。 此文件仅存在于最新版本的 ckan 上,因为它们正在从 python 2.7 迁移到 python 3。在旧版本的 ckan 上,例如您使用的 运行ning,需求文件已经为 python 2.7

量身定制

您可能希望专门参考 ckan 2.8 的文档而不是最新版本 https://docs.ckan.org/en/2.8/maintaining/installing/install-from-source.html

第二期。 为了 运行 ckan 生成配置命令,您需要首先激活 python 虚拟环境。这是按如下方式完成的:

. /usr/lib/ckan/venv/bin/activate

然后是:

paster make-config ckan /etc/ckan/default/development.ini