[ckan-dev] How to install ckanext-scheming

Timothy Giles timothy.giles at slu.se
Thu Sep 22 12:58:27 UTC 2016


OK,

After 6, do

                      7. python setup.py develop

Additions I make to xxxxx.ini

scheming.dataset_schemas = ckanext.scheming:dataset.json

scheming.presets = ckanext.scheming:presets.json

scheming.dataset_fallback = false


You must then make a json file at: /usr/lib/ckan/default/src/ckanext-scheming/ckanext/scheming/dataset.json

I would suggest you fist copy the file ………../ckan_dataset.json  to   ……./dataset.json.

When you restart the webserver (production) or redo paster serve….   Then the new schema is used when you click on the new dataset button.

You can then make a change to the dataset.json, restart the webserver or paster serve….. and you will see the changes

Hope that helps

Tim

From: ckan-dev [mailto:ckan-dev-bounces at lists.okfn.org] On Behalf Of Forum
Sent: den 22 september 2016 14:53
To: CKAN Development Discussions <ckan-dev at lists.okfn.org>
Subject: Re: [ckan-dev] How to install ckanext-scheming


Dear Tim,



I am sorry to annoy but I have pain to setup chanext-scheming.



I successfully perform those operation:

1.      #sudo chown -R `whoami` /usr/lib/ckan/default

2.      #. /usr/lib/ckan/default/bin/activate

3.      #cd /usr/lib/ckan/default/src

4.      #pip install -e ‘git+https://github.com/ckan/ckanext-scheming.git#egg=ckanext-scheming’

5.      #cd ./ckanext-scheming

6.      #pip install -r /usr/lib/ckan/default/src/ckanext-scheming/requirements.txt


But I really do not understand how to configure it following this page

https://github.com/ckan/ckanext-scheming



I do not understand how to modify the configuration. Is the file /etc/lib/ckan/default/production.ini?

I try to modifiy the following (In green, it what I added):



ckan.plugins = stats text_view image_view recline_view scheming_datasets

#   module-path:file to schemas being used

scheming.dataset_schemas = ckanext.spatialx:spatialx_schema.json

                           ckanext.spatialx:spatialxy_schema.json

#   will try to load "spatialx_schema.json" and "spatialxy_schema.json"

#   as dataset schemas

#

#   URLs may also be used, e.g:

#

# scheming.dataset_schemas = http://example.com/spatialx_schema.json



#   Preset files may be included as well. The default preset setting is:

scheming.presets = ckanext.scheming:presets.json



#   The is_fallback setting may be changed as well. Defaults to false:

scheming.dataset_fallback = false





After adding those line, I reload apache2 and the web page display an Internal Server Error. I also tried

scheming.dataset_schemas = ckanext.spatialx:spatialx_schema.json

or

scheming.dataset_schemas = ckanext.spatialx:spatialxy_schema.json

But none works

I also edited the file /usr/lib/ckan/default/src/ckanext-scheming/ckanext/scheming/ckan_dataset.json and modified a field name, a label but I could not see a change on the web interface.

I am new with CKAN, could tell me a bit more about the configuration and how to add new field?

Many thank
Cheers

Pierre
On 9/22/16 1:17 PM, Forum wrote:

Ok, I think I solved the problem.



As I said, I install CKAN from package.

Because of my issue, I red the doc and I compare the instruction to install CKAN from source. I also compare the file permissions of /usr/lib/ckan/default

http://docs.ckan.org/en/latest/maintaining/installing/install-from-source.html

The instruction to install from source said:



1.      Create a Python virtual environment<http://www.virtualenv.org> (virtualenv) to install CKAN into, and activate it:

2.  sudo mkdir -p /usr/lib/ckan/default

3.  sudo chown `whoami` /usr/lib/ckan/default

4.  virtualenv --no-site-packages /usr/lib/ckan/default

5.  . /usr/lib/ckan/default/bin/activate





In red, I could understand thta my file permission was not correct. I ran the following command

sudo chown -R `whoami` /usr/lib/ckan/default



and then I try to install again ckanext-scheming and it work (see below).



But why the installation from package do not set the correct permission?



