question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Accidentally passing package_data a str value triggers error on Windows but not Linux

See original GitHub issue

As part of https://github.com/greenelab/manubot/pull/51, I specified the package_data argument of setuptools.setup() in our setup.py:

    # Specify additional patterns to match files
    package_data={
        'manubot': 'cite/*.lua',
    },

The Linux Travis CI build passes, but the Windows AppVeyer builds error when attempting pip install .. Here is the error:

%CMD_IN_ENV% pip install .
Processing c:\projects\manubot
    Complete output from command python setup.py egg_info:
    running egg_info
    creating pip-egg-info\manubot.egg-info
    writing pip-egg-info\manubot.egg-info\PKG-INFO
    writing dependency_links to pip-egg-info\manubot.egg-info\dependency_links.txt
    writing entry points to pip-egg-info\manubot.egg-info\entry_points.txt
    writing requirements to pip-egg-info\manubot.egg-info\requires.txt
    writing top-level names to pip-egg-info\manubot.egg-info\top_level.txt
    writing manifest file 'pip-egg-info\manubot.egg-info\SOURCES.txt'
    c:\python36\lib\distutils\dist.py:261: UserWarning: Unknown distribution option: 'long_description_content_type'
      warnings.warn(msg)
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\appveyor\AppData\Local\Temp\1\pip-req-build-akczu3gv\setup.py", line 75, in <module>
        'manubot': 'cite/*.lua',
      File "c:\python36\lib\site-packages\setuptools\__init__.py", line 129, in setup
        return distutils.core.setup(**attrs)
      File "c:\python36\lib\distutils\core.py", line 148, in setup
        dist.run_commands()
      File "c:\python36\lib\distutils\dist.py", line 955, in run_commands
        self.run_command(cmd)
      File "c:\python36\lib\distutils\dist.py", line 974, in run_command
        cmd_obj.run()
      File "c:\python36\lib\site-packages\setuptools\command\egg_info.py", line 278, in run
        self.find_sources()
      File "c:\python36\lib\site-packages\setuptools\command\egg_info.py", line 293, in find_sources
        mm.run()
      File "c:\python36\lib\site-packages\setuptools\command\egg_info.py", line 524, in run
        self.add_defaults()
      File "c:\python36\lib\site-packages\setuptools\command\egg_info.py", line 560, in add_defaults
        sdist.add_defaults(self)
      File "c:\python36\lib\site-packages\setuptools\command\py36compat.py", line 34, in add_defaults
        self._add_defaults_python()
      File "c:\python36\lib\site-packages\setuptools\command\sdist.py", line 134, in _add_defaults_python
        for _, src_dir, _, filenames in build_py.data_files:
      File "c:\python36\lib\site-packages\setuptools\command\build_py.py", line 66, in __getattr__
        self.data_files = self._get_data_files()
      File "c:\python36\lib\site-packages\setuptools\command\build_py.py", line 83, in _get_data_files
        return list(map(self._get_pkg_data_files, self.packages or ()))
      File "c:\python36\lib\site-packages\setuptools\command\build_py.py", line 95, in _get_pkg_data_files
        for file in self.find_data_files(package, src_dir)
      File "c:\python36\lib\site-packages\setuptools\command\build_py.py", line 114, in find_data_files
        return self.exclude_data_files(package, src_dir, files)
      File "c:\python36\lib\site-packages\setuptools\command\build_py.py", line 198, in exclude_data_files
        files = list(files)
      File "c:\python36\lib\site-packages\setuptools\command\build_py.py", line 234, in <genexpr>
        for pattern in raw_patterns
      File "c:\python36\lib\distutils\util.py", line 125, in convert_path
        raise ValueError("path '%s' cannot be absolute" % pathname)
    ValueError: path '/' cannot be absolute

In summary, this line in distutils.util.convert_path is throwing the following error:

ValueError: path '/' cannot be absolute

So at some point, it seems that the package_data relative path is converted to absolute triggering this error. Any advice on how to resolve this issue would be greatly appreciated! This is occurring with pip-18.0 in Python 3.6 & 3.7.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
aschmiedcommented, May 17, 2019

@dhimmel according to the docs here the values in the package_data dict should be arrays. Try

package_data={
    'manubot': ['cite/*.lua'],
}
0reactions
dhimmelcommented, May 22, 2019

Looks like the validation of the package_data and exclude_package_data fields occurs here:

https://github.com/pypa/setuptools/blob/3adda966e2e76ad59cf79fd8bdeab77fb11d308f/setuptools/dist.py#L307-L322

Read more comments on GitHub >

github_iconTop Results From Across the Web

String syntax error occurring while switching from Windows ...
I am currently transitioning from running a python script just within a PyCharm anaconda environment to running it on a Linux (ubuntu) SFTP....
Read more >
Package 'data.table' - R Project
When j is a character vector of column names, a numeric vector of column posi- tions to select or of the form startcol:endcol,...
Read more >
Troubleshooting Windows Subsystem for Linux | Microsoft Learn
Provides detailed information about common errors and issues people run into while running Linux on the Windows Subsystem for Linux.
Read more >
Changelog — Python 3.11.1 documentation
Paths are no longer encoded to UTF-8/strict to avoid encoding errors if it ... when pass invalid arguments in os.system() on Windows and...
Read more >
Building Linux System Appliances with KIWI Next Generation ...
This page provides further information how to solve image build problems caused ... Note, that options starting with rd.kiwi are not passed on...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found