System: Win7 64, Python 3.4, Pycharm 3.0.2, MinGW
Whenever I try to install a package, in Pycharm or via command line, I get this:
running install
running build
running build_py
running build_ext
Traceback (most recent call last):
File "C:\Users\MyAccount\Downloads\scandir-master\scandir-master\setup.py", line 48, in <module> 'Programming Language :: Python :: Implementation :: CPython',
File "C:\Python34\lib\distutils\core.py", line 148, in setup dist.run_commands()
File "C:\Python34\lib\distutils\dist.py", line 955, in run_commands self.run_command(cmd)
File "C:\Python34\lib\distutils\dist.py", line 974, in run_command cmd_obj.run()
File "C:\Python34\lib\distutils\command\install.py", line 554, in run self.run_command('build')
File "C:\Python34\lib\distutils\cmd.py", line 313, in run_command self.distribution.run_command(command)
File "C:\Python34\lib\distutils\dist.py", line 974, in run_command cmd_obj.run()
File "C:\Python34\lib\distutils\command\build.py", line 126, in run self.run_command(cmd_name)
File "C:\Python34\lib\distutils\cmd.py", line 313, in run_command self.distribution.run_command(command)
File "C:\Python34\lib\distutils\dist.py", line 974, in run_command cmd_obj.run()
File "C:\Python34\lib\distutils\command\build_ext.py", line 317, in run force=self.force)
File "C:\Python34\lib\distutils\ccompiler.py", line 1031, in new_compiler return klass(None, dry_run, force)
File "C:\Python34\lib\distutils\cygwinccompiler.py", line 282, in __init__ CygwinCCompiler.__init__ (self, verbose, dry_run, force)
File "C:\Python34\lib\distutils\cygwinccompiler.py", line 126, in __init__ if self.ld_version >= "2.10.90":
TypeError: unorderable types: NoneType() >= str()
Earlier today I was getting the "Unable to find vcvarsall.bat" error, but solved that with this thread.
I believe this problem was rooted in me uninstalling Visual Studio Express a few weeks back as I wasn't using it. Is there a way to get around this error without installing VSE again?
Thanks!
Someone recommended I try to compile a helloworld.cpp with mingw. It failed!
The instructions I was using said I only needed to install mingw32-gcc-g++. This didn't work for me. Using the MinGW Installation Manager, I added:
So the proper instructions are:
Open the distutils.cfg and insert two lines
[build]
compiler=mingw32
I think that compiler=mingw32 refers to mingw32.exe executable. That file didn't exist by default for me! I had to make a copy of mingw32-c++.exe and rename it mingw32.exe.
I hope this helps someone else!
I solved this problem by
conda install mingw
in my virtual environment and then placingin Lib\distutils\distutils.cfg
Set the compiler to the msvc (Visual Studio)
It has been tested on Windows 10 x64, Python 3.5.1.
Solution:
Set the compiler to the msvc (Visual Studio).
Create "distutils.cfg" in the "C:\Python35-32\Lib\distutils" folder with the following information
Link: https://wiki.python.org/moin/WindowsCompilers
On Windows 7 with Python 3.42, I could solve this problem with what I found in this thread: Going to the
Python34\Lib
folder, typingdist-info
into the search box in the upper right corner of the folder view and deleting all folders found. This already worked two times for me after I could not install anything anymore via pip without getting the error message this thread is about.Adding to zolointo's answer, the cython installation worked fine after following your instructions. I'm installing Kivy with Python 3.4.1 on Windows 7. Kivy requires Cython. After downloading Cython and running the installation scripts I received the following error:
Cython compilation Problem "error: Unable to find vcvarsall.bat"
Researching that error took me down the path of installing MinGW. If The MinGW installer overwhelms you with optional packages, doc, lic, bin and dlls to install. I installed the ones you mentioned above.
if you run:
python setup.py build_ext --inplace --compiler=mingw32'
you'll get a list of errors ending in:
TypeError: unorderable types: NoneType() >= str()
To fix that I followed zolointo's instructions adding MinGW to the PATH and creating a distutils.cfg file. At that point you can run the setup.py for Cython and everything works!
It's a reported bug in Python, see this: http://bugs.python.org/issue2698