(default)cry at crypc11:/usr/lib/ckan/default/src/ckan$ pip install -e 'git+https://github.com/ckan/ckanext-scheming.git#egg=ckanext-scheming'
Obtaining ckanext-scheming from git+https://github.com/ckan/ckanext-scheming.git#egg=ckanext-scheming
  Directory /usr/lib/ckan/default/src/ckanext-scheming already exists, and is not a git clone.
  The plan is to install the git repository https://github.com/ckan/ckanext-scheming.git
What to do?  (i)gnore, (w)ipe, (b)ackup w
  Deleting /usr/lib/ckan/default/src/ckanext-scheming
  Cloning https://github.com/ckan/ckanext-scheming.git to /usr/lib/ckan/default/src/ckanext-scheming
Installing collected packages: ckanext-scheming
  Running setup.py develop for ckanext-scheming
Successfully installed ckanext-scheming
You are using pip version 7.1.2, however version 8.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.



(default)cry at crypc11:/usr/lib/ckan/default/src/ckan$ pip install --upgrade pip
/usr/lib/ckan/default/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
Collecting pip
  Downloading pip-8.1.2-py2.py3-none-any.whl (1.2MB)
    100% |████████████████████████████████| 1.2MB 510kB/s
Installing collected packages: pip
  Found existing installation: pip 7.1.2
    Uninstalling pip-7.1.2:
      Successfully uninstalled pip-7.1.2
Successfully installed pip-8.1.2





(default)cry at crypc11:/usr/lib/ckan/default/src/ckan$













On 9/22/16 12:59 PM, Forum wrote:

Dear Tim



Unfortunately, it does not work. Here is the error messages:

I manually created /usr/lib/ckan/default/src/ckanext-scheming/ because it could not







(default)cry at crypc:/usr/lib/ckan/default/src$ pip install -e 'git+https://github.com/ckan/ckanext-scheming.git#egg=ckanext-scheming'
Obtaining ckanext-scheming from git+https://github.com/ckan/ckanext-scheming.git#egg=ckanext-scheming
  Directory /usr/lib/ckan/default/src/ckanext-scheming already exists, and is not a git clone.
  The plan is to install the git repository https://github.com/ckan/ckanext-scheming.git
What to do?  (i)gnore, (w)ipe, (b)ackup i
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 18, in <module>
    IOError: [Errno 2] No such file or directory: '/usr/lib/ckan/default/src/ckanext-scheming/setup.py'

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /usr/lib/ckan/default/src/ckanext-scheming





(default)cry at crypc:/usr/lib/ckan/default/src$ ll ckanext-scheming/
total 8
drwxr-xr-x 2 cry cry 4096 Sep 22 12:45 ./
drwxr-xr-x 4 root  root  4096 Sep 22 12:51 ../





(default)cry at crypc11:/usr/lib/ckan/default/src$ pip install -e 'git+https://github.com/ckan/ckanext-scheming.git#egg=ckanext-scheming'
Obtaining ckanext-scheming from git+https://github.com/ckan/ckanext-scheming.git#egg=ckanext-scheming
  Directory /usr/lib/ckan/default/src/ckanext-scheming already exists, and is not a git clone.
  The plan is to install the git repository https://github.com/ckan/ckanext-scheming.git
What to do?  (i)gnore, (w)ipe, (b)ackup w
  Deleting ./ckanext-scheming
