Value error trying to install Python for Windows extensions - python

I have Microsoft Visual Studio 2008 installed already. I downloaded the zip file Python for Windows extensions and extracted the contents into my Python27 folder. There's now a subfolder called pywin32-214. (Is the 32 part a problem? I'm on a 64-bit system.) Here's a transcript from the command line:
C:\Python27\pywin32-214>setup.py -q install
Building pywin32 2.7.214.0
Traceback (most recent call last):
File "C:\Python27\pywin32-214\setup.py", line 2152, in <module>
('', ('pywin32.pth',)),
File "C:\Python27\lib\distutils\core.py", line 152, in setup
dist.run_commands()
File "C:\Python27\lib\distutils\dist.py", line 953, in run_commands
self.run_command(cmd)
File "C:\Python27\lib\distutils\dist.py", line 972, in run_command
cmd_obj.run()
File "C:\Python27\pywin32-214\setup.py", line 1251, in run
install.run(self)
File "C:\Python27\lib\distutils\command\install.py", line 563, in run
self.run_command('build')
File "C:\Python27\lib\distutils\cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "C:\Python27\lib\distutils\dist.py", line 972, in run_command
cmd_obj.run()
File "C:\Python27\pywin32-214\setup.py", line 596, in run
build.run(self)
File "C:\Python27\lib\distutils\command\build.py", line 127, in run
self.run_command(cmd_name)
File "C:\Python27\lib\distutils\cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "C:\Python27\lib\distutils\dist.py", line 972, in run_command
cmd_obj.run()
File "C:\Python27\lib\distutils\command\build_ext.py", line 340, in run
self.build_extensions()
File "C:\Python27\pywin32-214\setup.py", line 858, in build_extensions
self.compiler.initialize()
File "C:\Python27\lib\distutils\msvc9compiler.py", line 383, in initialize
vc_env = query_vcvarsall(VERSION, plat_spec)
File "C:\Python27\lib\distutils\msvc9compiler.py", line 299, in query_vcvarsal
l
raise ValueError(str(list(result.keys())))
ValueError: [u'path']
I don't know what to make of this. Help?

Another possible reason for this problem to appear is that you have just installed Visual Studio and the command prompt you're using had been hanging around from the time before the installation.
This is because MSVC installer sets few environment variables and one of these variables ( VS90COMNTOOLS )has to be set for vcvarsall.bat to execute correctly.
But each running program in Windows holds its own local copy of environment variables that gets inherited (copied) from parent process upon child start-up. Thus, after child has started, it does not receive alterations performed on the system-level envvars. And the only way of getting updated environment variables is trough spawning a new instance of a child process with parent that has updated version of envvars.

If you have a 64 bit Python installation:
Install "Microsoft Visual Studio 2008 Professional Edition" with the "X64 Compiler and Tools" option enabled.
Alternatively, download pywin32-214.win-amd64-py2.7.exe from http://sourceforge.net/projects/pywin32/files/pywin32/Build%20214/

