ckan / ckanext-geoview

CKAN Geospatial ResourceView
MIT License
43 stars 58 forks source link

Pip install not installing requirements #65

Open gallexme opened 4 years ago

gallexme commented 4 years ago

Shouldnt Pip Install the requirements in pip-requirements.txt?


DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. 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
Collecting ckanext-geoview
  Downloading https://files.pythonhosted.org/packages/e6/48/4e6fa5fe6a12d33440081a0873229bc6e8dbb38f959a6eb98513f166b99a/ckanext-geoview-0.0.16.tar.gz (988kB)
     |████████████████████████████████| 993kB 2.1MB/s 
Building wheels for collected packages: ckanext-geoview
  Building wheel for ckanext-geoview (setup.py) ... done
  Created wheel for ckanext-geoview: filename=ckanext_geoview-0.0.16-cp27-none-any.whl size=1041138 sha256=2025eb8c27218ff4fcdef45cd73ea815f1671c0f2e9b42923fe11a70634b4a66
  Stored in directory: /home/user/.cache/pip/wheels/af/fc/00/0baa05a88dee758b515db082ee66e385715e235a8123f02356
Successfully built ckanext-geoview
Installing collected packages: ckanext-geoview
Successfully installed ckanext-geoview-0.0.16

(default) [user@server ckan]$ paster db upgrade -c /etc/ckan/default/production.ini

Traceback (most recent call last):
  File "/usr/lib/ckan/default/bin/paster", line 11, in <module>
    sys.exit(run())
  File "/usr/lib/ckan/default/lib/python2.7/site-packages/paste/script/command.py", line 102, in run
    invoke(command, command_name, options, args[1:])
  File "/usr/lib/ckan/default/lib/python2.7/site-packages/paste/script/command.py", line 141, in invoke
    exit_code = runner.run(args)
  File "/usr/lib/ckan/default/lib/python2.7/site-packages/paste/script/command.py", line 236, in run
    result = self.command()
  File "/usr/lib/ckan/default/src/ckan/ckan/lib/cli.py", line 357, in command
    self._load_config(cmd!='upgrade')
  File "/usr/lib/ckan/default/src/ckan/ckan/lib/cli.py", line 330, in _load_config
    self.site_user = load_config(self.options.config, load_site_user)
  File "/usr/lib/ckan/default/src/ckan/ckan/lib/cli.py", line 237, in load_config
    load_environment(conf.global_conf, conf.local_conf)
  File "/usr/lib/ckan/default/src/ckan/ckan/config/environment.py", line 112, in load_environment
    p.load_all()
  File "/usr/lib/ckan/default/src/ckan/ckan/plugins/core.py", line 140, in load_all
    load(*plugins)
  File "/usr/lib/ckan/default/src/ckan/ckan/plugins/core.py", line 154, in load
    service = _get_service(plugin)
  File "/usr/lib/ckan/default/src/ckan/ckan/plugins/core.py", line 256, in _get_service
    return plugin.load()(name=plugin_name)
  File "/usr/lib/ckan/default/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2443, in load
    return self.resolve()
  File "/usr/lib/ckan/default/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2449, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/lib/ckan/default/lib/python2.7/site-packages/ckanext/geoview/plugin.py", line 7, in <module>
    import ckantoolkit as toolkit
ImportError: No module named ckantoolkit
txt?
davidread commented 4 years ago

This is a deep debate and there's no great answer. CKAN community has resolved to use requirements files.

I see we need to add this step to the README: pip install -r pip-requirements.txt like other extensions have.

mattfullerton commented 4 years ago

@davidread This would mean changing the entire install approach, not just adding one line.

I am not a Python package expert at all, but isn't the idea when you do pip install ... that dependencies get installed automatically?

davidread commented 4 years ago

It's true for libraries, but less so for higher level 'projects', composed of lots of libraries.

There have been lots of cases where different CKAN extensions have conflicted in the versions required of their dependencies. If the authors specifies this in setup.py's install_requires, needed for automatic install, then you can't run the software, until you edit the setup.py. Whereas requirements files can be used or ignored. It might not be such a problem these days, with semver and us getting off pylons. It's just what the convention in the CKAN community now. Happy for you to start a discussion on Ckan Ideas to involve everyone.

mattfullerton commented 4 years ago

Given I just had to remove two dependencies from an extension and then add two manually to get it to work (maybe not the best example) I can completely agree.

Then I will see if I can redraft the whole instructions to do the source code install and make a PR?

davidread commented 4 years ago

Yes, I guess step 2 would be better as something like:

pip install -e git+git@github.com:ckan/ckanext-xloader.git#egg=ckanext-xloader
pip install -r /usr/lib/ckan/default/src/ckanext-xloader/requirements.txt

What do you think?

categulario commented 2 years ago

This subject was recently discussed here . This module in particular has two dependencies that can be included in setup.py without much problem, and it will make setup much easier.