ckan / ckanapi

A command line interface and Python module for accessing the CKAN Action API
Other
176 stars 74 forks source link

PasteScript and CKAN are unlisted dependencies #164

Closed frafra closed 3 years ago

frafra commented 3 years ago
$ ckanapi search datasets
Traceback (most recent call last):
  File "/home/frafra/Code/test/venv/bin/ckanapi", line 11, in <module>
    load_entry_point('ckanapi==4.5', 'console_scripts', 'ckanapi')()
  File "/home/frafra/Code/test/venv/lib64/python3.8/site-packages/ckanapi/cli/main.py", line 105, in main
    return _switch_to_paster(arguments)
  File "/home/frafra/Code/test/venv/lib64/python3.8/site-packages/ckanapi/cli/main.py", line 156, in _switch_to_paster
    sys.exit(load_entry_point('PasteScript', 'console_scripts', 'paster')())
  File "/home/frafra/Code/test/venv/lib64/python3.8/site-packages/pkg_resources/__init__.py", line 490, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/home/frafra/Code/test/venv/lib64/python3.8/site-packages/pkg_resources/__init__.py", line 482, in get_distribution
    dist = get_provider(dist)
  File "/home/frafra/Code/test/venv/lib64/python3.8/site-packages/pkg_resources/__init__.py", line 358, in get_provider
    return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
  File "/home/frafra/Code/test/venv/lib64/python3.8/site-packages/pkg_resources/__init__.py", line 901, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/home/frafra/Code/test/venv/lib64/python3.8/site-packages/pkg_resources/__init__.py", line 787, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'PasteScript' distribution was not found and is required by the application
❯ pip install PasteScript
Collecting PasteScript
  Downloading PasteScript-3.2.0-py2.py3-none-any.whl (73 kB)
     |████████████████████████████████| 73 kB 881 kB/s 
Requirement already satisfied: six in ./venv/lib/python3.8/site-packages (from PasteScript) (1.15.0)
Collecting PasteDeploy
  Downloading PasteDeploy-2.1.1-py2.py3-none-any.whl (17 kB)
Collecting Paste>=3.0
  Downloading Paste-3.5.0-py2.py3-none-any.whl (593 kB)
     |████████████████████████████████| 593 kB 3.0 MB/s 
Requirement already satisfied: setuptools in ./venv/lib/python3.8/site-packages (from PasteDeploy->PasteScript) (47.1.0)
Installing collected packages: PasteDeploy, Paste, PasteScript
Successfully installed Paste-3.5.0 PasteDeploy-2.1.1 PasteScript-3.2.0
WARNING: You are using pip version 20.1.1; however, version 20.2.4 is available.
You should consider upgrading via the '/home/frafra/Code/test/venv/bin/python3 -m pip install --upgrade pip' command.
$ ckanapi search datasets
Traceback (most recent call last):
  File "/home/frafra/Code/test/venv/bin/ckanapi", line 11, in <module>
    load_entry_point('ckanapi==4.5', 'console_scripts', 'ckanapi')()
  File "/home/frafra/Code/test/venv/lib64/python3.8/site-packages/ckanapi/cli/main.py", line 105, in main
    return _switch_to_paster(arguments)
  File "/home/frafra/Code/test/venv/lib64/python3.8/site-packages/ckanapi/cli/main.py", line 156, in _switch_to_paster
    sys.exit(load_entry_point('PasteScript', 'console_scripts', 'paster')())
  File "/home/frafra/Code/test/venv/lib64/python3.8/site-packages/paste/script/command.py", line 101, in run
    command = commands[command_name].load()
  File "/home/frafra/Code/test/venv/lib64/python3.8/site-packages/pkg_resources/__init__.py", line 2462, in load
    return self.resolve()
  File "/home/frafra/Code/test/venv/lib64/python3.8/site-packages/pkg_resources/__init__.py", line 2468, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/home/frafra/Code/test/venv/lib64/python3.8/site-packages/ckanapi/cli/paster.py", line 2, in <module>
    from ckan.lib.cli import CkanCommand
ModuleNotFoundError: No module named 'ckan'
wardi commented 3 years ago

the -c option (which is the default if you haven't specified a -r) is only compatible with python2. I haven't had time to make it work with python 3 yet. I'm definitely open to a pull request that adds python3 + ckan 2.9 support for the -c option if you've got some time.

Or just use -r for now.