Import pdal error on windows 10 (JSONDecodeError)

241 views Asked by At

Have some problem with PDAL lib. After the library installation tried to import pdal and the error has been rised:

JSONDecodeError                           Traceback (most recent call last) ~\AppData\Local\Temp/ipykernel_17208/3968280360.py in <module>
----> 1 import pdal

~\anaconda3\lib\site-packages\pdal\__init__.py in <module>
      6 from .pipeline import Filter, Pipeline, Reader, Stage, Writer
      7 
----> 8 inject_pdal_drivers()
      9 dimensions = libpdalpython.getDimensions()
     10 info = libpdalpython.getInfo()

~\anaconda3\lib\site-packages\pdal\drivers.py in inject_pdal_drivers()
     68 #     options = libpdalpython.getOptions()
     69 
---> 70     drivers = json.loads(
     71         subprocess.run(["pdal", "--drivers", "--showjson"], capture_output=True).stdout
     72     )

~\anaconda3\lib\json\__init__.py in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)
    344             parse_int is None and parse_float is None and
    345             parse_constant is None and object_pairs_hook is None and not kw):
--> 346         return _default_decoder.decode(s)
    347     if cls is None:
    348         cls = JSONDecoder

~\anaconda3\lib\json\decoder.py in decode(self, s, _w)
    335 
    336         """
--> 337         obj, end = self.raw_decode(s, idx=_w(s, 0).end())
    338         end = _w(s, end).end()
    339         if end != len(s):

~\anaconda3\lib\json\decoder.py in raw_decode(self, s, idx)
    351         """
    352         try:
--> 353             obj, end = self.scan_once(s, idx)
    354         except StopIteration as err:
    355             raise JSONDecodeError("Expecting value", s, err.value) from None

JSONDecodeError: Unterminated string starting at: line 759 column 17 (char 25323)

I've tried to decompose the problem and used the next:

import subprocess
import json

subproc = subprocess.run(["pdal", "--drivers", "--showjson"], capture_output=True).stdout    
drivers = json.loads(subproc)

