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.

TypeError: 'output_dir' must be a string or None since setuptools 40.7.0

See original GitHub issue

We have a tricky regression in Gentoo with setuptools release 40.7.0. This affects many (all?) packages that involve build_ext. These errors aren’t present in 40.6.3. I think I managed to have reproducible steps:

git clone https://github.com/python-pillow/Pillow.git
cd Pillow
virtualenv -p python2 env
. env/bin/activate
pip install -U setuptools
echo -e "[build]\nbuild-base = /tmp/foo" >> setup.cfg
mkdir /tmp/foo
python setup.py build
[...]
Traceback (most recent call last):
  File "setup.py", line 793, in <module>
    zip_safe=not (debug_build() or PLATFORM_MINGW), )
  File "/home/vdupras/src/Pillow/env/lib/python2.7/site-packages/setuptools/__init__.py", line 145, in setup
    return distutils.core.setup(**attrs)
  File "/usr/lib64/python2.7/distutils/core.py", line 151, in setup
    dist.run_commands()
  File "/usr/lib64/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/usr/lib64/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/usr/lib64/python2.7/distutils/command/build.py", line 127, in run
    self.run_command(cmd_name)
  File "/usr/lib64/python2.7/distutils/cmd.py", line 326, in run_command
    self.distribution.run_command(command)
  File "/usr/lib64/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/usr/lib64/python2.7/distutils/command/build_ext.py", line 340, in run
    self.build_extensions()
  File "setup.py", line 695, in build_extensions
    build_ext.build_extensions(self)
  File "/usr/lib64/python2.7/distutils/command/build_ext.py", line 449, in build_extensions
    self.build_extension(ext)
  File "/usr/lib64/python2.7/distutils/command/build_ext.py", line 499, in build_extension
    depends=ext.depends)
  File "/home/vdupras/src/Pillow/mp_compile.py", line 40, in _mp_compile
    output_dir, macros, include_dirs, sources, depends, extra_postargs)
  File "/usr/lib64/python2.7/distutils/ccompiler.py", line 329, in _setup_compile
    raise TypeError, "'output_dir' must be a string or None"
TypeError: 'output_dir' must be a string or None

Can you reproduce on your side?

It the fix isn’t obvious, I can try myself on a PR soon.

(by the way, this is due to distutils’s isinstance() call being made on str rather than basestring and only happens under py2. output_dir is unicode when it should be str)

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

4reactions
jaracocommented, Jan 29, 2019

v40.7.1 is released now with the fix. Thanks for the report and sorry for any inconvenience.

2reactions
bivaldcommented, Jan 28, 2019

I’m seeing this for pypy as well, installing packages such as grpcio

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't install local python package - Stack Overflow
I have fixed this by downgrading setuptools: pip3 install --force-reinstall setuptools==40.8.0. but I don't have any idea of the bug....
Read more >
How to Package Python dependencies with PIP setuptools
In order to download dependencies not found in PyPI, you will need to add URLs to a dependency_links section under setup() in the...
Read more >
Setuptools - PyPI
Easily download, build, install, upgrade, and uninstall Python packages.
Read more >
Setuptools Commands - isort
description = "Run isort on modules registered in setuptools" ... False if not ok: raise DistutilsOptionError( "'%s' must be a list of strings...
Read more >
9. API Reference - Setuptools - Python Packaging Authority
a string. version. The version number of the package; see distutils.version ... specifies that a build failure in the extension should not abort...
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