Unable to get Cython Debugger extension working under Windows 10
Hello,
I'm a very new Python hobbyist developer, so it's very likely I'm getting something wrong but many hours of searching and trying to cobble together a solution have left me at my wit's end.
Problem Description
Whenever I debug a Python script, I get the prompt that installing the Cython extension speeds up debugging. However any attempt to install it generates the following stack trace error:
Traceback (most recent call last):
File "setup_cython.py", line 111, in <module>
build_extension("_pydevd_bundle", extension_name, target_pydevd_name, force_cython, extension_folder, True)
File "setup_cython.py", line 82, in build_extension
setup(
File "C:\msys64\mingw64\lib\python3.8\site-packages\setuptools\__init__.py", line 161, in setup
return distutils.core.setup(**attrs)
File "C:\msys64\mingw64\lib\python3.8\distutils\core.py", line 148, in setup
dist.run_commands()
File "C:\msys64\mingw64\lib\python3.8\distutils\dist.py", line 966, in run_commands
self.run_command(cmd)
File "C:\msys64\mingw64\lib\python3.8\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\msys64\mingw64\lib\python3.8\site-packages\setuptools\command\build_ext.py", line 87, in run
_build_ext.run(self)
File "C:\msys64\mingw64\lib\python3.8\distutils\command\build_ext.py", line 307, in run
self.compiler = new_compiler(compiler=self.compiler,
File "C:\msys64\mingw64\lib\python3.8\distutils\ccompiler.py", line 1034, in new_compiler
return klass(None, dry_run, force)
File "C:\msys64\mingw64\lib\python3.8\distutils\cygwinccompiler.py", line 310, in __init__
CygwinCCompiler.__init__ (self, verbose, dry_run, force)
File "C:\msys64\mingw64\lib\python3.8\distutils\cygwinccompiler.py", line 127, in __init__
if self.ld_version >= "2.10.90":
TypeError: '>=' not supported between instances of 'NoneType' and 'str'
The self.ld error is usually due to a misconfigured gcc install but all the usual fixes don't seem to work for me.
Troubleshooting / Steps to Reproduce(?):
- Install gcc via MSYS2.
- Ensure that "C:\msys64", "C:\msys64\mingw64\bin" and "C:\msys64\usr\bin" are in my PATH
- Confirm that the following commands all work from Command Prompt:
gcc -dumpversion ld -v dllwrap -version - Patch "C:\Python38\Lib\distutils\cygwinccompiler.py" as per this StackOverflow post.
- Add a distutils.cfg file in C:\Python38\Lib\distutils with the following content:
[build] compiler=mingw32.exe
#Tried with & without trailing .exe - Run
python3 setup_cython.py build_ext --inplace --compiler=mingw32in<PYCHARM_INSTALLATION_PATH>
Version Info:
- Windows 10 (1903)
- PyCharm 2020.1.1
- Python 3.8.3
- gcc 9.3.0
- ld 2.34
- dllwrap 2.34
Can someone help me figure out what I'm doing wrong?
At this point, the tip on using Cython to speed up debugging feels like less a tip and more like a taunt :-/
Please sign in to leave a comment.
Cython speedups are already bundled with PyCharm for Windows and doesn't need to be installed. This also mentioned here: https://www.jetbrains.com/help/pycharm/cython-speedups.html#install
I would guess the issue is related to python from mingw64, I'm not sure this is a supported setup for cython speedups.
Please feel free to submit an issue to https://youtrack.jetbrains.com/issues, this will increase chances of developers looking at it.
Andrey Resler Yes I did see the comment about not needing to install Cython speedups in Windows, but then I wasn't sure why the message appeared when I was running PyCharm under Windows. That lead me to go down the rabbit hole of installing gcc etc.
Submitted an issue in YouTrack now: <https://youtrack.jetbrains.com/issue/PY-42828>