and found that subprocess.run(["pdal", "--drivers", "--showjson"]) completed with an error returncode CompletedProcess(args=['pdal', '--drivers', '--showjson'], returncode=3221226505) and .stdout of this subprocess gets incompleted .json file (the code below is tail-6 of subprocess.run(["pdal", "--drivers", "--showjson"], capture_output=True).stdout and it's unfinished).

{
    "description": "Write data in the Point Cloud Library (PCL) format.",
    "extensions": [
        "pcd"
    ],
    "link": "http://pda

Did anyone meet such problem?

1

There are 1 answers

0
BobGratton On

I had the exact same problem with a conda installation of PDAL 2.2.0 on a pre-existing conda environment (Windows 10, Python 3.9)

Then, as suggested here I reinstalled PDAL on a new dedicated environment with:

conda create -n <environment name> -c conda-forge python-pdal

and

python import pdal

is now working.

Here is the .yml file content of the environment that was creting the problem in the first place :

name: geo_env2
channels:
  - conda-forge
  - defaults
dependencies:
  - abseil-cpp=20210324.1=h0e60522_0
  - affine=2.3.1=pyhd8ed1ab_0
  - altair=4.2.0=pyhd8ed1ab_1
  - appdirs=1.4.4=pyh9f0ad1d_0
  - arrow-cpp=4.0.0=py39h55b1ac3_3_cpu
  - astropy=5.1=py39h5d4886f_0
  - asttokens=2.1.0=pyhd8ed1ab_0
  - async_generator=1.10=py_0
  - attrs=22.1.0=pyh71513ae_1
  - aws-c-cal=0.5.11=he19cf47_0
  - aws-c-common=0.6.2=h8ffe710_0
  - aws-c-event-stream=0.2.7=h70e1b0c_13
  - aws-c-io=0.10.5=h2fe331c_0
  - aws-checksums=0.1.11=h1e232aa_7
  - aws-sdk-cpp=1.8.186=hb0612c5_3
  - backcall=0.2.0=pyh9f0ad1d_0
  - backports=1.0=py_2
  - backports.functools_lru_cache=1.6.4=pyhd8ed1ab_0
  - bcrypt=3.2.2=py39ha55989b_1
  - blinker=1.5=pyhd8ed1ab_0
  - blosc=1.21.1=hcbbf2c4_0
  - bokeh=2.4.3=pyhd8ed1ab_3
  - boost-cpp=1.74.0=h54f0996_3
  - branca=0.3.1=py_0
  - brotli=1.0.9=h8ffe710_7
  - brotli-bin=1.0.9=h8ffe710_7
  - brotlipy=0.7.0=py39hb82d6ee_1004
  - bzip2=1.0.8=h8ffe710_4
  - c-ares=1.18.1=h8ffe710_0
  - ca-certificates=2022.9.24=h5b45459_0
  - cachetools=5.2.0=pyhd8ed1ab_0
  - cairo=1.16.0=hb19e0ff_1008
  - cartopy=0.19.0.post1=py39hfa2520c_1
  - certifi=2022.9.24=pyhd8ed1ab_0
  - cffi=1.15.1=py39h0878f49_0
  - cfitsio=3.470=h0af3d06_7
  - charls=2.2.0=h39d44d4_0
  - charset-normalizer=2.1.1=pyhd8ed1ab_0
  - click=7.1.2=pyh9f0ad1d_0
  - click-plugins=1.1.1=py_0
  - cligj=0.7.2=pyhd8ed1ab_1
  - cloudpickle=2.1.0=pyhd8ed1ab_0
  - colorama=0.4.6=pyhd8ed1ab_0
  - commonmark=0.9.1=py_0
  - cryptography=37.0.4=py39h7bc7c5c_0
  - curl=7.83.1=h789b8ee_0
  - cycler=0.11.0=pyhd8ed1ab_0
  - cytoolz=0.12.0=py39hb82d6ee_0
  - dask=2022.9.0=pyhd8ed1ab_0
  - dask-core=2022.9.0=pyhd8ed1ab_0
  - dask-geopandas=0.2.0=pyhd8ed1ab_0
  - dataclasses=0.8=pyhc8e2a94_3
  - debugpy=1.6.3=py39h99910a6_1
  - decorator=5.1.1=pyhd8ed1ab_0
  - distributed=2022.9.0=pyhd8ed1ab_0
  - earthpy=0.9.4=pyhd8ed1ab_0
  - entrypoints=0.4=pyhd8ed1ab_0
  - executing=1.2.0=pyhd8ed1ab_0
  - expat=2.4.8=h39d44d4_0
  - fiona=1.8.18=py39h9f1b043_1
  - folium=0.13.0=pyhd8ed1ab_0
  - fontconfig=2.14.0=hce3cb01_0
  - fonttools=4.37.1=py39hb82d6ee_0
  - freetype=2.12.1=h546665d_0
  - freexl=1.0.6=ha8e266a_0
  - fsspec=2022.8.2=pyhd8ed1ab_0
  - future=0.18.2=pyhd8ed1ab_6
  - gdal=3.2.1=py39h6795fcd_7
  - geckodriver=0.30.0=hdb13177_0
  - geopandas=0.11.1=pyhd8ed1ab_0
  - geopandas-base=0.11.1=pyha770c72_0
  - geos=3.9.1=h39d44d4_2
  - geotiff=1.6.0=hee96dd5_4
  - gettext=0.19.8.1=ha2e2712_1008
  - gflags=2.2.2=ha925a31_1004
  - giflib=5.2.1=h8d14728_2
  - gitdb=4.0.9=pyhd8ed1ab_0
  - gitpython=3.1.29=pyhd8ed1ab_0
  - glog=0.5.0=h4797de2_0
  - grpc-cpp=1.37.1=h586195c_2
  - h11=0.13.0=pyhd8ed1ab_1
  - hdf4=4.2.15=h0e5069d_4
  - hdf5=1.10.6=nompi_h5268f04_1114
  - heapdict=1.0.1=py_0
  - icu=68.2=h0e60522_0
  - idna=3.3=pyhd8ed1ab_0
  - imagecodecs=2021.3.31=py39h433ed9d_0
  - imageio=2.13.1=pyhd8ed1ab_0
  - importlib-metadata=4.11.4=py39hcbf5309_0
  - importlib_resources=5.9.0=pyhd8ed1ab_0
  - intel-openmp=2022.1.0=h57928b3_3787
  - ipykernel=6.17.0=pyh025b116_0
  - ipython=8.6.0=pyh08f2357_1
  - ipywidgets=8.0.2=pyhd8ed1ab_1
  - jedi=0.18.1=pyhd8ed1ab_2
  - jinja2=3.1.2=pyhd8ed1ab_1
  - joblib=1.1.0=pyhd8ed1ab_0
  - jpeg=9e=h8ffe710_2
  - jsonschema=4.17.0=pyhd8ed1ab_0
  - jupyter_client=7.3.4=pyhd8ed1ab_0
  - jupyter_core=4.11.2=py39hcbf5309_0
  - jupyterlab_widgets=3.0.3=pyhd8ed1ab_0
  - jxrlib=1.1=h8ffe710_2
  - kealib=1.4.14=h96bfa42_2
  - kiwisolver=1.4.4=py39h2e07f2f_0
  - krb5=1.19.3=h1176d77_0
  - laspy=2.2.0=pyh8a188c0_0
  - lcms2=2.12=h2a16943_0
  - lerc=2.2.1=h0e60522_0
  - libaec=1.0.6=h39d44d4_0
  - libblas=3.9.0=16_win64_mkl
  - libbrotlicommon=1.0.9=h8ffe710_7
  - libbrotlidec=1.0.9=h8ffe710_7
  - libbrotlienc=1.0.9=h8ffe710_7
  - libcblas=3.9.0=16_win64_mkl
  - libcurl=7.83.1=h789b8ee_0
  - libdeflate=1.7=h8ffe710_5
  - libffi=3.4.2=h8ffe710_5
  - libgdal=3.2.1=hca2c63a_7
  - libglib=2.72.1=h3be07f2_0
  - libiconv=1.16=he774522_0
  - libkml=1.3.0=h9859afa_1014
  - liblapack=3.9.0=16_win64_mkl
  - libnetcdf=4.7.4=nompi_h3a9aa94_107
  - libpng=1.6.37=h1d00b33_4
  - libpq=13.5=hfcc5ef8_1
  - libprotobuf=3.16.0=h7755175_0
  - librttopo=1.1.0=hb340de5_6
  - libsodium=1.0.18=h8d14728_1
  - libspatialindex=1.9.3=h39d44d4_4
  - libspatialite=5.0.1=h987baeb_3
  - libsqlite=3.39.3=hcfcfb64_0
  - libssh2=1.10.0=h680486a_3
  - libthrift=0.14.1=h636ae23_2
  - libtiff=4.2.0=h763f289_2
  - libutf8proc=2.8.0=h82a8f57_0
  - libwebp-base=1.2.4=h8ffe710_0
  - libxml2=2.9.14=hf5bbc77_4
  - libzlib=1.2.12=h8ffe710_2
  - libzopfli=1.0.3=h0e60522_0
  - locket=1.0.0=pyhd8ed1ab_0
  - lz4=4.0.0=py39h0878066_2
  - lz4-c=1.9.3=h8ffe710_1
  - m2w64-gcc-libgfortran=5.3.0=6
  - m2w64-gcc-libs=5.3.0=7
  - m2w64-gcc-libs-core=5.3.0=7
  - m2w64-gmp=6.1.0=2
  - m2w64-libwinpthread-git=5.0.0.4634.697f757=2
  - mapclassify=2.4.3=pyhd8ed1ab_0
  - markupsafe=2.1.1=py39hb82d6ee_1
  - matplotlib-base=3.5.3=py39he03a255_2
  - matplotlib-inline=0.1.6=pyhd8ed1ab_0
  - metpy=1.3.1=pyhd8ed1ab_0
  - mkl=2022.1.0=h6a75c08_874
  - msgpack-python=1.0.4=py39h2e07f2f_0
  - msys2-conda-epoch=20160418=1
  - munch=2.5.0=py_0
  - munkres=1.1.4=pyh9f0ad1d_0
  - nbformat=5.7.0=pyhd8ed1ab_0
  - nest-asyncio=1.5.6=pyhd8ed1ab_0
  - networkx=2.8.6=pyhd8ed1ab_0
  - numpy=1.23.2=py39h1a62c8c_0
  - olefile=0.46=pyh9f0ad1d_1
  - openjpeg=2.4.0=hb211442_1
  - openssl=1.1.1s=hcfcfb64_0
  - outcome=1.2.0=pyhd8ed1ab_0
  - packaging=21.3=pyhd8ed1ab_0
  - pandas=1.4.4=py39h80a8885_0
  - paramiko=2.12.0=pyhd8ed1ab_0
  - parquet-cpp=1.5.1=2
  - parso=0.8.3=pyhd8ed1ab_0
  - partd=1.3.0=pyhd8ed1ab_0
  - pcre=8.45=h0e60522_0
  - pickleshare=0.7.5=py_1003
  - pillow=8.2.0=py39h1a9d4f7_1
  - pint=0.19.2=pyhd8ed1ab_0
  - pip=22.2.2=pyhd8ed1ab_0
  - pixman=0.40.0=h8ffe710_0
  - pkgutil-resolve-name=1.3.10=pyhd8ed1ab_0
  - pooch=1.6.0=pyhd8ed1ab_0
  - poppler=0.89.0=h3772339_5
  - poppler-data=0.4.11=hd8ed1ab_0
  - postgresql=13.5=h1c22c4f_1
  - proj=7.2.0=h1cfcee9_2
  - prompt-toolkit=3.0.32=pyha770c72_0
  - protobuf=3.16.0=py39h415ef7b_0
  - psutil=5.9.2=py39ha55989b_0
  - pure_eval=0.2.2=pyhd8ed1ab_0
  - pyarrow=4.0.0=py39hf9247be_3_cpu
  - pycparser=2.21=pyhd8ed1ab_0
  - pydeck=0.7.1=pyh6c4a22f_0
  - pyerfa=2.0.0.1=py39h5d4886f_2
  - pygeos=0.10.2=py39haadaec5_0
  - pygments=2.13.0=pyhd8ed1ab_0
  - pykrige=1.7.0=py39hb82d6ee_0
  - pympler=1.0.1=pyhd8ed1ab_0
  - pynacl=1.5.0=py39h09fa780_2
  - pyopenssl=22.0.0=pyhd8ed1ab_0
  - pyparsing=3.0.9=pyhd8ed1ab_0
  - pyrsistent=0.19.2=py39ha55989b_0
  - pysftp=0.2.9=py_1
  - pyshp=2.3.1=pyhd8ed1ab_0
  - pysocks=1.7.1=pyh0701188_6
  - python=3.9.13=h9a09f29_0_cpython
  - python-dateutil=2.8.2=pyhd8ed1ab_0
  - python-fastjsonschema=2.16.2=pyhd8ed1ab_0
  - python-tzdata=2022.6=pyhd8ed1ab_0
  - python_abi=3.9=2_cp39
  - pytz=2022.2.1=pyhd8ed1ab_0
  - pytz-deprecation-shim=0.1.0.post0=py39hcbf5309_3
  - pywavelets=1.3.0=py39h5d4886f_1
  - pywin32=304=py39h99910a6_2
  - pyyaml=6.0=py39hb82d6ee_4
  - pyzmq=24.0.1=py39hea35a22_1
  - rasterio=1.2.6=py39h334309b_0
  - re2=2021.04.01=h0e60522_0
  - requests=2.28.1=pyhd8ed1ab_1
  - rich=12.6.0=pyhd8ed1ab_0
  - rtree=1.0.0=py39h09fdee3_1
  - scikit-image=0.19.3=py39h2e25243_1
  - scikit-learn=1.1.2=py39hfd4428b_0
  - scipy=1.9.1=py39h316f440_0
  - selenium=4.4.0=pyhd8ed1ab_0
  - semver=2.13.0=pyh9f0ad1d_0
  - setuptools=65.3.0=pyhd8ed1ab_1
  - shapely=1.8.0=py39haadaec5_0
  - six=1.16.0=pyh6c4a22f_0
  - smmap=3.0.5=pyh44b312d_0
  - snappy=1.1.9=h82413e6_1
  - sniffio=1.3.0=pyhd8ed1ab_0
  - snuggs=1.4.7=py_0
  - sortedcontainers=2.4.0=pyhd8ed1ab_0
  - sqlite=3.39.3=hcfcfb64_0
  - stack_data=0.6.0=pyhd8ed1ab_0
  - streamlit=1.14.0=pyhd8ed1ab_0
  - tbb=2021.5.0=h2d74725_1
  - tblib=1.7.0=pyhd8ed1ab_0
  - threadpoolctl=3.1.0=pyh8a188c0_0
  - tifffile=2021.4.8=pyhd8ed1ab_0
  - tiledb=2.2.9=hf84e3da_0
  - tk=8.6.12=h8ffe710_0
  - toml=0.10.2=pyhd8ed1ab_0
  - toolz=0.12.0=pyhd8ed1ab_0
  - tornado=6.1=py39hb82d6ee_3
  - traitlets=5.4.0=pyhd8ed1ab_0
  - trio=0.21.0=py39hcbf5309_0
  - trio-websocket=0.9.2=pyhd8ed1ab_0
  - typing_extensions=4.3.0=pyha770c72_0
  - tzdata=2022c=h191b570_0
  - tzlocal=4.2=py39hcbf5309_2
  - ucrt=10.0.20348.0=h57928b3_0
  - unicodedata2=14.0.0=py39hb82d6ee_1
  - urllib3=1.26.11=pyhd8ed1ab_0
  - validators=0.18.2=pyhd3deb0d_0
  - vc=14.2=hb210afc_7
  - vs2015_runtime=14.29.30139=h890b9b1_7
  - watchdog=2.1.9=py39hcbf5309_1
  - wcwidth=0.2.5=pyh9f0ad1d_2
  - wheel=0.37.1=pyhd8ed1ab_0
  - widgetsnbextension=4.0.3=pyhd8ed1ab_0
  - win_inet_pton=1.1.0=py39hcbf5309_4
  - wsproto=1.2.0=pyhd8ed1ab_0
  - xarray=2022.6.0=pyhd8ed1ab_1
  - xerces-c=3.2.3=h0e60522_5
  - xyzservices=2022.6.0=pyhd8ed1ab_0
  - xz=5.2.6=h8d14728_0
  - yaml=0.2.5=h8ffe710_2
  - zeromq=4.3.4=h0e60522_1
  - zfp=0.5.5=h0e60522_8
  - zict=2.2.0=pyhd8ed1ab_0
  - zipp=3.8.1=pyhd8ed1ab_0
  - zlib=1.2.12=h8ffe710_2
  - zstd=1.4.9=h6255e5f_0
  - pip:
    - geographiclib==1.52
    - laszip==0.1.0
    - lazrs==0.4.4
    - pyproj==3.0.1
    - whitebox==1.0.1
prefix: C:\Anaconda3\envs\geo_env2