Exception:
Traceback (most recent call last):
  File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/pip/basecommand.py", line 211, in main
    status = self.run(options, args)
  File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/pip/commands/install.py", line 305, in run
    wb.build(autobuilding=True)
  File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/pip/wheel.py", line 705, in build
    self.requirement_set.prepare_files(self.finder)
  File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/pip/req/req_set.py", line 334, in prepare_files
    functools.partial(self._prepare_file, finder))
  File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/pip/req/req_set.py", line 321, in _walk_req_to_install
    more_reqs = handler(req_to_install)
  File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/pip/req/req_set.py", line 433, in _prepare_file
    req_to_install.update_editable(not self.is_download)
  File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/pip/req/req_install.py", line 573, in update_editable
    vcs_backend.obtain(self.source_dir)
  File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/pip/vcs/git.py", line 109, in obtain
    if self.check_destination(dest, url, rev_options, rev_display):
  File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/pip/vcs/__init__.py", line 257, in check_destination
    rmtree(dest)
  File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/pip/_vendor/retrying.py", line 49, in wrapped_f
    return Retrying(*dargs, **dkw).call(f, *args, **kw)
  File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/pip/_vendor/retrying.py", line 212, in call
    raise attempt.get()
  File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/pip/_vendor/retrying.py", line 247, in get
    six.reraise(self.value[0], self.value[1], self.value[2])
  File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/pip/_vendor/retrying.py", line 200, in call
    attempt = Attempt(fn(*args, **kwargs), attempt_number, False)
  File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/pip/utils/__init__.py", line 90, in rmtree
    onerror=rmtree_errorhandler)
  File "/usr/lib/python2.7/shutil.py", line 239, in rmtree
    onerror(os.listdir, path, sys.exc_info())
  File "/usr/lib/python2.7/shutil.py", line 237, in rmtree
    names = os.listdir(path)
OSError: [Errno 13] Permission denied: '/usr/lib/ckan/default/src/ckanext-scheming'





(default)cry at crypc11:/usr/lib/ckan/default/src$





Is not a permission problem?



Thank for your help

Cheers





On 9/21/16 5:34 PM, Timothy Giles wrote:
The .activate just ensures you are in the virtual environment that ckan dev is installed in.

You follow a very similar install process for almost all ckan extensions. Some have requirements.txt and/or dev-requirements.txt that need installing. Some extensions require supporting DB tables to be created (QA for example). Generally though, if you learn the procedure below, you can install almost all extensions without issue.


Regards Timothy


From: ckan-dev [mailto:ckan-dev-bounces at lists.okfn.org] On Behalf Of Forum
Sent: den 21 september 2016 15:53
To: CKAN Development Discussions <ckan-dev at lists.okfn.org><mailto:ckan-dev at lists.okfn.org>
Subject: Re: [ckan-dev] How to install ckanext-scheming


Dear Tim,

Thank for your help.

When I firstly install ckan, I installed it from source and I used that command during the process

. /usr/lib/ckan/default/bin/activate

I reinstalled my PC with a new Ubuntu 14.04 installation and I installed successfuly CKAN from the package. I did not needed to use the above command.

I supposed, even if I installed CKAN from package, I can use the above command and use pip?
I will try to install ckanext-scheming later or tomorrow.

Cheers
Pierre

On 9/21/16 3:38 PM, Timothy Giles wrote:
Pierre,

. /usr/lib/ckan/default/bin/activate
cd /usr/lib/ckan/default/src

pip install -e ”git+https://github.com/ckan/ckanext-scheming.git#egg=ckanext-scheming”

cd ./ckanext-scheming

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


1.      Any issues, sudo the previous command *

As the rest of the instructions say, insert scheming_datasets in to your plugins line

Add in the scheming.presets section in to your config, just under the plugins section

Add in a scheming.dataset_fallback = false

Add in a scheming.dataset_schemas = ckanext.scheming:schemaname.json


Where schemaname.json is the JSON file that describes your schema (ie. list of metadata elements). As an example, I think there is camel.json and ckan_dataset.json

Create a similar template file called dataset.json and it will load as the default ‘new dataset’ schema/template.

Sorry – the json files are stored in ./ckanext-scheming/ckanext/scheming/…….


Hope the above helps

Tim






_______________________________________________

ckan-dev mailing list

ckan-dev at lists.okfn.org<mailto:ckan-dev at lists.okfn.org>

https://lists.okfn.org/mailman/listinfo/ckan-dev

Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev





_______________________________________________

ckan-dev mailing list

ckan-dev at lists.okfn.org<mailto:ckan-dev at lists.okfn.org>

https://lists.okfn.org/mailman/listinfo/ckan-dev

Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev






_______________________________________________

ckan-dev mailing list

ckan-dev at lists.okfn.org<mailto:ckan-dev at lists.okfn.org>

https://lists.okfn.org/mailman/listinfo/ckan-dev

Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20160922/9ff77617/attachment-0003.html>


More information about the ckan-dev mailing list