What to do with this dlib wheel compiling error - python

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?

Related

Pybind11 linking error: relocation R_X86_64_32 against hidden symbol `_ZTI9nan_error' can not be used when making a shared object

I want to create a Python module using pybind11 from a C++ code. In my case, the leading directory is called process_hclust. Inside, there is a src folder that possesses the needed C++ files.
* process_hclust (main folder)
| setup.py
| CMakeLists.txt
* src
| main.cpp
** hclust-cpp
| CMakeLists.txt
| fastcluster.h
| fastcluster.cpp
The main CMakeLists.txt adds the pybind11 module in "src/main.cpp" and links the library needed in the second CMakeLists.txt (as I understand).
cmake_minimum_required(VERSION 3.22.1)
project(process_hclust)
include(FetchContent)
FetchContent_Declare(
pybind11
GIT_REPOSITORY https://github.com/pybind/pybind11
GIT_TAG v2.2.3
)
FetchContent_GetProperties(pybind11)
if(NOT pybind11_POPULATED)
FetchContent_Populate(pybind11)
add_subdirectory(${pybind11_SOURCE_DIR} ${pybind11_BINARY_DIR})
endif()
pybind11_add_module(${PROJECT_NAME} src/main.cpp)
add_subdirectory(src/hclust-cpp)
target_link_libraries(${PROJECT_NAME} PRIVATE fastcluster)
The second. CMakeLists.txt file inside hclust-cpp declares which files need to be linked.
add_library(fastcluster fastcluster.cpp fastcluster.h)
Inside the main.cpp file, I am calling the header files using
#include "hclust-cpp/fastcluster.h"
The setup.py just calls cmake.
This code works on my local computer where I have python3.9 installed. It works by simple using:
pip install ./process_hclust
However, installing the module using my university machines with python3.7, I get the following error:
Processing ./cpp/process_hclust
Preparing metadata (setup.py) ... done
Using legacy 'setup.py install' for process-hclust, since package 'wheel' is not installed.
Installing collected packages: process-hclust
Attempting uninstall: process-hclust
Found existing installation: process-hclust 0.0.0
Uninstalling process-hclust-0.0.0:
Successfully uninstalled process-hclust-0.0.0
Running setup.py install for process-hclust ... error
error: subprocess-exited-with-error
× Running setup.py install for process-hclust did not run successfully.
│ exit code: 1
╰─> [57 lines of output]
running install
running build
running build_ext
-- pybind11 v2.2.3
-- Configuring done
-- Generating done
-- Build files have been written to: /afs/crc.nd.edu/user/j/jmarti53/Public/brain_project/LINKPROJECT/python/cpp/process_hclust/build/temp.linux-x86_64-3.7/process_hclust
Consolidate compiler generated dependencies of target fastcluster
[ 50%] Built target fastcluster
Consolidate compiler generated dependencies of target process_hclust
[ 75%] Linking CXX shared module ../../lib.linux-x86_64-3.7/process_hclust.cpython-37m-x86_64-linux-gnu.so
/usr/bin/ld: src/hclust-cpp/libfastcluster.a(fastcluster.cpp.o): relocation R_X86_64_32 against hidden symbol `_ZTI9nan_error' can not be used when making a shared object
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
gmake[2]: *** [CMakeFiles/process_hclust.dir/build.make:98: ../../lib.linux-x86_64-3.7/process_hclust.cpython-37m-x86_64-linux-gnu.so] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:118: CMakeFiles/process_hclust.dir/all] Error 2
gmake: *** [Makefile:91: all] Error 2
Traceback (most recent call last):
File "<string>", line 36, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "/afs/crc.nd.edu/user/j/jmarti53/Public/brain_project/LINKPROJECT/python/cpp/process_hclust/setup.py", line 137, in <module>
python_requires=">=3.6",
File "/afs/crc.nd.edu/user/j/jmarti53/Public/brain_project/LINKPROJECT/python/env/lib/python3.7/site-packages/setuptools/__init__.py", line 145, in setup
return distutils.core.setup(**attrs)
File "/opt/crc/p/python/3.7.3/gcc/lib/python3.7/distutils/core.py", line 148, in setup
dist.run_commands()
File "/opt/crc/p/python/3.7.3/gcc/lib/python3.7/distutils/dist.py", line 966, in run_commands
self.run_command(cmd)
File "/opt/crc/p/python/3.7.3/gcc/lib/python3.7/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/afs/crc.nd.edu/user/j/jmarti53/Public/brain_project/LINKPROJECT/python/env/lib/python3.7/site-packages/setuptools/command/install.py", line 61, in run
return orig.install.run(self)
File "/opt/crc/p/python/3.7.3/gcc/lib/python3.7/distutils/command/install.py", line 545, in run
self.run_command('build')
File "/opt/crc/p/python/3.7.3/gcc/lib/python3.7/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/opt/crc/p/python/3.7.3/gcc/lib/python3.7/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/opt/crc/p/python/3.7.3/gcc/lib/python3.7/distutils/command/build.py", line 135, in run
self.run_command(cmd_name)
File "/opt/crc/p/python/3.7.3/gcc/lib/python3.7/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/opt/crc/p/python/3.7.3/gcc/lib/python3.7/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/afs/crc.nd.edu/user/j/jmarti53/Public/brain_project/LINKPROJECT/python/env/lib/python3.7/site-packages/setuptools/command/build_ext.py", line 78, in run
_build_ext.run(self)
File "/opt/crc/p/python/3.7.3/gcc/lib/python3.7/distutils/command/build_ext.py", line 340, in run
self.build_extensions()
File "/opt/crc/p/python/3.7.3/gcc/lib/python3.7/distutils/command/build_ext.py", line 449, in build_extensions
self._build_extensions_serial()
File "/opt/crc/p/python/3.7.3/gcc/lib/python3.7/distutils/command/build_ext.py", line 474, in _build_extensions_serial
self.build_extension(ext)
File "/afs/crc.nd.edu/user/j/jmarti53/Public/brain_project/LINKPROJECT/python/cpp/process_hclust/setup.py", line 122, in build_extension
subprocess.check_call(["cmake", "--build", "."] + build_args, cwd=build_temp)
File "/opt/crc/p/python/3.7.3/gcc/lib/python3.7/subprocess.py", line 347, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '--build', '.']' returned non-zero exit status 2.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
Rolling back uninstall of process-hclust
Moving to /afs/crc.nd.edu/user/j/jmarti53/Public/brain_project/LINKPROJECT/python/env/lib/python3.7/site-packages/process_hclust-0.0.0-py3.7.egg-info
from /afs/crc.nd.edu/user/j/jmarti53/Public/brain_project/LINKPROJECT/python/env/lib/python3.7/site-packages/~rocess_hclust-0.0.0-py3.7.egg-info
Moving to /afs/crc.nd.edu/user/j/jmarti53/Public/brain_project/LINKPROJECT/python/env/lib/python3.7/site-packages/process_hclust.cpython-37m-x86_64-linux-gnu.so
from /tmp/pip-uninstall-2ijatdvx/process_hclust.cpython-37m-x86_64-linux-gnu.so
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> process-hclust
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
I believe the main problem is in the line
[ 75%] Linking CXX shared module ../../lib.linux-x86_64-3.7/process_hclust.cpython-37m-x86_64-linux-gnu.so
/usr/bin/ld: src/hclust-cpp/libfastcluster.a(fastcluster.cpp.o): relocation R_X86_64_32 against hidden symbol `_ZTI9nan_error' can not be used when making a shared object
/usr/bin/ld: final link failed: Nonrepresentable section on output
My small knowledge of pybind11, cmake, and building up Python libraries makes me think that the problem appears when the program links the hclust-cpp directory, looking for the fastcluster.h header. Still, I don't understand completely what is happening.
I have been trying to solve this problem for some days, so any suggestion for what to do would be highly appreciated; and in case the problem is confusing and/or need more information, just let me know.
I solved the problem. It got solved by adding SHARED into the second CMakeLists.txt
add_library(fastcluster SHARED fastcluster.cpp fastcluster.h)
Now, it works.

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.

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

Value error trying to install Python for Windows extensions

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.

Categories

Resources