As stated it's trying to use a 32-bit compiler for 64-bit python. I was able to build successfully by:
Finding vcvarsx86_amd64.bat in C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\x86_amd64 (depends on your setup)
Open a cmd prompt
Run SET VS90COMNTOOLS=%VS120COMNTOOLS% (depends on setup, see https://stackoverflow.com/a/10558328/2362877)
Run vcvarsx86_amd64.bat
Then pip install <package>

None of these answers worked for me but I found the solution on the issue tracker:
Open cmd.
cd "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin"
Type vcvars32.bat or vcvars64.bat
In the same prompt and -without closing: cd back to the Python module you're trying to install.
The code should now install.
Source: http://bugs.python.org/issue7511

If you are fixed on Python 2.7 64-bit (like I am) and too cheap to buy VS2008 Professional, you can also download VS2008 Express and install the Windows 7 SDK to get a compatible 64-bit compiler for free. After that, run the Windows 7 SDK SetEnv.Cmd script and then the setup.py:
> "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.Cmd"
> setup.py -q install
The SetEnv.Cmd should set up all the environment variables you need for build. When it runs, there should be a message that says "Targeting Windows 7 x64 Debug". You can also use this command to compile in Release mode:
> "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.Cmd" /Release
> setup.py -q install

Python for Windows extensions is only supported on
32-bit MS Windows (95/98), 32-bit MS
Windows (NT/2000/XP), All 32-bit MS
Windows (95/98/NT/2000/XP), Win2K,
WinXP, WinCE
Taken from the sourceforge project page. Seems like you may be out of luck!
EDIT: However... reading this seems to imply otherwise.

I tried all the other answers and a lot more.
Ended up installing python 32-bit, which fixed the issue right away.
If this is an option, it's most likely the easiest fix.

Related

Cx_freeze: How do I resolve conflicts caused by multiple .dylib files having the same name

I have created a python application that I now want to make into a standalone application. I am using cx_freeze from a virtualenv, which has worked before on my machine with scripts that have less dependencies.
I am currently running into an issue where cx_freeze errors when it tries to copy dylib files that are named the same to the build folder.
I am running the command:
python3 setup.py build
My setup.py file looks like:
from cx_Freeze import setup, Executable
build_options = {'packages': ["PySimpleGUI", "matplotlib", "pandas", "descartes", "geopandas", "cities_coordinates"],
#'excludes': ["PIL", "pyproj", "setuptools"],
"zip_exclude_packages": [],}
import sys
base = 'Win32GUI' if sys.platform=='win32' else None
executables = [
Executable('main.py', base=base, targetName = 'data_visualizer')
]
setup(name='data_visualizer',
version = '0.1',
description = 'Data visualization tool',
options = {'build_exe': build_options},
executables = executables)
This is the error I am getting:
...
copying /Users/AidenTheJaunty/projects/test/lib/python3.7/site-packages/fiona/.dylibs/libproj.12.dylib -> build/exe.macosx-10.9-x86_64-3.7/libproj.12.dylib
copying /Users/AidenTheJaunty/projects/test/lib/python3.7/site-packages/fiona/.dylibs/libjson-c.2.dylib -> build/exe.macosx-10.9-x86_64-3.7/libjson-c.2.dylib
Traceback (most recent call last):
File "setup.py", line 18, in <module>
executables = executables)
File "/Users/AidenTheJaunty/projects/test/lib/python3.7/site-packages/cx_Freeze/dist.py", line 392, in setup
distutils.core.setup(**attrs)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/core.py", line 148, in setup
dist.run_commands()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/dist.py", line 966, in run_commands
self.run_command(cmd)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/command/build.py", line 135, in run
self.run_command(cmd_name)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/Users/AidenTheJaunty/projects/test/lib/python3.7/site-packages/cx_Freeze/dist.py", line 260, in run
freezer.Freeze()
File "/Users/AidenTheJaunty/projects/test/lib/python3.7/site-packages/cx_Freeze/freezer.py", line 788, in Freeze
self._WriteModules(fileName, self.finder)
File "/Users/AidenTheJaunty/projects/test/lib/python3.7/site-packages/cx_Freeze/freezer.py", line 712, in _WriteModules
relativeSource=True,
File "/Users/AidenTheJaunty/projects/test/lib/python3.7/site-packages/cx_Freeze/freezer.py", line 231, in _CopyFile
resolvedPath=dependent_file
File "/Users/AidenTheJaunty/projects/test/lib/python3.7/site-packages/cx_Freeze/freezer.py", line 231, in _CopyFile
resolvedPath=dependent_file
File "/Users/AidenTheJaunty/projects/test/lib/python3.7/site-packages/cx_Freeze/freezer.py", line 173, in _CopyFile
sourcePath=normalizedSource, targetPath=normalizedTarget
File "/Users/AidenTheJaunty/projects/test/lib/python3.7/site-packages/cx_Freeze/darwintools.py", line 446, in getDarwinFile
raise DarwinException(exceptionString)
cx_Freeze.darwintools.DarwinException: Attempting to copy two files to "build/exe.macosx-10.9-x86_64-3.7/libwebp.7.dylib"
source 1: "/Users/AidenTheJaunty/projects/test/lib/python3.7/site-packages/PIL/.dylibs/libwebp.7.dylib" (real: "/Users/AidenTheJaunty/projects/test/lib/python3.7/site-packages/PIL/.dylibs/libwebp.7.dylib")
source 2: "/Users/AidenTheJaunty/projects/test/lib/python3.7/site-packages/fiona/.dylibs/libwebp.7.dylib" (real: "/Users/AidenTheJaunty/projects/test/lib/python3.7/site-packages/fiona/.dylibs/libwebp.7.dylib")
(This may be caused by including modules in the zip file that rely on binary libraries with the same name.)
If I exclude libraries that introduce a dylib that conflicts with another (see commented out excludes build option in the setup.py) then the command will run successfully, but my built application will fail because of missing dependencies.
Does anyone know of a way to get around this issue?
Some other info if it matters ->
Operating System: Mac OS Big Sur
Python Version: 3.7.8
cx_freeze version: 6.2
This same name error appears to have been reported in this cx_Freeze issue, introduced by this pull request that raises an error when copying a second file onto the path of another.
A workaround was merged to print a warning and simply use the first copy of the file rather than raising an error. As it doesn't appear to have been released yet (as of 2021-03-09, v6.5.3), I installed cx_Freeze from Git (after cloning and entering the repo, I installed it by pip install -e .), ran cxfreeze, and saw warnings such as this:
*** WARNING ***
Attempting to copy two files to '../distcx/libopenblas.0.dylib'
source 1: '/venv/lib/python3.6/site-packages/numpy/.dylibs/libopenblas.0.dylib' (real: '/venv/lib/python3.6/site-packages/numpy/.dylibs/libopenblas.0.dylib')
source 2: '/venv/lib/python3.6/site-packages/scipy/.dylibs/libopenblas.0.dylib' (real: '/venv/lib/python3.6/site-packages/scipy/.dylibs/libopenblas.0.dylib')
(This may be caused by including modules in the zip file that rely on binary libraries with the same name.)
Using only source 1.
where the conflicting file was simply skipped, allowing the build to proceed.

