4

I am using liblas for python to read .las file. When I enter:

from liblas import file

It gives me:

No module named liblas.

I already set up las library path in system, lasinfo is working fine. Can anyone tell me how to import las library in Python? I am using Ubuntu by the way.

Andre Silva
  • 4,782
  • 9
  • 52
  • 65
Saddy
  • 313
  • 4
  • 22
  • Have you installed [this Python package](https://pypi.python.org/pypi/libLAS) ? – RedBaron Dec 26 '13 at 04:39
  • Actually I installed libLas from [this](http://www.liblas.org/). What are the differences? – Saddy Dec 26 '13 at 04:42
  • @Saddy_Grade: If you install python packages using pip/easy_install, it should also install the required dependencies with it. – ranendra Dec 26 '13 at 05:05
  • You have the C/C++ LibLas libraries. Now you also need their python bindings. If your liblas library is installed fine, download the Python package (link that I gave) and install it using pip/easy_install command. – RedBaron Dec 26 '13 at 05:21
  • @RedBaron: I followed your instruction, and run test script. it can not found liblas_c.so shared object. How do I configure the path? – Saddy Dec 26 '13 at 05:31
  • Looks like the basic liblas package (C/C++ one) wasn't installed correctly. Sorry I can't help you with that because I have no idea about the said software. – RedBaron Dec 26 '13 at 05:54
  • I reinstall it and it works! thanks for you help! – Saddy Dec 26 '13 at 07:24

2 Answers2

3

It looks like the liblas is not properly installed or you configured the path incorrectly. Try installing the package liblas using pip or easy_install.

$ easy_install liblas OR $ pip install liblas
ranendra
  • 2,492
  • 2
  • 19
  • 29
  • Sorry, I am new to python. Yes, I am trying to read and display its content. however, when I run the python script, it gave me **ImportError: No module named liblas** – Saddy Dec 26 '13 at 04:36
  • @Saddy_Grade: how did you installed the liblas module? Did you use pip or easy_install for it? – ranendra Dec 26 '13 at 04:40
  • I use cmake to install liblas – Saddy Dec 26 '13 at 04:45
  • I got this **error: Couldn't find a setup script in /tmp/easy_install-OM1U99/libLAS-1.6.0.win32.zip** . Why is it searching liblas and find the best match is **libLAS 1.6.0.win32**. my system is linux – Saddy Dec 26 '13 at 05:00
2

I had the same problem.

After installing the module liblas, I tried to import it but it failed everytime.

What you can do:

  1. Go to the folder which contains your download liblas folder (for me: /Users/blablabla/anaconda/lib/python2.7/site-packages/libLAS-1.6.0-py2.7.egg). This folder contains 2 folders: EGG-INFO and liblas.
  2. Copy-paste liblas (the folder) into the parent folder (site-packages).

Now go to Python, and import liblas. It should work.

Andre Silva
  • 4,782
  • 9
  • 52
  • 65