pythonpython-2.7setup.py

Python: Package directory does not exist


I'm trying to install a python package in windows 10 using the following setup.py file.

"""Setup file for uhd module"""

from setuptools import setup

setup(name='uhd',
      version='3.14.0',
      description='Universal Software Radio Peripheral (USRP) Hardware Driver Python API',
      classifiers=[
          'Development Status :: 4 - Beta',
          'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
          'Programming Language :: C++',
          'Programming Language :: Python',
          'Topic :: System :: Hardware :: Hardware Drivers',
      ],
      keywords='SDR UHD USRP',
      author='Ettus Research',
      author_email='packages@ettus.com',
      url='https://www.ettus.com/',
      license='GPLv3',
      package_dir={'': 'C:/Users/bcollins/UHD_PY/uhd/host/build/python'}, 
      package_data={'uhd': ['*.so']},
      zip_safe=False,
      packages=['uhd'],
      install_requires=['numpy'])

I execute the script using the command

python setup.py install

I do this from the directory that contains the setup.py file.

This returns the following error

error: package directory 'C:Users\bcollins\UHD_PY\uhd\host\build\python\uhd' does not exist

There is a folder called "uhd" at that location though. The folder contains the __init__.py file

If the script isn't looking for this folder, what is it looking for?

I'm not exactly experienced in this area but my best guess is that its looking for a .so file within the "uhd" folder at that location, but I'm not sure.

I am using python 2.7.


Solution

  • package_dir has to be a relative path, not an absolute path. The distutils layer under setuptools tries to reject absolute paths, but the C: confuses it. It ends up converting your path to

    C:Users\bcollins\UHD_PY\uhd\host\build\python\uhd
    

    Note the missing backslash between C: and Users. This path is relative to your current working directory on the C drive (windows drive handling is weird), and relative to your working directory, this path is invalid.