Installing Petsc on Windows

I installed cygwin with python, make and diffutils.
When I am using the command:
./configure --with-cc=gcc --with-cxx=g++ --with-fc=gfortran --download-mpich --download-fblaslapack
I am getting an error "Windows Python Detected. Please rerun ./configure with cygwin-python".
If I use the command at the cygwin commandline
python setup.py install
I am getting the following runtime error:
Traceback (most recent call last):
File "setup.py", line 314, in <module>
**metadata)
File "C:\ProgramData\Anaconda3\lib\site-packages\setuptools\__init__.py", line 143, in setup
return distutils.core.setup(**attrs)
File "C:\ProgramData\Anaconda3\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "C:\ProgramData\Anaconda3\lib\distutils\dist.py", line 955, in run_commands
self.run_command(cmd)
File "C:\ProgramData\Anaconda3\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "setup.py", line 230, in run
config(prefix, self.dry_run)
File "setup.py", line 166, in config
if status != 0: raise RuntimeError(status)
RuntimeError: 3
Any help welcome.
If you are building on Cygwin do NOT mix with Windows version of Python
so sanitize your PATH to have only cygwin program in it:
export PATH="/usr/local/bin:/usr/bin:/usr/lib/lapack"
./configure --with-cc=gcc --with-cxx=g++ --with-fc=gfortran
about this two settings
--download-mpich --download-fblaslapack
cygwin has its own OpenMPI, Blas and Lapack packages,
so you should use them.
The package names are:
$ cygcheck -cd |grep openmpi
libopenmpi-devel 3.1.6-1
libopenmpi40 3.1.6-1
libopenmpifh40 3.1.6-1
libopenmpiusef08_40 3.1.6-1
libopenmpiusetkr40 3.1.6-1
openmpi 3.1.6-1
$ cygcheck -cd |grep "lapack\|openblas"
liblapack-devel 3.9.0-2
liblapack0 3.9.0-2
libopenblas 0.3.9-1
I am not sure but MPICH, but it will very likely NOT build under Cygwin

