i'm trying to create a simple python package, which includes two .pyd files. I'm new to package creation. The package structures is as follow :
\my_package
--- my_package.py
--- __init__.py
--- __version__.py
--- setup.py
--- \lib
--- --- mylib1.pyd
--- --- mylib2.pyd
in my_package.py, the two libraries are imported using pylibimport as follow :
import os
import pylibimport
decode1 = pylibimport.import_module(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'lib', 'mylib1.pyd')
decode2 = pylibimport.import_module(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'lib', 'mylib2.pyd')
my setup.py is written as :
from setuptools import setup
from __version__ import __version__
setup(name = "my_package",
version = __version__,
description = 'package description',
author = 'me'
install_requires = ['numpy', 'pylibimport'],
zip_safe = False)
Using the python setup.py sdist
command, the package is compressed into .tar.gz archive and installed using pip
. However, the .pyd files are not copied to the env 'site-package' folder, resulting in an AttributeError when trying to load the modules. Any help would be greatly appreciated !
I've tried to :
- add
package_data = {'my_package':['lib/*.pyd],}
orpackage_data = {'':['lib/*.pyd],}
to setup.py - add a MANIFEST.in file into my_package folder, writting :
recursive-include lib/*.pyd
andinclude_package_data = True
in setup.py, as suggested here.