Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

laspy cannot find laszip when is installed from source. laszip is in path

I am working on a HPC environment and do not have root access. I installed laszip from source.

Install laszip from source

module load git
git clone https://github.com/LASzip/LASzip.git
git checkout tags/2.0.2
cd LASzip

Make files in the build directory.

mkdir build
cd build
module load cmake
module load gcc
cmake .. -DCMAKE_INSTALL_PREFIX=/home/b.weinstein/LASzip/build 
make
make install

Add paths

export LD_LIBRARY_PATH="/home/b.weinstein/LASzip/build/lib:$LD_LIBRARY_PATH"
export PATH="/home/b.weinstein/LASzip/build/bin:$PATH"

Make sure it works locally

(pangeo) [b.weinstein@c30a-s26 bin]$ pwd
/home/b.weinstein/LASzip/build/bin
(pangeo) [b.weinstein@c30a-s26 bin]$ laszip-config --version
2.0.2

Go to a new directory to test linking

cd ~
(pangeo) [b.weinstein@c30a-s26 ~]$ laszip-config --version
2.0.2

Test from python

(pangeo) [b.weinstein@c30a-s26 ~]$ python
Python 3.6.4 | packaged by conda-forge | (default, Dec 23 2017, 16:31:06) 
[GCC 4.8.2 20140120 (Red Hat 4.8.2-15)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import laspy
>>> test_file=laspy.file.File("/ufrc/ewhite/s.marconi/NeonData/2017_Campaign/D03/OSBS/L1/DiscreteLidar/ClassifiedPointCloud/NEON_D03_OSBS_DP1_412000_3283000_classified_point_cloud.laz")
Traceback (most recent call last):
  File "/home/b.weinstein/miniconda3/envs/pangeo/lib/python3.6/site-packages/laspy/base.py", line 204, in map
    self._mmap=FakeMmap(self.filename)
  File "/home/b.weinstein/miniconda3/envs/pangeo/lib/python3.6/site-packages/laspy/base.py", line 57, in __init__
    data = read_compressed(filename)
  File "/home/b.weinstein/miniconda3/envs/pangeo/lib/python3.6/site-packages/laspy/base.py", line 37, in read_compressed
    raise(laspy.util.LaspyException("Laszip was not found on the system"))
laspy.util.LaspyException: Laszip was not found on the system

How can I tell laspy where to look for laszip? Is this a pythonpath issue?

like image 579
bw4sz Avatar asked Dec 07 '22 15:12

bw4sz


1 Answers

You need to install laszip-cli application

git clone https://github.com/LASzip/LASzip.git
cd LASzip
git checkout 3.1.0
cmake .
make
sudo make install
cd ..
wget http://lastools.org/download/LAStools.zip
unzip LAStools.zip
cd LAStools
make
sudo cp bin/laszip /usr/local/bin
sudo ln -s /usr/local/bin/laszip /usr/local/bin/laszip-cli
like image 104
Morse Avatar answered Mar 09 '23 01:03

Morse