PDAL / python

PDAL's Python Support
Other
115 stars 34 forks source link

Installation of filters.python #133

Closed Spfeil2 closed 1 year ago

Spfeil2 commented 1 year ago

When i run the pipeline

[
    "path/to/normal_100.las",  
    {  
        "type":"filters.python",
        "script":"path/to/angle.py",
        "function":"calcAngle",
        "module":"anything"
    },
    {
        "type":"writers.las",
        "filename":"path/to/angle.las"
    }
]

pdal triggers this error:

PDAL: Couldn't create filter stage of type 'filters.python'.
You probably have a version of PDAL that didn't come with a plugin
you're trying to load.  Please see the FAQ at https://pdal.io/faq

when i run pdal --drivers filters.python isn't there

filters.planefit             Plane Fit (Kutz et al., 2003)
filters.pmf                  Progressive morphological filter
filters.poisson              Poisson Surface Reconstruction Filter
filters.projpipeline         Transform coordinates using Proj pipeline string, WKT2 coordinate operations or URN definition

im using a virtual env and run this command conda create --yes --name pdalenv --channel conda-forge pdal python-pdal gdal

My question is, how can I get the filters.python driver to be installed to run my pipeline and embed python in pdal?

hobu commented 1 year ago

try manually setting the PDAL_DRIVER_PATH and verify there actually are the .so or .dylib files in that path.

export PDAL_DRIVER_PATH=$CONDA_PREFIX/lib/python3.10/site-packages/pdal
Spfeil2 commented 1 year ago

im sorry, i didn't mention that im using windows10

i tried

set PDAL_DRIVER_PATH=$CONDA_PREFIX\Lib\site-packages\pdal

but it's still not working. I guess the problem is on my windows machine is, that there aren't any similar files like .so or .dylib The libpdalpython.pyd should be the extension which i installed with pip, but i look forward to the embeddeding and not extension

$CONDA_PREFIX\Lib\site-packages\pdal> dir image

----- WSL ----- I also tried to install the conda env and the fitlers.python driver on a Windows-Subsystem for Linux. here, everything works as expected, but for my Project I need to run it on Windows

ClementAlba commented 1 year ago

Hi @Spfeil2,

I had the same problem, try to watch if your $CONDA_PREFIX$\bin contains these files :

If they are, just change your PDAL_DRIVER_PATH value to this :

set PDAL_DRIVER_PATH=$CONDA_PREFIX$\bin

Tip : to see if your PDAL_DRIVER_PATH is correct, you can verify it's value with this command : conda info --system

Spfeil2 commented 1 year ago

That works. Great! Thanks @ClementAlba a lot for this quick solution Also thanks @hobu for the previous reply!

hobu commented 1 year ago

does your conda path have a space in it? The activate script attempts to set this for you, but maybe it isn't appropriately handling spaces?

hobu commented 1 year ago

Please try a fresh conda environment. I have pushed a fixed that should account for spaces in conda prefix names in the activate script there.

Spfeil2 commented 1 year ago

I had no spaces in my path. I tried the push in a new env but the above error is still there