uoip / pangolin

Python binding of 3D visualization library Pangolin
MIT License
285 stars 90 forks source link

Asserion error on running `python setup.py install` #20

Open lken01 opened 5 years ago

lken01 commented 5 years ago

Hi, I am getting this error on running python setup.py install

running install
Traceback (most recent call last):
  File "setup.py", line 49, in <module>
    graphical data."""
  File "/usr/local/lib/python3.7/site-packages/setuptools/__init__.py", line 129, in setup
    return distutils.core.setup(**attrs)
  File "/usr/local/lib/python3.7/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/usr/local/lib/python3.7/distutils/dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "/usr/local/lib/python3.7/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "setup.py", line 22, in run
    assert len(lib_file) == 1 and len(install_dirs) >= 1     
AssertionError
lken01 commented 5 years ago

I found the solution. The setup.py had a correction to be made. The variable install_dirs has been initialized as install_dir.

ZisisT commented 5 years ago

I tried that but im still getting the same error, any ideas?

KunB-Fighting commented 4 years ago

you can just copy the .so file to your python lib path, or you can add install_dirs = [install_dir] to initialize install_dirs as a list.

solbach commented 4 years ago

you can just copy the .so file to your python lib path, or you can add install_dirs = [install_dir] to initialize install_dirs as a list.

I was also struggling with this. @LeemeetElaine is completly right. Changing the code to this worked:

def run(self):
        install_dir = get_python_lib()
        install_dirs = [install_dir]

        lib_file = glob.glob(__library_file__)
        assert len(lib_file) == 1 and len(install_dirs) >= 1     

        print('copying {} -> {}'.format(lib_file[0], install_dirs[0]))
        shutil.copy(lib_file[0], install_dir)

Then running: sudo python3.6 setup.py install If you need sudo rights, e.g. dir is /usr/lib/... No sudo is required for most install dir locations when using virtual environments etc.

zhufeng888 commented 4 years ago

I add install_dirs = [install_dir] but it still put the same error "AssertionError", I have struggled with pangolin in python for a day, tired.

fsan commented 3 years ago

@KunB-Fighting solution worked for me

just after install_dirs definition after install_dir

    def run(self):
        install_dir = get_python_lib()
        install_dirs = [install_dir]

running python setup.py install will copy the so file to my conda environment and then I used the demo application from the readme

note: I installed stevenlovegrove main pangolin before. I had a problem while building due to something missing dependency of eigen library but it was actually missing a dependecy for eigen3-devel in my system and it was not listed in the cmake