JeremyBYU / polylidar

Polylidar3D - Fast polygon extraction from 3D Data

Home Page:https://jeremybyu.github.io/polylidar/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

No module named 'polylidar.polylidar' on Ubuntu 18.04.5 LTS

Priya-Somasundaran opened this issue · comments

  1. I get the following error "No module named 'polylidar.polylidar' " trying to run the example file basic2d.py on python3.6 on Ubuntu 18.04.5 LTS
    Traceback (most recent call last):
    File "", line 1, in
    File "/home/priyas/polylidar-master/cmake-build/lib/python_package/polylidar/init.py", line 1, in
    from .polylidar import * # py2 py3 compatible
    ModuleNotFoundError: No module named 'polylidar.polylidar'

  2. Polylidar installation was complete without errors
    O/P of ./bin/polylidar-simple
    Very Simple C++ Example of Polylidar3D on 2D Point Set
    Polylidar took 0 milliseconds processing a 5 point cloud
    Point indices of Polygon Shell: [3,0,1,2]

  3. Installation was tried both on virtual environment and directly ; both gives No module error.

  4. Installation on Windows platform works well. I could run the example files successfully.

  5. Earlier I had tried polylidar old verison on Ubuntu and all worked well. Switching to Polylidar3D to address large Pointcloud 3d data.

Any insight to this would be of great help , Thanks in advance

How did you perform installation? Did you follow instructions from here. I think one important step is pip install -e . once the python package is built. The -e is important so that the package is found.

Can you also print out the full stack trace of the error?
Did you use a python virtual environment during installation?

Something of note. There is a very old version of polylidar that is on pypi that is not working or supported. I don't think you used it but I should remember to put a note about it being deprecated.

  1. Traceback (most recent call last):
    File "", line 1, in

File "/home/priyas/polylidar-master/cmake-build/lib/python_package/polylidar/init.py", line 1, in
from .polylidar import * # py2 py3 compatible
ModuleNotFoundError: No module named 'polylidar.polylidar'
2. Yes I followed the steps fully and also build python package with PIP install -e.
3. Yes I had tried polylidar old verison on Ubuntu and all worked well. Switching to Polylidar3D to address large Pointcloud 3d data.

Yes I used python virtual environment and installed polylidar after activating it

(nsl_env_3D) priyas@priyas-Precision-5820-Tower:~$ python
Python 3.6.9 (default, Oct 8 2020, 12:12:24)
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.

import polylidar
Traceback (most recent call last):
File "", line 1, in
File "/home/priyas/polylidar-master/cmake-build/lib/python_package/polylidar/init.py", line 1, in
from .polylidar import * # py2 py3 compatible
ModuleNotFoundError: No module named 'polylidar.polylidar'

Okay thanks for all that data, it does help to narrow things down! I'm sorry that you are having these installation issues. I will spend some time on this. I think I already know what the issue is. It may be that the wrong version of python is being found during the cmake configure. Because of that the wrong python version of the polylidar compiled python module is being built. Therefore during runtime it wont "find" it because its incompatible.

I'm going to try and verify this. If its the case I will see what magic cmake commands i need to rectify it.

Thanks for the bug report!

appreciate the quick response :)

PYTHON_EXECUTABLE:FILEPATH=/usr/bin/python3.7 was changed to python in CMakeCache.txt , and python package was build again . Now I am able to import polylidar without errors .
Thank much for the clue :)

Yeah thats what I was seeing over here. This was never an issue before but now does seem to be. I have no idea what has changed! I also found something interesting here about CMake and finding the virtualenv.

I tried using -DPython3_FIND_VIRTUALENV=ONLY but I can not get it to reliably work. Im going to keep this issue open until I figure out a way for this to work reliably.

Okay so I have update the installation instructions with a note about this issue and a way to fix it:

There have been some recent issues with CMake not identifying the activated python virtual environment, see Issue . To fix this add -DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)") to force pybind11 to use your virtualenv python environment. I have also noticed that things just “work again” if you use CMake 3.15 or higher as well as upgrade pybind11 to version 2.6.0. However setting the python executable is simpler and less intrusive.

Since this issue is not affecting you anymore I will be closing it. Thanks again!