Skip to content

Instantly share code, notes, and snippets.

@bhavika
Last active March 6, 2022 13:10
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save bhavika/9d41cb6e6d481a9961783b355824aa22 to your computer and use it in GitHub Desktop.
Save bhavika/9d41cb6e6d481a9961783b355824aa22 to your computer and use it in GitHub Desktop.

Setup Instructions for Pyleargist

https://pypi.org/project/pyleargist/

Installing FFTW

Unix Instructions: http://www.fftw.org/fftw3_doc/Installation-on-Unix.html

Pyleargist setup instructions

  1. Download the archive here: https://pypi.org/project/pyleargist/#files

  2. Replace the setup.py file with this snippet below which replaces occurrences of file() with open() for Python 3 compatibility.

     from setuptools import setup
     from setuptools.extension import Extension
     from Cython.Distutils import build_ext
     import sys, os
     import numpy as np
    
     version = open('VERSION.txt').read().strip()
    
     setup(name='pyleargist',
           version=version,
           description="GIST Image descriptor for scene recognition",
           long_description=open('README.txt').read(),
           classifiers=[], # Get strings from http://pypi.python.org/pypi?%3Aaction=list_classifiers
           keywords=('image-processing computer-vision scene-recognition'),
           author='Olivier Grisel',
           author_email='olivier.grisel@ensta.org',
           url='http://www.bitbucket.org/ogrisel/pyleargist/src/tip/',
           license='PSL',
           package_dir={'': 'src'},
           cmdclass = {"build_ext": build_ext},
           ext_modules=[
               Extension(
                   'leargist', [
                       'lear_gist/standalone_image.c',
                       'lear_gist/gist.c',
                       'src/leargist.pyx',
                   ],
                   libraries=['m', 'fftw3f'],
                   include_dirs=[np.get_include(), 'lear_gist',],
                   extra_compile_args=['-DUSE_GIST', '-DSTANDALONE_GIST'],
               ),
           ],
           )
    
  3. Run python setup.py build If this gives you the error gcc exited with status 1 scroll up to see if the leargist.pxd file is missing. If it is missing in the src directory, download it from Bitbucket Once you do this, run python setup.py build again. Now this step should succeed.

  4. Run sudo python setup.py install. If you get an error for Cython.Distutils not being found, check whether you're using the right version of Python using which python. Alternatively, sometimes sudo picks up the wrong Python path, so give it the Python3 absolute path. For e.g.,

sudo /home/user/anaconda3/bin/python setup.py install.

@aseemk98
Copy link

This was super helpful, thank you so much.
You really saved the day for me!

@spandy1
Copy link

spandy1 commented Oct 6, 2020

BitBucket repo is no longer accessible.

@Baticsute
Copy link

I installed successfully as your guide over 3 weeks ago. Then, I tried to install this module in another PC, but it always stuck at Step 3.
Due to lack of leargist.pxd file and the Bitbucket repo is closed before.
I also tried to find this file in my first succeed install but there is no result, which make me sick whole this week.
I do look for the file than ever. If you keep the file, please release it.

Anyway, thank for your helpful guide 💯 .

@Baticsute
Copy link

@spandy1
Copy link

spandy1 commented Oct 7, 2020

@bhavika
Copy link
Author

bhavika commented Oct 7, 2020

I think I got the file (from https://github.com/mertyyanik/pyleargist-python3/blob/master/src/leargist.pxd).

Thanks for sharing it here!

@kajalpanda1
Copy link

Where do I have to run this setup.py?

@bhavika
Copy link
Author

bhavika commented Apr 23, 2021

Where do I have to run this setup.py?

When you download the archive from here https://pypi.org/project/pyleargist/#files and extract it to a directory, you can enter the directory, edit the setup.py file and run it there.

@kajalpanda1
Copy link

Where do I have to run this setup.py?

When you download the archive from here https://pypi.org/project/pyleargist/#files and extract it to a directory, you can enter the directory, edit the setup.py file and run it there.

Thank you. This setup.py worked after editing but import leargist is not working. I have also tried adding leargist.pxd in the directory. please help with it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment