ckan / ckanext-spatial

Geospatial extension for CKAN
http://docs.ckan.org/projects/ckanext-spatial
125 stars 190 forks source link

Issues with new version (v2.0) #301

Closed pdelboca closed 1 year ago

pdelboca commented 1 year ago

Hello!

I know it's not merged yet but I have been testing a little bit the new branch (https://github.com/ckan/ckanext-spatial/pull/292) and I have some issues running it. I will document them here in case it is useful for the developing process.

My stack:

Problem installing proj

The pinned version of proj==2.6.1 doesn't seems to work in my envorinment (Python 3.9), there's some documentation about installing PROJ in the official webpage although nothing of this is mentioned in ckanext-spatial docs. I was able to install the latest version of proj.

$ pip install pyproj==2.6.1
Collecting pyproj==2.6.1
  Using cached pyproj-2.6.1.tar.gz (528 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [1 lines of output]
      proj executable not found. Please set the PROJ_DIR variable.For more information see: https://pyproj4.github.io/pyproj/stable/installation.html
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.
WARNING: You are using pip version 22.0.4; however, version 22.3 is available.
You should consider upgrading via the '/home/pdelboca/Repos/ckan/.venv/bin/python3.9 -m pip install --upgrade pip' command.

Installing ckanext-harvest

In the documentation is flagged as optional but it is not possible to run ckanext-spatial without it. The extension tries to access it at import time.

Solr backend docs

Some places of the documentation still suggest a deprecated value:

2022-11-10 12:20:03,967 WARNI [ckanext.spatial.plugin] The `solr` spatial search backend has been renamed to `solr-bbox`, please update your configuration

Specifically this part: https://docs.ckan.org/projects/ckanext-spatial/en/dev-v2.0/spatial-search.html#setup

Where to store the spatial field?

The snippet suggested here didn't work for me: https://docs.ckan.org/projects/ckanext-spatial/en/dev-v2.0/spatial-search.html#dataset-extent-map

The issue is that I have stored the data in a new field using ckanext-scheming instead in a custom extra one. Does it need to be stored in a new field or in a extra field?

Displaying of facet filter - Improvement?

The filter is being shown, however when I click to use it it is re-positioned at the top of the page forcing me to scroll up.

image

Search is not working for me

I'm getting: java.lang.UnsupportedOperationException from Solr.

I'm able to display the spatial data in the dataset page: image

But trying to search gets me an error in Solr: image

As usual Solr errors are messy, so sorry for this:

('SOLR returned an error running query: {\'facet.field\': [\'organization\', \'groups\', \'tags\', \'res_format\', \'license_id\'], \'fq\': [\' +state:(active)\', \'{!frange incl=false l=0 u=1}div(mul(mul(max(0,sub(min(8.411235809326172,maxx),max(8.403511047363281,minx))),max(0,sub(min(45.681494020136384,maxy),max(45.67615685367673,miny)))),2),add(4.122834045715073e-05,mul(sub(maxy,miny),sub(maxx,minx))))\', \'+site_id:"default"\'], \'q\': \'*:*\', \'rows\': 21, \'sort\': \'score desc, metadata_modified desc\', \'start\': 0, \'df\': \'text\', \'fq_list\': [\'{!frange incl=false l=0 u=1}div(mul(mul(max(0,sub(min(8.411235809326172,maxx),max(8.403511047363281,minx))),max(0,sub(min(45.681494020136384,maxy),max(45.67615685367673,miny)))),2),add(4.122834045715073e-05,mul(sub(maxy,miny),sub(maxx,minx))))\'], \'bf\': \'div(mul(mul(max(0,sub(min(8.411235809326172,maxx),max(8.403511047363281,minx))),max(0,sub(min(45.681494020136384,maxy),max(45.67615685367673,miny)))),2),add(4.122834045715073e-05,mul(sub(maxy,miny),sub(maxx,minx))))\', \'defType\': \'edismax\', \'fl\': \'id validated_data_dict\', \'facet\': \'true\', \'facet.limit\': 50, \'facet.mincount\': 1, \'wt\': \'json\', \'tie\': \'0.1\', \'mm\': \'2<-1 5<80%\', \'qf\': \'name^4 title^4 tags^2 groups^2 text\', \'q.op\': \'AND\'} Error: SolrError(\'Solr responded with an error (HTTP 500): [Reason: None]\\nb\\\'{\\\\n  "responseHeader":{\\\\n    "status":500,\\\\n    "QTime":36,\\\\n    "params":{\\\\n      "mm":"2<-1 5<80%",\\\\n      "facet.field":["organization",\\\\n        "groups",\\\\n        "tags",\\\\n        "res_format",\\\\n        "license_id"],\\\\n      "df":"text",\\\\n      "bf":"div(mul(mul(max(0,sub(min(8.411235809326172,maxx),max(8.403511047363281,minx))),max(0,sub(min(45.681494020136384,maxy),max(45.67615685367673,miny)))),2),add(4.122834045715073e-05,mul(sub(maxy,miny),sub(maxx,minx))))",\\\\n      "fl":"id validated_data_dict",\\\\n      "start":"0",\\\\n      "q.op":"AND",\\\\n      "fq":[" +state:(active)",\\\\n        "{!frange incl=false l=0 u=1}div(mul(mul(max(0,sub(min(8.411235809326172,maxx),max(8.403511047363281,minx))),max(0,sub(min(45.681494020136384,maxy),max(45.67615685367673,miny)))),2),add(4.122834045715073e-05,mul(sub(maxy,miny),sub(maxx,minx))))",\\\\n        "+site_id:\\\\\\\\"default\\\\\\\\""],\\\\n      "sort":"score desc, metadata_modified desc",\\\\n      "rows":"21",\\\\n      "fq_list":"{!frange incl=false l=0 u=1}div(mul(mul(max(0,sub(min(8.411235809326172,maxx),max(8.403511047363281,minx))),max(0,sub(min(45.681494020136384,maxy),max(45.67615685367673,miny)))),2),add(4.122834045715073e-05,mul(sub(maxy,miny),sub(maxx,minx))))",\\\\n      "q":"*:*",\\\\n      "facet.limit":"50",\\\\n      "tie":"0.1",\\\\n      "defType":"edismax",\\\\n      "qf":"name^4 title^4 tags^2 groups^2 text",\\\\n      "facet.mincount":"1",\\\\n      "facet":"true",\\\\n      "wt":"json"}},\\\\n  "error":{\\\\n    "trace":"java.lang.UnsupportedOperationException\\\\\\\\n\\\\\\\\tat org.apache.lucene.queries.function.FunctionValues.floatVal(FunctionValues.java:47)\\\\\\\\n\\\\\\\\tat org.apache.lucene.queries.function.valuesource.MinFloatFunction.func(MinFloatFunction.java:44)\\\\\\\\n\\\\\\\\tat org.apache.lucene.queries.function.valuesource.MultiFloatFunction$1.floatVal(MultiFloatFunction.java:82)\\\\\\\\n\\\\\\\\tat org.apache.solr.search.ValueSourceParser$18$1.func(ValueSourceParser.java:307)\\\\\\\\n\\\\\\\\tat org.apache.lucene.queries.function.valuesource.DualFloatFunction$1.floatVal(DualFloatFunction.java:60)\\\\\\\\n\\\\\\\\tat org.apache.lucene.queries.function.valuesource.MaxFloatFunction.func(MaxFloatFunction.java:44)\\\\\\\\n\\\\\\\\tat org.apache.lucene.queries.function.valuesource.MultiFloatFunction$1.floatVal(MultiFloatFunction.java:82)\\\\\\\\n\\\\\\\\tat org.apache.lucene.queries.function.valuesource.ProductFloatFunction.func(ProductFloatFunction.java:41)\\\\\\\\n\\\\\\\\tat org.apache.lucene.queries.function.valuesource.MultiFloatFunction$1.floatVal(MultiFloatFunction.java:82)\\\\\\\\n\\\\\\\\tat org.apache.lucene.queries.function.valuesource.ProductFloatFunction.func(ProductFloatFunction.java:41)\\\\\\\\n\\\\\\\\tat org.apache.lucene.queries.function.valuesource.MultiFloatFunction$1.floatVal(MultiFloatFunction.java:82)\\\\\\\\n\\\\\\\\tat org.apache.lucene.queries.function.valuesource.DivFloatFunction.func(DivFloatFunction.java:42)\\\\\\\\n\\\\\\\\tat org.apache.lucene.queries.function.valuesource.DualFloatFunction$1.floatVal(DualFloatFunction.java:60)\\\\\\\\n\\\\\\\\tat org.apache.lucene.queries.function.FunctionValues$5.matches(FunctionValues.java:208)\\\\\\\\n\\\\\\\\tat org.apache.lucene.queries.function.ValueSourceScorer$1.matches(ValueSourceScorer.java:53)\\\\\\\\n\\\\\\\\tat org.apache.lucene.search.TwoPhaseIterator$TwoPhaseIteratorAsDocIdSetIterator.doNext(TwoPhaseIterator.java:89)\\\\\\\\n\\\\\\\\tat org.apache.lucene.search.TwoPhaseIterator$TwoPhaseIteratorAsDocIdSetIterator.nextDoc(TwoPhaseIterator.java:77)\\\\\\\\n\\\\\\\\tat org.apache.lucene.search.Weight$DefaultBulkScorer.scoreAll(Weight.java:280)\\\\\\\\n\\\\\\\\tat org.apache.lucene.search.Weight$DefaultBulkScorer.score(Weight.java:238)\\\\\\\\n\\\\\\\\tat org.apache.lucene.search.BulkScorer.score(BulkScorer.java:39)\\\\\\\\n\\\\\\\\tat org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:659)\\\\\\\\n\\\\\\\\tat org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:443)\\\\\\\\n\\\\\\\\tat org.apache.solr.search.DocSetUtil.createDocSetGeneric(DocSetUtil.java:145)\\\\\\\\n\\\\\\\\tat org.apache.solr.search.DocSetUtil.createDocSet(DocSetUtil.java:134)\\\\\\\\n\\\\\\\\tat org.apache.solr.search.SolrIndexSearcher.getDocSetNC(SolrIndexSearcher.java:1197)\\\\\\\\n\\\\\\\\tat org.apache.solr.search.SolrIndexSearcher.lambda$getAndCacheDocSet$1(SolrIndexSearcher.java:876)\\\\\\\\n\\\\\\\\tat org.apache.solr.search.CaffeineCache.computeAsync(CaffeineCache.java:226)\\\\\\\\n\\\\\\\\tat org.apache.solr.search.CaffeineCache.computeIfAbsent(CaffeineCache.java:241)\\\\\\\\n\\\\\\\\tat org.apache.solr.search.SolrIndexSearcher.getAndCacheDocSet(SolrIndexSearcher.java:876)\\\\\\\\n\\\\\\\\tat org.apache.solr.search.SolrIndexSearcher.getPositiveDocSet(SolrIndexSearcher.java:844)\\\\\\\\n\\\\\\\\tat org.apache.solr.search.SolrIndexSearcher.getProcessedFilter(SolrIndexSearcher.java:1035)\\\\\\\\n\\\\\\\\tat org.apache.solr.search.SolrIndexSearcher.getDocListAndSetNC(SolrIndexSearcher.java:1670)\\\\\\\\n\\\\\\\\tat org.apache.solr.search.SolrIndexSearcher.getDocListC(SolrIndexSearcher.java:1435)\\\\\\\\n\\\\\\\\tat org.apache.solr.search.SolrIndexSearcher.search(SolrIndexSearcher.java:596)\\\\\\\\n\\\\\\\\tat org.apache.solr.handler.component.QueryComponent.doProcessUngroupedSearch(QueryComponent.java:1511)\\\\\\\\n\\\\\\\\tat org.apache.solr.handler.component.QueryComponent.process(QueryComponent.java:390)\\\\\\\\n\\\\\\\\tat org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:368)\\\\\\\\n\\\\\\\\tat org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:216)\\\\\\\\n\\\\\\\\tat org.apache.solr.core.SolrCore.execute(SolrCore.java:2637)\\\\\\\\n\\\\\\\\tat org.apache.solr.servlet.HttpSolrCall.execute(HttpSolrCall.java:794)\\\\\\\\n\\\\\\\\tat org.apache.solr.servlet.HttpSolrCall.call(HttpSolrCall.java:567)\\\\\\\\n\\\\\\\\tat org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:427)\\\\\\\\n\\\\\\\\tat org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:357)\\\\\\\\n\\\\\\\\tat org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:201)\\\\\\\\n\\\\\\\\tat org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1601)\\\\\\\\n\\\\\\\\tat org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:548)\\\\\\\\n\\\\\\\\tat org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)\\\\\\\\n\\\\\\\\tat org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:600)\\\\\\\\n\\\\\\\\tat org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)\\\\\\\\n\\\\\\\\tat org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235)\\\\\\\\n\\\\\\\\tat org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1624)\\\\\\\\n\\\\\\\\tat org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233)\\\\\\\\n\\\\\\\\tat org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1434)\\\\\\\\n\\\\\\\\tat org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188)\\\\\\\\n\\\\\\\\tat org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:501)\\\\\\\\n\\\\\\\\tat org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1594)\\\\\\\\n\\\\\\\\tat org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186)\\\\\\\\n\\\\\\\\tat org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1349)\\\\\\\\n\\\\\\\\tat org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)\\\\\\\\n\\\\\\\\tat org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:191)\\\\\\\\n\\\\\\\\tat org.eclipse.jetty.server.handler.InetAccessHandler.handle(InetAccessHandler.java:177)\\\\\\\\n\\\\\\\\tat org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:146)\\\\\\\\n\\\\\\\\tat org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)\\\\\\\\n\\\\\\\\tat org.eclipse.jetty.rewrite.handler.RewriteHandler.handle(RewriteHandler.java:322)\\\\\\\\n\\\\\\\\tat org.eclipse.jetty.server.handler.gzip.GzipHandler.handle(GzipHandler.java:763)\\\\\\\\n\\\\\\\\tat org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)\\\\\\\\n\\\\\\\\tat org.eclipse.jetty.server.Server.handle(Server.java:516)\\\\\\\\n\\\\\\\\tat org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:400)\\\\\\\\n\\\\\\\\tat org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:645)\\\\\\\\n\\\\\\\\tat org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:392)\\\\\\\\n\\\\\\\\tat org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:277)\\\\\\\\n\\\\\\\\tat org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)\\\\\\\\n\\\\\\\\tat org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105)\\\\\\\\n\\\\\\\\tat org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104)\\\\\\\\n\\\\\\\\tat org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:338)\\\\\\\\n\\\\\\\\tat org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:315)\\\\\\\\n\\\\\\\\tat org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:173)\\\\\\\\n\\\\\\\\tat org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131)\\\\\\\\n\\\\\\\\tat org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:409)\\\\\\\\n\\\\\\\\tat org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:883)\\\\\\\\n\\\\\\\\tat org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1034)\\\\\\\\n\\\\\\\\tat java.base/java.lang.Thread.run(Unknown Source)\\\\\\\\n",\\\\n    "code":500}}\\\\n\\\'\')',)
ChristianF88 commented 1 year ago

The build of pyproj==2.6.1 fails for me too. I am running: CKAN 3.10, Python 3.10.10, setuptools 67.3.2, but I also tried with the recommended version of setuptools 44.1.0. Same error.

(default) root@ckan-2-10:~# pip install --upgrade pyproj==2.6.1 
Collecting pyproj==2.6.1
  Using cached pyproj-2.6.1.tar.gz (528 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: pyproj
  Building wheel for pyproj (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for pyproj (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [167 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-cpython-310
      creating build/lib.linux-x86_64-cpython-310/pyproj
      copying pyproj/datadir.py -> build/lib.linux-x86_64-cpython-310/pyproj
      copying pyproj/_show_versions.py -> build/lib.linux-x86_64-cpython-310/pyproj
      copying pyproj/transformer.py -> build/lib.linux-x86_64-cpython-310/pyproj
      copying pyproj/geod.py -> build/lib.linux-x86_64-cpython-310/pyproj
      copying pyproj/enums.py -> build/lib.linux-x86_64-cpython-310/pyproj
      copying pyproj/proj.py -> build/lib.linux-x86_64-cpython-310/pyproj
      copying pyproj/__main__.py -> build/lib.linux-x86_64-cpython-310/pyproj
      copying pyproj/exceptions.py -> build/lib.linux-x86_64-cpython-310/pyproj
      copying pyproj/utils.py -> build/lib.linux-x86_64-cpython-310/pyproj
      copying pyproj/compat.py -> build/lib.linux-x86_64-cpython-310/pyproj
      copying pyproj/__init__.py -> build/lib.linux-x86_64-cpython-310/pyproj
      creating build/lib.linux-x86_64-cpython-310/pyproj/crs
      copying pyproj/crs/_cf1x8.py -> build/lib.linux-x86_64-cpython-310/pyproj/crs
      copying pyproj/crs/coordinate_operation.py -> build/lib.linux-x86_64-cpython-310/pyproj/crs
      copying pyproj/crs/crs.py -> build/lib.linux-x86_64-cpython-310/pyproj/crs
      copying pyproj/crs/datum.py -> build/lib.linux-x86_64-cpython-310/pyproj/crs
      copying pyproj/crs/enums.py -> build/lib.linux-x86_64-cpython-310/pyproj/crs
      copying pyproj/crs/coordinate_system.py -> build/lib.linux-x86_64-cpython-310/pyproj/crs
      copying pyproj/crs/__init__.py -> build/lib.linux-x86_64-cpython-310/pyproj/crs
      running build_ext
      building 'pyproj._proj' extension
      creating build/temp.linux-x86_64-cpython-310
      creating build/temp.linux-x86_64-cpython-310/pyproj
      gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/include -I/usr/lib/ckan/default/include -I/usr/local/include/python3.10 -c pyproj/_proj.c -o build/temp.linux-x86_64-cpython-310/pyproj/_proj.o
      pyproj/_proj.c: In function ‘__pyx_pf_6pyproj_5_proj_18PyBuffWriteManager_2__init__’:
      pyproj/_proj.c:1580:37: warning: passing argument 1 of ‘PyObject_GetBuffer’ from incompatible pointer type [-Wincompatible-pointer-types]
       1580 |   __pyx_t_1 = ((PyObject_GetBuffer(((struct PyObject *)__pyx_v_data), (&__pyx_v_self->buffer), PyBUF_WRITABLE) != 0) != 0);
            |                                    ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            |                                     |
            |                                     struct PyObject *
      In file included from /usr/local/include/python3.10/abstract.h:866,
                       from /usr/local/include/python3.10/genobject.h:12,
                       from /usr/local/include/python3.10/Python.h:110,
                       from pyproj/_proj.c:31:
      /usr/local/include/python3.10/cpython/abstract.h:270:46: note: expected ‘PyObject *’ {aka ‘struct _object *’} but argument is of type ‘struct PyObject *’
        270 | PyAPI_FUNC(int) PyObject_GetBuffer(PyObject *obj, Py_buffer *view,
            |                                    ~~~~~~~~~~^~~
      pyproj/_proj.c: In function ‘__pyx_tp_dealloc_6pyproj_5_proj__Proj’:
      pyproj/_proj.c:6584:5: error: lvalue required as increment operand
       6584 |     ++Py_REFCNT(o);
            |     ^~
      pyproj/_proj.c:6586:5: error: lvalue required as decrement operand
       6586 |     --Py_REFCNT(o);
            |     ^~
      pyproj/_proj.c: In function ‘__pyx_tp_dealloc_6pyproj_5_proj_PyBuffWriteManager’:
      pyproj/_proj.c:6738:5: error: lvalue required as increment operand
       6738 |     ++Py_REFCNT(o);
            |     ^~
      pyproj/_proj.c:6740:5: error: lvalue required as decrement operand
       6740 |     --Py_REFCNT(o);
            |     ^~
      pyproj/_proj.c: In function ‘__Pyx_ParseOptionalKeywords’:
      pyproj/_proj.c:7896:21: warning: ‘_PyUnicode_get_wstr_length’ is deprecated [-Wdeprecated-declarations]
       7896 |                     (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
            |                     ^
      In file included from /usr/local/include/python3.10/unicodeobject.h:1046,
                       from /usr/local/include/python3.10/Python.h:83,
                       from pyproj/_proj.c:31:
      /usr/local/include/python3.10/cpython/unicodeobject.h:446:26: note: declared here
        446 | static inline Py_ssize_t _PyUnicode_get_wstr_length(PyObject *op) {
            |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~
      pyproj/_proj.c:7896:21: warning: ‘PyUnicode_AsUnicode’ is deprecated [-Wdeprecated-declarations]
       7896 |                     (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
            |                     ^
      In file included from /usr/local/include/python3.10/unicodeobject.h:1046,
                       from /usr/local/include/python3.10/Python.h:83,
                       from pyproj/_proj.c:31:
      /usr/local/include/python3.10/cpython/unicodeobject.h:580:45: note: declared here
        580 | Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode(
            |                                             ^~~~~~~~~~~~~~~~~~~
      pyproj/_proj.c:7896:21: warning: ‘_PyUnicode_get_wstr_length’ is deprecated [-Wdeprecated-declarations]
       7896 |                     (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
            |                     ^
      In file included from /usr/local/include/python3.10/unicodeobject.h:1046,
                       from /usr/local/include/python3.10/Python.h:83,
                       from pyproj/_proj.c:31:
      /usr/local/include/python3.10/cpython/unicodeobject.h:446:26: note: declared here
        446 | static inline Py_ssize_t _PyUnicode_get_wstr_length(PyObject *op) {
            |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~
      pyproj/_proj.c:7896:21: warning: ‘_PyUnicode_get_wstr_length’ is deprecated [-Wdeprecated-declarations]
       7896 |                     (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
            |                     ^
      In file included from /usr/local/include/python3.10/unicodeobject.h:1046,
                       from /usr/local/include/python3.10/Python.h:83,
                       from pyproj/_proj.c:31:
      /usr/local/include/python3.10/cpython/unicodeobject.h:446:26: note: declared here
        446 | static inline Py_ssize_t _PyUnicode_get_wstr_length(PyObject *op) {
            |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~
      pyproj/_proj.c:7896:21: warning: ‘PyUnicode_AsUnicode’ is deprecated [-Wdeprecated-declarations]
       7896 |                     (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
            |                     ^
      In file included from /usr/local/include/python3.10/unicodeobject.h:1046,
                       from /usr/local/include/python3.10/Python.h:83,
                       from pyproj/_proj.c:31:
      /usr/local/include/python3.10/cpython/unicodeobject.h:580:45: note: declared here
        580 | Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode(
            |                                             ^~~~~~~~~~~~~~~~~~~
      pyproj/_proj.c:7896:21: warning: ‘_PyUnicode_get_wstr_length’ is deprecated [-Wdeprecated-declarations]
       7896 |                     (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
            |                     ^
      In file included from /usr/local/include/python3.10/unicodeobject.h:1046,
                       from /usr/local/include/python3.10/Python.h:83,
                       from pyproj/_proj.c:31:
      /usr/local/include/python3.10/cpython/unicodeobject.h:446:26: note: declared here
        446 | static inline Py_ssize_t _PyUnicode_get_wstr_length(PyObject *op) {
            |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~
      pyproj/_proj.c:7912:25: warning: ‘_PyUnicode_get_wstr_length’ is deprecated [-Wdeprecated-declarations]
       7912 |                         (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
            |                         ^
      In file included from /usr/local/include/python3.10/unicodeobject.h:1046,
                       from /usr/local/include/python3.10/Python.h:83,
                       from pyproj/_proj.c:31:
      /usr/local/include/python3.10/cpython/unicodeobject.h:446:26: note: declared here
        446 | static inline Py_ssize_t _PyUnicode_get_wstr_length(PyObject *op) {
            |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~
      pyproj/_proj.c:7912:25: warning: ‘PyUnicode_AsUnicode’ is deprecated [-Wdeprecated-declarations]
       7912 |                         (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
            |                         ^
      In file included from /usr/local/include/python3.10/unicodeobject.h:1046,
                       from /usr/local/include/python3.10/Python.h:83,
                       from pyproj/_proj.c:31:
      /usr/local/include/python3.10/cpython/unicodeobject.h:580:45: note: declared here
        580 | Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode(
            |                                             ^~~~~~~~~~~~~~~~~~~
      pyproj/_proj.c:7912:25: warning: ‘_PyUnicode_get_wstr_length’ is deprecated [-Wdeprecated-declarations]
       7912 |                         (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
            |                         ^
      In file included from /usr/local/include/python3.10/unicodeobject.h:1046,
                       from /usr/local/include/python3.10/Python.h:83,
                       from pyproj/_proj.c:31:
      /usr/local/include/python3.10/cpython/unicodeobject.h:446:26: note: declared here
        446 | static inline Py_ssize_t _PyUnicode_get_wstr_length(PyObject *op) {
            |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~
      pyproj/_proj.c:7912:25: warning: ‘_PyUnicode_get_wstr_length’ is deprecated [-Wdeprecated-declarations]
       7912 |                         (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
            |                         ^
      In file included from /usr/local/include/python3.10/unicodeobject.h:1046,
                       from /usr/local/include/python3.10/Python.h:83,
                       from pyproj/_proj.c:31:
      /usr/local/include/python3.10/cpython/unicodeobject.h:446:26: note: declared here
        446 | static inline Py_ssize_t _PyUnicode_get_wstr_length(PyObject *op) {
            |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~
      pyproj/_proj.c:7912:25: warning: ‘PyUnicode_AsUnicode’ is deprecated [-Wdeprecated-declarations]
       7912 |                         (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
            |                         ^
      In file included from /usr/local/include/python3.10/unicodeobject.h:1046,
                       from /usr/local/include/python3.10/Python.h:83,
                       from pyproj/_proj.c:31:
      /usr/local/include/python3.10/cpython/unicodeobject.h:580:45: note: declared here
        580 | Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode(
            |                                             ^~~~~~~~~~~~~~~~~~~
      pyproj/_proj.c:7912:25: warning: ‘_PyUnicode_get_wstr_length’ is deprecated [-Wdeprecated-declarations]
       7912 |                         (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
            |                         ^
      In file included from /usr/local/include/python3.10/unicodeobject.h:1046,
                       from /usr/local/include/python3.10/Python.h:83,
                       from pyproj/_proj.c:31:
      /usr/local/include/python3.10/cpython/unicodeobject.h:446:26: note: declared here
        446 | static inline Py_ssize_t _PyUnicode_get_wstr_length(PyObject *op) {
            |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~
      error: command '/usr/bin/gcc' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for pyproj
Failed to build pyproj
ERROR: Could not build wheels for pyproj, which is required to install pyproject.toml-based projects

Install installing the latest version pyproj 3.4.1 works.

avdata99 commented 1 year ago

Working on this on #308

amercader commented 1 year ago

@ChristianF88 can you check if the latest master version solves your issues after #308 was merged? otherwise just create a new issue. Thanks

ChristianF88 commented 1 year ago

@ChristianF88 can you check if the latest master version solves your issues after #308 was merged? otherwise just create a new issue. Thanks

Looks good! I didn't have to manually change the pyproj version.

ChristianF88 commented 12 months ago

The pyproj problem is back:

(default) root@bookworm:/usr/lib/ckan/default/src/ckanext-spatial# pip install -r requirements.txt
Requirement already satisfied: ckantoolkit in /usr/lib/ckan/default/lib/python3.9/site-packages (from -r requirements.txt (line 1)) (0.0.7)
Collecting Shapely<2.0.0,>=1.2.13 (from -r requirements.txt (line 2))
  Using cached Shapely-1.8.5.post1-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (2.1 MB)
Collecting pyproj==2.6.1 (from -r requirements.txt (line 3))
  Using cached pyproj-2.6.1.tar.gz (528 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [51 lines of output]
      <string>:8: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
          bint free_context_on_error,
      ) except *:
          """
          Setup the context for pyproj
          """
          proj_log_func(context, NULL, pyproj_log_function)
                                       ^
      ------------------------------------------------------------

      pyproj/_datadir.pyx:40:33: Cannot assign type 'void (void *, int, const char *) except *' to 'PJ_LOG_FUNCTION'

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                  proj_context_destroy(context)
              raise

      def pyproj_global_context_initialize():
          proj_log_func(NULL, NULL, pyproj_log_function)
                                    ^
      ------------------------------------------------------------

      pyproj/_datadir.pyx:52:30: Cannot assign type 'void (void *, int, const char *) except *' to 'PJ_LOG_FUNCTION'
      Traceback (most recent call last):
        File "/usr/lib/ckan/default/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/usr/lib/ckan/default/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/usr/lib/ckan/default/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
        File "/tmp/pip-build-env-kjk0g_0l/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 341, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
        File "/tmp/pip-build-env-kjk0g_0l/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 323, in _get_build_requires
          self.run_setup()
        File "/tmp/pip-build-env-kjk0g_0l/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 487, in run_setup
          super(_BuildMetaLegacyBackend,
        File "/tmp/pip-build-env-kjk0g_0l/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 338, in run_setup
          exec(code, locals())
        File "<string>", line 243, in <module>
        File "<string>", line 159, in get_extension_modules
        File "/tmp/pip-build-env-kjk0g_0l/overlay/lib/python3.9/site-packages/Cython/Build/Dependencies.py", line 1134, in cythonize
          cythonize_one(*args)
        File "/tmp/pip-build-env-kjk0g_0l/overlay/lib/python3.9/site-packages/Cython/Build/Dependencies.py", line 1301, in cythonize_one
          raise CompileError(None, pyx_file)
      Cython.Compiler.Errors.CompileError: pyproj/_datadir.pyx
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.
MarkCalvert commented 12 months ago

The issue is from Cython 3 Compatibility https://github.com/pyproj4/pyproj/issues/1321 Hopefully, the bug fix will be released soon https://github.com/pyproj4/pyproj/pull/1322

mjanez commented 12 months ago

The issue is from Cython 3 Compatibility pyproj4/pyproj#1321 Hopefully, the bug fix will be released soon pyproj4/pyproj#1322

Until version 3.6.1 of pyproj is released, replacing 'reqs' with this may work on >=3.9 and CKAN >2.9.

ckantoolkit
lxml>=2.3
argparse
pyparsing>=2.1.10
requests>=1.1.0
six

# requirements pyproj tempfix: https://github.com/pyproj4/pyproj/issues/1321
pyproj==2.6.1; python_version < '3.9'
pyproj @ git+https://github.com/pyproj4/pyproj.git@main; python_version >= '3.9'

Shapely==2.0.1
OWSLib==0.28.1
geojson==3.0.1
avdata99 commented 11 months ago

I'm having the same error Probably related to https://github.com/pyproj4/pyproj/issues/1321 and https://github.com/cython/cython/issues/5305

Checking

avdata99 commented 11 months ago

313 was started to fix this