setuptools.setup can't find dylib library files but they are there

665 views Asked by At

When I run my setup.py file, I get several warnings of the following form: warning: no files found matching 'myfile.dylib.

In [1]: ls -la /path/to/myfile.dylib
-rwxr-xr-x   1 kilojoules  admin     55680 Jun 11 13:34 /path/to/myfile.dylib

I am running the setup function with an extension which I made using the setuptools.extension.Extension function, specifying the include dirs and library dirs as a list which I have confirmed includes the files setup.py can't find.

In [2]: include_dirs
Out[2]: 
['some/path/somewhere'
 '/usr/local/path/to',
 'other/paths']

In [3]: library_dirs
Out[3]: 
['some/path/somewhere'
 '/path/to',
 'other/paths']

I'm not sure where this process is failing, and why python can't find the include libraries. Is it because these are .dylib files? I'm on OSX, in case that's relevant information. What could possibly be causing this mysterious error?

My_ext = Extension(name='My_ext',
                     sources=sources,
                     include_dirs=include_dirs,
                     define_macros=define_macros,
                     extra_compile_args=CXX_FLAGS,
                     extra_link_args=LD_FLAGS,
                     library_dirs=library_dirs,
                     libraries=libraries,
                     language='c++')
setup(name='My_ext',
      version=my_version_number,
      description='a dummy extension',
      py_modules=['module1', 'module2']
      ext_modules=[My_ext],
      zip_safe=False,
      data_files=data_files)
1

There are 1 answers

2
l'L'l On

Usually include_dirs are the locations for header includes called from your code, whilst library_dirs are the locations for linked libs in addition to dynamically linked libraries .dylib

Try changing library_dirs to the lcoation of myfile.dylib.