What to do with this dlib wheel compiling error

I have struggled for weeks now trying to install dlib.
After watching many videos and reading a stack overflow, I feel like I did something wrong.
OS: Windows 10
Python: 3.8.2 amd_64
*Note, I did install cmake with the 64 and later 32 bit versions from the cmake website, but to no avail. I tried the VS method, (didn't work). I installed the cmake library via pip install cmake without any errors. I find that strange.
I tried everything, but it keeps throwing errors at me, for example earlier it said that my 32 bit Python was incompatible with the 64 bit cmake; then I installed 64 bit Python, same error; tried a 32 bit cmake, same error; then tried to find a wheel for my system (I didn't find one); tried to build my own... and here's where it gets strange.
Could anyone please help me understand what this message is trying to say, better yet, could someone help me make it work, better yet, help me with my issue.
I suspect my PATH may have something to do with it?
C:\Users\Markian\Downloads\dlib-19.9.0.tar\dist\dlib-19.9.0\dlib-19.9.0>python -m setup.py build
running build
running build_py
package init file 'dlib\__init__.py' not found (or not a regular file)
running build_ext
Invoking CMake setup: 'cmake C:\Users\Markian\Downloads\dlib-19.9.0.tar\dist\dlib-19.9.0\dlib-19.9.0\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\Markian\Down
loads\dlib-19.9.0.tar\dist\dlib-19.9.0\dlib-19.9.0\build\lib.win-amd64-3.8 -DPYTHON_EXECUTABLE=C:\Users\Markian\AppData\Local\Programs\Python\Python38\python.exe -DCMAK
E_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\Markian\Downloads\dlib-19.9.0.tar\dist\dlib-19.9.0\dlib-19.9.0\build\lib.win-amd64-3.8 -A x64'
CMake Warning (dev) in CMakeLists.txt:
No project() command is present. The top-level CMakeLists.txt file must
contain a literal, direct call to the project() command. Add a line of
code such as
project(ProjectName)
near the top of the file, but after cmake_minimum_required().
CMake is pretending there is a "project(Project)" command on the first
line.
This warning is for project developers. Use -Wno-dev to suppress it.
-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.18363.
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error in CMakeLists.txt:
No CMAKE_C_COMPILER could be found.
CMake Error in CMakeLists.txt:
No CMAKE_CXX_COMPILER could be found.
-- Configuring incomplete, errors occurred!
See also "C:/Users/Markian/Downloads/dlib-19.9.0.tar/dist/dlib-19.9.0/dlib-19.9.0/build/temp.win-amd64-3.8/Release/CMakeFiles/CMakeOutput.log".
See also "C:/Users/Markian/Downloads/dlib-19.9.0.tar/dist/dlib-19.9.0/dlib-19.9.0/build/temp.win-amd64-3.8/Release/CMakeFiles/CMakeError.log".
Traceback (most recent call last):
File "C:\Users\Markian\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 184, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File "C:\Users\Markian\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 110, in _get_module_details
__import__(pkg_name)
File "C:\Users\Markian\Downloads\dlib-19.9.0.tar\dist\dlib-19.9.0\dlib-19.9.0\setup.py", line 204, in <module>
setup(
File "C:\Users\Markian\AppData\Local\Programs\Python\Python38\lib\site-packages\setuptools\__init__.py", line 145, in setup
return distutils.core.setup(**attrs)
File "C:\Users\Markian\AppData\Local\Programs\Python\Python38\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "C:\Users\Markian\AppData\Local\Programs\Python\Python38\lib\distutils\dist.py", line 966, in run_commands
self.run_command(cmd)
File "C:\Users\Markian\AppData\Local\Programs\Python\Python38\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\Markian\AppData\Local\Programs\Python\Python38\lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "C:\Users\Markian\AppData\Local\Programs\Python\Python38\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\Users\Markian\AppData\Local\Programs\Python\Python38\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\Markian\Downloads\dlib-19.9.0.tar\dist\dlib-19.9.0\dlib-19.9.0\setup.py", line 119, in run
self.build_extension(ext)
File "C:\Users\Markian\Downloads\dlib-19.9.0.tar\dist\dlib-19.9.0\dlib-19.9.0\setup.py", line 153, in build_extension
subprocess.check_call(cmake_setup, cwd=build_folder)
File "C:\Users\Markian\AppData\Local\Programs\Python\Python38\lib\subprocess.py", line 364, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\Markian\\Downloads\\dlib-19.9.0.tar\\dist\\dlib-19.9.0\\dlib-19.9.0\\tools\\python', '-DCMAKE_LIBRARY_OUTP
UT_DIRECTORY=C:\\Users\\Markian\\Downloads\\dlib-19.9.0.tar\\dist\\dlib-19.9.0\\dlib-19.9.0\\build\\lib.win-amd64-3.8', '-DPYTHON_EXECUTABLE=C:\\Users\\Markian\\AppData
\\Local\\Programs\\Python\\Python38\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\Markian\\Downloads\\dlib-19.9.0.tar\\dist\\dlib-19.9.0\\dlib-19.9
.0\\build\\lib.win-amd64-3.8', '-A', 'x64']' returned non-zero exit status 1.
I have no experience with subprocess.
Could anyone maybe point me towards a cp38 amd64 windows wheel for dlib?

How should I configure BitBake to cross compile my python module?

I have inherited an Open Embedded / Yocto based project for which I need to amend the OS image. I would like to add a new python module - pycrypto. The project builds just fine before I make changes.
I have added the following BitBake recipe for pycrypto:
DESCRIPTION = "Python crypto"
SECTION = "devel/python"
LICENSE = "PD"
SRC_URI = "https://pypi.python.org/packages/source/p/pycrypto/pycrypto-${PV}.tar.gz"
SRC_URI[md5sum] = "55a61a054aa66812daf5161a0d5d7eda"
SRC_URI[sha256sum] = "f2ce1e989b272cfcb677616763e0a2e7ec659effa67a88aa92b3a65528f60a3c"
LIC_FILES_CHKSUM = "file://README;md5=453a552a607fd82384e25db312340e9a"
S = "${WORKDIR}/pycrypto-${PV}"
inherit setuptools
as python-crypto_2.6.1.bb.
I then use this in my main OS image recipe:
PYTHON_INSTALL = " \
python-ctypes python-subprocess python-threading python-json \
python-pyopenssl python-audio python-bsddb python-codecs python-compile python-compiler python-compression python-core python-crypt python-curses python-datetime python-db python-debugger python-dev python-difflib python-distutils python-doctest python-elementtree python-email python-fcntl python-gdbm python-hotshot python-html python-idle python-image python-io python-lang python-logging python-mailbox python-math python-mime python-mmap python-multiprocessing python-netclient python-netserver python-numbers python-pickle python-pkgutil python-pprint python-profile python-pydoc python-re python-readline python-resource python-robotparser python-shell python-smtpd python-sqlite3 python-sqlite3-tests python-stringold python-syslog python-terminal python-tests python-textutils python-tkinter python-unittest python-unixadmin python-xml python-xmlrpc python-zlib python-modules python-pyserial python-misc python-mysql python-crypto\
"
When the build executes (bitbake my-image), everything seems to go fine retrieving the sources for pycrypto. However after compilation, configure attempts to run the cross compiled program - which doesn't work (it's built for a different architecture) and stops bitbake creating my image.
Here's the logfile:
DEBUG: Executing shell function do_compile
running build
running build_py
running build_ext
running build_configure
checking for gcc... arm-poky-linux-gnueabi-gcc -march=armv7-a -mfloat-abi=hard -mfpu=neon -mtune=cortex-a8 --sysroot=/media/parallels/build/tmp/sysroots/overo
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... configure: error: in `/media/parallels/build/tmp/work/cortexa8hf-vfp-neon-poky-linux-gnueabi/python-crypto/2.6.1-r0/pycrypto-2.6.1':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details
Traceback (most recent call last):
File "setup.py", line 456, in <module>
core.setup(**kw)
File "/media/parallels/build/tmp/sysroots/x86_64-linux/usr/lib/python2.7/distutils/core.py", line 151, in setup
dist.run_commands()
File "/media/parallels/build/tmp/sysroots/x86_64-linux/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/media/parallels/build/tmp/sysroots/x86_64-linux/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/media/parallels/build/tmp/sysroots/x86_64-linux/usr/lib/python2.7/distutils/command/build.py", line 127, in run
self.run_command(cmd_name)
File "/media/parallels/build/tmp/sysroots/x86_64-linux/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "/media/parallels/build/tmp/sysroots/x86_64-linux/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "setup.py", line 251, in run
self.run_command(cmd_name)
File "/media/parallels/build/tmp/sysroots/x86_64-linux/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "/media/parallels/build/tmp/sysroots/x86_64-linux/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "setup.py", line 278, in run
raise RuntimeError("autoconf error")
RuntimeError: autoconf error
ERROR: python setup.py build_ext execution failed.
WARNING: exit code 1 from a shell command.
ERROR: Function failed: do_compile (log file is located at /media/parallels/build/tmp/work/cortexa8hf-vfp-neon-poky-linux-gnueabi/python-crypto/2.6.1-r0/temp/log.do_compile.6553)
I'm building from an x64 host and targeting an ARM processor.
The advice in the logfile seems reasonable - "If you meant to cross compile, use `--host'." - the only problem is where do I use --host?
Also, it's a bit disconcerting that a search of the existing project sources reveal no other instances of --host being used and it all builds for ARM just fine so maybe this message is leading me astray.
Can anyone help with configuring BitBake/automake/whatever-part-of-the-Open-Embedded-toolchain so that once my module has been cross compiled it doesn't then try to execute it on my host machine (wrong architecture)?
Thanks!
layers.openembedded.org is your friend: http://git.yoctoproject.org/cgit/cgit.cgi/meta-security/tree/recipes-devtools/python/python-pycrypto_2.6.1.bb?h=master
This needs to be reviewed and ideally moved to meta-python, but it should work. Specifically I see that it includes autotools which then does the cross-compilation magic for you.

Python - Can't Install Packages: TypeError: unorderable types: NoneType() >= str()

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!
I solved this problem by conda install mingw in my virtual environment and then placing
[build]
compiler=msvc
in Lib\distutils\distutils.cfg
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:
mingw-developer-toolkit
mingw32-base
msys-base
mingw32-gcc-g++ (already installed previously)
So the proper instructions are:
Download the mingw-get-setup.exe installer from here: http://sourceforge.net/projects/mingw/files/Installer/
Run it
Install the packages mentioned above
Add c:\mingw\bin\ to your path environment variable
Goto c:\python34\Lib\distutils\ and create distutils.cfg
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!
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
[build]
compiler=msvc
[build_ext]
compiler=msvc
Link: https://wiki.python.org/moin/WindowsCompilers
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!
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, typing dist-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.
It's a reported bug in Python, see this: http://bugs.python.org/issue2698

Categories

Resources