Install PDAL for Python with Anaconda
The Point Data Abstraction Library (PDAL) is a powerful, open-source tool designed to work with dense point clouds. PDAL has applications that range from engineering to geography and is especially useful for working with lidar and structure from motion data. PDAL is written in C++ and is also available as a command-line executable and Python bindings.
The PDAL installation process is quite easy using Anaconda. If you haven’t used Anaconda before you can follow my Anaconda installation tutorial.
With Anaconda, you can install PDAL in 4 steps.
- Download and install Anaconda
- Create a new Anaconda environment
- Install PDAL with
conda
- Check the PDAL installation
I’ll walk you through the PDAL installation steps to make sure you get it working.
1. Download and Install Anaconda
To start, you’ll need to download and install Anaconda. Anaconda is a Python distribution that includes several tools and repositories that make working with Python environments, packages, and interrelated dependencies relatively simple. If you’re new to Anaconda, you can follow my installation guide.
Once you have Anaconda installed move on to the next step.
2. Create a New Anaconda Environment
The PDAL documentation recommends that you do not install PDAL on the base Anaconda environment. If have already created a conda environment that you would like to use continue to the next.
Otherwise, create a new conda environment with the following command. The name of the environment will be pdalpy. You can use a different environment name if you would like. You can change the Python version to your preferred version.
conda create -n pdalpy python=3.9
Now activate the pdalpy
environment with this command.
conda activate pdalpy
You should see the environment name in parentheses (e.g. (pdalpy)
) on the left side of your terminal line.
3. Install PDAL with conda
PDAL installation is simple once you have Anaconda installed and have created an environment to use. Make sure the conda environment where you want to install PDAL is active. Then install the python-pdal package from the conda-forge channel. This is demonstrated below.
PDAL is not available from the default conda channels, so you must specify the conda-forge channel or you will not be able to install PDAL.
conda install -c conda-forge python-pdal
Only use the above command if you have activated an environment where you would like to install PDAL. If you have created an environment that is not currently active you can use the following command to install PDAL to an environment without activating it. Be sure to replace envname
with the name of your environment.
conda install -n envname -c conda-forge python-pdal
You can also create a new environment and install PDAL to that new environment using this command. Be sure to replace envname
with the name of your environment.
conda create -n envname -c conda-forge python-pdal
After executing one of the commands above follow the on-screen prompts to complete the installation. A message will indicate if PDAL was installed successfully or if there were any errors.
4. Check the PDAL Installation
Once you have installed PDAL it’s a good idea to check the install and make sure Anaconda recognizes the PDAL executable. Make sure the environment where you installed PDAL is active. Then type pdal
and press enter. You should get a printout in the terminal that displays the basic PDAL help information. It will look something like this.
Usage: pdal <options> pdal <command> <command options> --command The PDAL command --debug Sets the output level to 3 (option deprecated) --verbose, -v Sets the output level (0-8) --drivers List available drivers --help, -h Display help text --list-commands List available commands --version Show program version --options Show options for specified driver (or 'all') --log Log filename (accepts stderr, stdout, stdlog, devnull as special cases) --logtiming Turn on timing for log messages The following commands are available: - chamfer - delta - density - eval - fauxplugin - ground - hausdorff - info - merge - pipeline - random - sort - split - tile - tindex - translate See http://pdal.io/apps/ for more detail
If you don’t see a similar printout work through these steps again and check out the PDAL documentation.