When running a Python script that contain import theano, I get this error:
===============================
00001 #include <Python.h>
00002 #include "structmember.h"
00003 #include <sys/time.h>
00004
00005 // Old Python compatibility from here:
00006 // http://www.python.org/dev/peps/pep-0353/
[...]
01077 return RETVAL;
01078 }
01079
01080
Problem occurred during compilation with the command line below:
C:\programming\cpp\gcc-4.9.2-tdm-1-core\bin\g++.exe -shared -g -D NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -m64 -DMS_WIN64 -IC:\Anaconda\lib\site-packages\numpy\core\include -IC:\Anaconda\include -o C:\Users\Francky\AppData\Local\Theano\compiledir_Windows-7-6.1.7601-SP1-Intel64_Family_6_Model_58_Stepping_9_GenuineIntel-2.7.10-64\lazylinker_ext\lazylinker_ext.pyd C:\Users\Francky\AppData\Local\Theano\compiledir_Windows-7-6.1.7601-SP1-Intel64_Family_6_Model_58_Stepping_9_GenuineIntel-2.7.10-64\lazylinker_ext\mod.cpp -LC:\Anaconda\libs -LC:\Anaconda -lpython27
===============================
g++.exe: error: CreateProcess: No such file or directory
Traceback (most recent call last):
File "C:\Users\Francky\Documents\GitHub\nlp\6864project\code\theano\eval_dialog_cat.py", line 7, in <module>
import theano
File "c:\users\francky\downloads\theano-rel-0.7\theano-rel-0.7\theano\__init__.py", line 55, in <module>
from theano.compile import \
File "c:\users\francky\downloads\theano-rel-0.7\theano-rel-0.7\theano\compile\__init__.py", line 9, in <module>
from theano.compile.function_module import *
File "c:\users\francky\downloads\theano-rel-0.7\theano-rel-0.7\theano\compile\function_module.py", line 18, in <module>
import theano.compile.mode
File "c:\users\francky\downloads\theano-rel-0.7\theano-rel-0.7\theano\compile\mode.py", line 11, in <module>
import theano.gof.vm
File "c:\users\francky\downloads\theano-rel-0.7\theano-rel-0.7\theano\gof\vm.py", line 568, in <module>
import lazylinker_c
File "c:\users\francky\downloads\theano-rel-0.7\theano-rel-0.7\theano\gof\lazylinker_c.py", line 116, in <module>
preargs=args)
File "c:\users\francky\downloads\theano-rel-0.7\theano-rel-0.7\theano\gof\cmodule.py", line 2010, in compile_str
(status, compile_stderr.replace('\n', '. ')))
. ception: Compilation failed (return status=1): g++.exe: error: CreateProcess: No such file or directory
It looks like g++.exe: error: CreateProcess: No such file or directory is caused by the absence of the file C:\Users\Francky\AppData\Local\Theano\compiledir_Windows-7-6.1.7601-SP1-Intel64_Family_6_Model_58_Stepping_9_GenuineIntel-2.7.10-64\lazylinker_ext\lazylinker_ext.pyd. How am I supposed to get this file?
I have installed Theano in Anaconda Python 2.7.10 X64 as follows:
conda install mingw libpython
pip install theano
Then I changed the g++ compiler namely TDM-GCC MinGW Compiler so that it compiles to x64 (otherwise I get C:\Users\Francky\AppData\Local\Theano\compiledir_Windows-7-6.1.7601-SP1-Intel64_Family_6_Model_58_Stepping_9_GenuineIntel-2.7.10-64\lazylinker_ext\mod.cpp:1: sorry, unimplemented: 64-bit mode not compiled in).
From here.
Have you closed your Command window and opened a new one? Changes to your environment variables (via the standard Windows dialogue window) will not apply to open Command windows (you could set the variables separately and manually in an open Command window though).
If setting environment variables doesn't help, the other answers to the linked question may help.
I've spent a couple of days on this. Ultimately I had to update theano AFTER changing my G++ compiler to 64 bit (I used http://mingw-w64.org/doku.php). Windows "where" command makes it easy to see where the g++ is installed: where g++ gave me several locations including the 32bit version.
Related
I am getting the following tracebacks when I try to colcon build my workspace (I am using Ros2 Foxy in windows):
--- stderr: dynamixel_sdk_custom_interfaces
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\yimmi\AppData\Roaming\Python\Python38\site-packages\numpy\__init__.py", line 138, in <module>
from . import _distributor_init
File "C:\Users\yimmi\AppData\Roaming\Python\Python38\site-packages\numpy\_distributor_init.py", line 26, in <module>
WinDLL(os.path.abspath(filename))
File "ctypes\__init__.py", line 373, in __init__
OSError: [WinError 193] %1 no es una aplicaci¾n Win32 vßlida
CMake Error at C:/opt/ros/foxy/x64/share/rosidl_generator_py/cmake/rosidl_generator_py_generate_interfaces.cmake:213 (message):
execute_process(C:/opt/ros/foxy/x64/python.exe -c 'import
numpy;print(numpy.get_include())') returned error code 1
Call Stack (most recent call first):
C:/opt/ros/foxy/x64/share/ament_cmake_core/cmake/core/ament_execute_extensions.cmake:48 (include)
C:/opt/ros/foxy/x64/share/rosidl_cmake/cmake/rosidl_generate_interfaces.cmake:286 (ament_execute_extensions)
CMakeLists.txt:31 (rosidl_generate_interfaces)
Does anyone know how to solve it?
I notice this:
WinError 193
It looks your python runtime version is not match Numpy (CPU arch different?). Maybe you had installed Anacoda and it overrides the default python path.
You could try to check your python path.
Visual Studio 2019 has been installed in my windows. I have coded c++ with it, and it doesn't have any problem with the compiler.
The compiler, cl.exe, exists in this directory:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\bin\Hostx64\x64
When I wanted to install dlib using pip, CMake couldn't compile it.
pip install dlib ─╯
Collecting dlib
Using cached dlib-19.22.1.tar.gz (7.4 MB)
Building wheels for collected packages: dlib
Building wheel for dlib (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: 'D:\Anaconda\anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\ali entezari\\AppData\\Local\\Temp\\pip-install-y4nrjyij\\dlib_9dee571796eb4938989dad25a6107bfa\\setup.py'"'"'; __file__='"'"'C:\\Users\\ali entezari\\AppData\\Local\\Temp\\pip-install-y4nrjyij\\dlib_9dee571796eb4938989dad25a6107bfa\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\ali entezari\AppData\Local\Temp\pip-wheel-cc19gyz4'
cwd: C:\Users\ali entezari\AppData\Local\Temp\pip-install-y4nrjyij\dlib_9dee571796eb4938989dad25a6107bfa\
Complete output (58 lines):
running bdist_wheel
running build
running build_py
package init file 'tools\python\dlib\__init__.py' not found (or not a regular file)
running build_ext
Building extension for Python 3.8.3 (default, Jul 2 2020, 17:30:36) [MSC v.1916 64 bit (AMD64)]
Invoking CMake setup: 'cmake C:\Users\ali entezari\AppData\Local\Temp\pip-install-y4nrjyij\dlib_9dee571796eb4938989dad25a6107bfa\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\ali entezari\AppData\Local\Temp\pip-install-y4nrjyij\dlib_9dee571796eb4938989dad25a6107bfa\build\lib.win-amd64-3.8 -DPYTHON_EXECUTABLE=D:\Anaconda\anaconda3\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\ali entezari\AppData\Local\Temp\pip-install-y4nrjyij\dlib_9dee571796eb4938989dad25a6107bfa\build\lib.win-amd64-3.8 -A x64'
-- Building for: NMake Makefiles
CMake Error at CMakeLists.txt:5 (message):
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
You must use Visual Studio to build a python extension on windows. If you
are getting this error it means you have not installed Visual C++. Note
that there are many flavors of Visual Studio, like Visual Studio for C#
development. You need to install Visual Studio for C++.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-- Configuring incomplete, errors occurred!
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\ali entezari\AppData\Local\Temp\pip-install-y4nrjyij\dlib_9dee571796eb4938989dad25a6107bfa\setup.py", line 222, in <module>
setup(
File "D:\Anaconda\anaconda3\lib\site-packages\setuptools\__init__.py", line 153, in setup
return distutils.core.setup(**attrs)
File "D:\Anaconda\anaconda3\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "D:\Anaconda\anaconda3\lib\distutils\dist.py", line 966, in run_commands
self.run_command(cmd)
File "D:\Anaconda\anaconda3\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "D:\Anaconda\anaconda3\lib\site-packages\wheel\bdist_wheel.py", line 299, in run
self.run_command('build')
File "D:\Anaconda\anaconda3\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "D:\Anaconda\anaconda3\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "D:\Anaconda\anaconda3\lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "D:\Anaconda\anaconda3\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "D:\Anaconda\anaconda3\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\ali entezari\AppData\Local\Temp\pip-install-y4nrjyij\dlib_9dee571796eb4938989dad25a6107bfa\setup.py", line 134, in run
self.build_extension(ext)
File "C:\Users\ali entezari\AppData\Local\Temp\pip-install-y4nrjyij\dlib_9dee571796eb4938989dad25a6107bfa\setup.py", line 171, in build_extension
subprocess.check_call(cmake_setup, cwd=build_folder)
File "D:\Anaconda\anaconda3\lib\subprocess.py", line 364, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\ali entezari\\AppData\\Local\\Temp\\pip-install-y4nrjyij\\dlib_9dee571796eb4938989dad25a6107bfa\\tools\\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\ali entezari\\AppData\\Local\\Temp\\pip-install-y4nrjyij\\dlib_9dee571796eb4938989dad25a6107bfa\\build\\lib.win-amd64-3.8', '-DPYTHON_EXECUTABLE=D:\\Anaconda\\anaconda3\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\ali entezari\\AppData\\Local\\Temp\\pip-install-y4nrjyij\\dlib_9dee571796eb4938989dad25a6107bfa\\build\\lib.win-amd64-3.8', '-A', 'x64']' returned non-zero exit status 1.
----------------------------------------
ERROR: Failed building wheel for dlib
Running setup.py clean for dlib
Failed to build dlib
I've checked my environment variable path; VS2019INSTALLDIR was there.
VS2019INSTALLDIR
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
I had this problem with compiling Mozilla Firefox before, and I couldn't solve it. I will be appreciated if anyone could help me to get rid of this problem. Sorry for English, I'm not a native speaker :).
I had the same problem. It was probably related to the plugins and extensions you have installed. My issue was not resolved until I reinstalled Visual Studio. Try to install it again.
I'm trying to build OpenSfM on my M1 MacBook. I installed GCC11, Ceres and OpenCV via MacPorts. I needed to add /opt/local/lib manually to OpenSfM's CMakeLists.txt as setuptools somehow didn't find ceres.h, but afterwards compiling OpenSfM worked fine.
When I later on run a program that uses OpenSfM, it fails with:
Traceback (most recent call last):
File "/Users/pvitt/projects/odm/./run.py", line 19, in <module>
from stages.odm_app import ODMApp
File "/Users/pvitt/projects/odm/stages/odm_app.py", line 10, in <module>
from stages.run_opensfm import ODMOpenSfMStage
File "/Users/pvitt/projects/odm/stages/run_opensfm.py", line 14, in <module>
from opendm.osfm import OSFMContext
File "/Users/pvitt/projects/odm/opendm/osfm.py", line 14, in <module>
from opensfm.large import metadataset
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/opensfm-0.5.2-py3.9.egg/opensfm/large/metadataset.py", line 7, in <module>
from opensfm import io
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/opensfm-0.5.2-py3.9.egg/opensfm/io.py", line 11, in <module>
from opensfm import context, features, geo, pygeometry, pymap, types
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/opensfm-0.5.2-py3.9.egg/opensfm/features.py", line 9, in <module>
from opensfm import context, pyfeatures
ImportError: dlopen(/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/opensfm-0.5.2-py3.9.egg/opensfm/pyfeatures.cpython-39-darwin.so, 2): Library not loaded: #rpath/libgomp.1.dylib
Referenced from: /opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/opensfm-0.5.2-py3.9.egg/opensfm/pyfeatures.cpython-39-darwin.so
Reason: image not found
Having a look into /opt/local/lib/ shows me that there is a libgomp.1.dylib:
% ls -al /opt/local/lib/gcc11/libgomp.1.dylib
lrwxr-xr-x 1 root admin 37 May 16 00:57 /opt/local/lib/gcc11/libgomp.1.dylib -> /opt/local/lib/libgcc/libgomp.1.dylib
% ls -al /opt/local/lib/libgcc/libgomp.1.dylib
-rwxr-xr-x 1 root admin 245120 May 16 00:24 /opt/local/lib/libgcc/libgomp.1.dylib
[EDIT]
As my CPU architecture is ARM, I need to have the tools and libs also build for this architecture, what they are:
% file `which gcc`
/opt/local/bin/gcc: Mach-O 64-bit executable arm64
% file /opt/local/lib/opencv4/libopencv_core.4.5.2.dylib
/opt/local/lib/opencv4/libopencv_core.4.5.2.dylib: Mach-O 64-bit dynamically linked shared library arm64
% file /opt/local/lib/gcc11/libgomp.1.dylib
/opt/local/lib/gcc11/libgomp.1.dylib: Mach-O 64-bit dynamically linked shared library arm64
[/EDIT]
So I'm wondering where the error is coming from. Did I do a mistake during compilation? How can I find the reason for this error? As I also had to add /opt/local/lib manually to the CMakeLists.txt file, I suspect that this path is somehow not published properly. But how comes that a folder where MacPorts puts all it's stuff is not used by cmake? Do I have to publish it manually? Via CPATH/LIBRARY_PATH? And why can I just use OpenMP:
% cat test_omp.c
#include <stdio.h>
#include <omp.h>
void main() {
#pragma omp parallel
{
printf("Hello World... from thread = %d\n", omp_get_thread_num());
}
}
% gcc -fopenmp test_omp.c
% ./a.out
Hello World... from thread = 1
Hello World... from thread = 3
Hello World... from thread = 2
Hello World... from thread = 5
Hello World... from thread = 4
Hello World... from thread = 6
Hello World... from thread = 0
Hello World... from thread = 7
I fear it is something really silly, but I just don't see it.
I am trying to compile following trivial code with Cython on Windows7 (64bit) and WinPython:
File testpy.py:
print("hello world from testpy.py file.")
File compile.py
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
ext_modules = [
Extension("testpy", ["testpy.py"]),
# ... all your modules that need be compiled ...
]
setup(
name = 'My Program Name',
cmdclass = {'build_ext': build_ext},
ext_modules = ext_modules
)
I first give command to use mingw:
D:\myfolder> make_cython_use_mingw
cython has been set to use mingw32
to remove this, remove file "E:\WinPython\settings\pydistutils.cfg"
I then give command to compile:
D:\myfolder> python compile.py build_ext --inplace
The process starts but ends with following error:
running build_ext
skipping 'testpy.c' Cython extension (up-to-date)
building 'testpy' extension
C:\MinGW\bin\gcc.exe -mdll -O -Wall -IE:\WinPython\python-3.6.5.amd64\include -IE:\WinPython\python-3.6.5.amd64\include -c testpy.c -o build
\temp.win-amd64-3.6\Release\testpy.o
In file included from E:\WinPython\python-3.6.5.amd64\include/Python.h:68:0,
from testpy.c:4:
E:\WinPython\python-3.6.5.amd64\include/pytime.h:122:12: warning: 'struct timeval' declared inside parameter list will not be visible outsid
e of this definition or declaration
struct timeval *tv,
^~~~~~~
E:\WinPython\python-3.6.5.amd64\include/pytime.h:127:12: warning: 'struct timeval' declared inside parameter list will not be visible outsid
e of this definition or declaration
struct timeval *tv,
^~~~~~~
writing build\temp.win-amd64-3.6\Release\testpy.cp36-win_amd64.def
C:\MinGW\bin\gcc.exe -shared -s build\temp.win-amd64-3.6\Release\testpy.o build\temp.win-amd64-3.6\Release\testpy.cp36-win_amd64.def -LE:\Wi
nPython\python-3.6.5.amd64\libs -LE:\WinPython\python-3.6.5.amd64\PCbuild\amd64 -lpython36 -o D:\myfolder\testpy.cp36-win_amd64.pyd
Cannot export PyInit_testpy: symbol not defined
collect2.exe: error: ld returned 1 exit status
error: command 'C:\\MinGW\\bin\\gcc.exe' failed with exit status 1
Where is the problem and how can it be solved?
Edit:
On renaming py file as pyx as suggested by #ead in comments, it worked to create pyd file. However, on trying it gives following error:
D:\Myfolder>python -c "import Testpy"
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: DLL load failed: %1 is not a valid Win32 application.
Why is this not a valid Win32 application?
My python version is as follows:
Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 17:00:18) [MSC v.1900 64 bit (AMD64)] on win32
Edit: I found that I had mingw installed separately also (apart from part of winpython). I removed that and tried again. I am now getting following error:
python compile.py build_ext --inplace
Traceback (most recent call last):
File "compile.py", line 12, in <module>
ext_modules = ext_modules
File "E:\WinPython\python-3.6.5.amd64\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "E:\WinPython\python-3.6.5.amd64\lib\distutils\dist.py", line 955, in run_commands
self.run_command(cmd)
File "E:\WinPython\python-3.6.5.amd64\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "E:\WinPython\python-3.6.5.amd64\lib\site-packages\Cython\Distutils\old_build_ext.py", line 186, in run
_build_ext.build_ext.run(self)
File "E:\WinPython\python-3.6.5.amd64\lib\distutils\command\build_ext.py", line 308, in run
force=self.force)
File "E:\WinPython\python-3.6.5.amd64\lib\distutils\ccompiler.py", line 1031, in new_compiler
return klass(None, dry_run, force)
File "E:\WinPython\python-3.6.5.amd64\lib\distutils\cygwinccompiler.py", line 282, in __init__
CygwinCCompiler.__init__ (self, verbose, dry_run, force)
File "E:\WinPython\python-3.6.5.amd64\lib\distutils\cygwinccompiler.py", line 126, in __init__
if self.ld_version >= "2.10.90":
TypeError: '>=' not supported between instances of 'NoneType' and 'str'
How can this be corrected?
I need to run node 0.8.4 for a project, but I'm having trouble getting it to install. I've installed nvm in order to run it alongside my current system version of node, but I'm getting an error when I run nvm install 0.8.4:
Node.js configure error: No acceptable C compiler found!
Please make sure you have a C compiler installed on your system and/or
consider adjusting the CC environment variable if you installed
it in a non-standard prefix.
./configure
Node.js configure error: No acceptable C compiler found!
Please make sure you have a C compiler installed on your system and/or
consider adjusting the CC environment variable if you installed
it in a non-standard prefix.
python tools/gyp_node -f make
Traceback (most recent call last):
File "tools/gyp_node", line 58, in <module>
run_gyp(gyp_args)
File "tools/gyp_node", line 18, in run_gyp
rc = gyp.main(args)
File "./tools/gyp/pylib/gyp/__init__.py", line 471, in main
options.circular_check)
File "./tools/gyp/pylib/gyp/__init__.py", line 111, in Load
depth, generator_input_info, check, circular_check)
File "./tools/gyp/pylib/gyp/input.py", line 2378, in Load
depth, check)
File "./tools/gyp/pylib/gyp/input.py", line 430, in LoadTargetBuildFile
includes, depth, check)
File "./tools/gyp/pylib/gyp/input.py", line 384, in LoadTargetBuildFile
build_file_data, PHASE_EARLY, variables, build_file_path)
File "./tools/gyp/pylib/gyp/input.py", line 975, in ProcessVariablesAndConditionsInDict
variables, build_file, 'variables')
File "./tools/gyp/pylib/gyp/input.py", line 982, in ProcessVariablesAndConditionsInDict
expanded = ExpandVariables(value, phase, variables, build_file)
File "./tools/gyp/pylib/gyp/input.py", line 739, in ExpandVariables
' in ' + build_file
KeyError: 'Undefined variable target_arch in /Users/raddevon/.nvm/src/node-v0.8.4/deps/v8/tools/gyp/v8.gyp while loading dependencies of /Users/raddevon/.nvm/src/node-v0.8.4/node.gyp while trying to load /Users/raddevon/.nvm/src/node-v0.8.4/node.gyp'
make: *** [out/Makefile] Error 1
nvm: install v0.8.4 failed!
I first tried to make sure I had the Xcode command line tools installed, and it appears that I do. gcc does work. Any ideas how I can get this working?