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?
Related
Hi I have trouble installing a package called qmesh (https://bitbucket.org/qmesh-developers/qmesh/src/master/)
Is there someone who could help me with this error:
C:\Users\sijbr\Downloads>pip install qmesh
Collecting qmesh
Using cached qmesh-1.0.2.tar.gz (66 kB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [14 lines of output]
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "C:\Users\sijbr\AppData\Local\Temp\pip-install-12czjmow\qmesh_9e30f1be34214b498daff60c6d9881ae\setup.py", line 212, in <module>
main()
File "C:\Users\sijbr\AppData\Local\Temp\pip-install-12czjmow\qmesh_9e30f1be34214b498daff60c6d9881ae\setup.py", line 38, in main
license_copied = subprocess.call(['cp','LICENSE','qmesh/'])
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2288.0_x64__qbz5n2kfra8p0\lib\subprocess.py", line 345, in call
with Popen(*popenargs, **kwargs) as p:
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2288.0_x64__qbz5n2kfra8p0\lib\subprocess.py", line 971, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2288.0_x64__qbz5n2kfra8p0\lib\subprocess.py", line 1440, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
C:\Users\sijbr\Downloads>
Could someone help me fix this error?
I have recently uplodaded a simple **package **which consists of a parser that takes an *excel *file and converts it to *csv *format. The package is called felisaparser.
The problem comes when I try to pip install the package as I get the following error:
\
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [12 lines of output]
Traceback (most recent call last):
File "<string>", line 36, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "C:\Users\clash\AppData\Local\Temp\pip-install-iopmrx_1\felisaparser_b502d68ab1514a8aab4b01085810be9a\setup.py", line 5, in <module>
long_description = (this_directory / "README.md").read_text()
File "c:\Users\clash\AppData\Local\Continuum\anaconda3\lib\pathlib.py", line 1199, in read_text
with self.open(mode='r', encoding=encoding, errors=errors) as f:
File "c:\Users\clash\AppData\Local\Continuum\anaconda3\lib\pathlib.py", line 1186, in open
opener=self._opener)
File "c:\Users\clash\AppData\Local\Continuum\anaconda3\lib\pathlib.py", line 1039, in _opener
return self._accessor.open(self, flags, mode)
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\clash\\AppData\\Local\\Temp\\pip-install-iopmrx_1\\felisaparser_b502d68ab1514a8aab4b01085810be9a\\README.md'
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
I would appreciate any kind of help.
I have tried changing the setup.py but it has not worked.
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.
Tried to install spaCy with pip (version 20.0.2)
but got error like bellow
gcc -c /tmp/pip-install-f2b27qwm/blis/blis/_src/kernels/zen/1/bli_amaxv_zen_int.c -o /tmp/tmpu1wg8fg1/bli_amaxv_zen_int.o -O3 -mavx2 -mfma -mfpmath=sse -march=core-avx2 -fPIC -std=c99 -D_POSIX_C_SOURCE=200112L -DBLIS_VERSION_STRING="0.5.1" -DBLIS_IS_BUILDING_LIBRARY -Iinclude/linux-x86_64 -I./frame/3/ -I./frame/ind/ukernels/ -I./frame/1m/ -I./frame/1f/ -I./frame/1/ -I./frame/include -I/tmp/pip-install-f2b27qwm/blis/blis/_src/include/linux-x86_64
gcc: error: unrecognized command line option '-mavx2'
gcc: error: unrecognized command line option '-mfma'
gcc: error: unrecognized command line option '-mfpmath=sse'
gcc: error: unrecognized command line option '-march=core-avx2'
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-f2b27qwm/blis/setup.py", line 277, in <module>
"Topic :: Scientific/Engineering",
File "/home/{user_name}/.conda/envs/ncn/lib/python3.7/site-packages/setuptools/__init__.py", line 145, in setup
return distutils.core.setup(**attrs)
File "/home/{user_name}/.conda/envs/ncn/lib/python3.7/distutils/core.py", line 148, in setup
dist.run_commands()
File "/home/{user_name}/.conda/envs/ncn/lib/python3.7/distutils/dist.py", line 966, in run_commands
self.run_command(cmd)
File "/home/{user_name}/.conda/envs/ncn/lib/python3.7/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/home/{user_name}/.conda/envs/ncn/lib/python3.7/site-packages/wheel/bdist_wheel.py", line 192, in run
self.run_command('build')
File "/home/{user_name}/.conda/envs/ncn/lib/python3.7/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/home/{user_name}/.conda/envs/ncn/lib/python3.7/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/home/{user_name}/.conda/envs/ncn/lib/python3.7/distutils/command/build.py", line 135, in run
self.run_command(cmd_name)
File "/home/{user_name}/.conda/envs/ncn/lib/python3.7/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/home/{user_name}/.conda/envs/ncn/lib/python3.7/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/home/{user_name}/.conda/envs/ncn/lib/python3.7/distutils/command/build_ext.py", line 340, in run
self.build_extensions()
File "/tmp/pip-install-f2b27qwm/blis/setup.py", line 103, in build_extensions
objects = self.compile_objects(compiler.split("-")[0], arch, OBJ_DIR)
File "/tmp/pip-install-f2b27qwm/blis/setup.py", line 188, in compile_objects
objects.append(self.build_object(env=env, **spec))
File "/tmp/pip-install-f2b27qwm/blis/setup.py", line 201, in build_object
subprocess.check_call(command, cwd=BLIS_DIR)
File "/home/{user_name}/.conda/envs/ncn/lib/python3.7/subprocess.py", line 347, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['gcc', '-c', '/tmp/pip-install-f2b27qwm/blis/blis/_src/kernels/zen/1/bli_amaxv_zen_int.c', '-o', '/tmp/tmpu1wg8fg1/bli_amaxv_zen_int.o', '-O3', '-mavx2', '-mfma', '-mfpmath=sse', '-march=core-avx2', '-fPIC', '-std=c99', '-D_POSIX_C_SOURCE=200112L', '-DBLIS_VERSION_STRING="0.5.1"', '-DBLIS_IS_BUILDING_LIBRARY', '-Iinclude/linux-x86_64', '-I./frame/3/', '-I./frame/ind/ukernels/', '-I./frame/1m/', '-I./frame/1f/', '-I./frame/1/', '-I./frame/include', '-I/tmp/pip-install-f2b27qwm/blis/blis/_src/include/linux-x86_64']' returned non-zero exit status 1.
----------------------------------------
ERROR: Failed building wheel for blis
Running setup.py clean for blis
Failed to build numpy blis
ERROR: Could not build wheels for numpy which use PEP 517 and cannot be installed directly
----------------------------------------
ERROR: Command errored out with exit status 1: /home/{user_name}/.conda/envs/ncn/bin/python /home/{user_name}/.conda/envs/ncn/lib/python3.7/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-3j47_tuc/normal --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'cython>=0.25' 'thinc<7.4.0,>=7.3.0' 'preshed<3.1.0,>=3.0.2' 'murmurhash<1.1.0,>=0.28.0' wheel 'cymem<2.1.0,>=2.0.2' Check the logs for full command output.
it seems there are numpy problem
but i already installed numpy(1.16.5) while installing pytorch(1.12.0)
some stackoverflow solutions did not solve the problem
(Python Cannot install module spaCy)
(Failed building wheel for spacy)
because my machine runs on ppc64le, IBM watson machine.
so there are no wheel for my machine.
several packages are available (https://public.dhe.ibm.com/ibmdl/export/pub/software/server/ibm-ai/conda/#/)
but spaCy is not one of them.
What should I do for installing spaCy?
You may install version 2.2.1 of spacy compiled for ppc64le in the powerai supplementary channel that was recently added.
conda install -c powerai spacy
You may also git clone https://github.com/IBM/powerai and modify https://github.com/IBM/powerai/blob/master/conda-recipes/spacy-feedstock/recipe/meta.yaml#L2-L3 to be version 2.1.6 and then conda-build the package yourself if you want that specific version. (You would then run conda-build from the conda-recipes/spacy-feedstock directory to generate the conda package)
It looks like the package is trying to build code using x86 specific flags: -mavx, flags that use SSE, etc. You should contact the package authors about this: they will need to change their package to not use those flags on platforms other than x86.
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.