I'm new to weave and I have no clue what is causing this error. The error happens on other code examples too so it's not the specific code. I'm using windows 7 and python 2.7. Thanks to anyone who can help!
>>> from scipy import weave
>>> a = 1
>>> weave.inline('printf("%d\\n",a);',['a'])
No module named msvccompiler in numpy.distutils; trying from distutils
Looking for python27.dll
Looking for python27.dll
Traceback (most recent call last):
File "<pyshell#3>", line 1, in <module>
weave.inline('printf("%d\\n",a);',['a'])
File "C:\Python27\lib\scipy\weave\inline_tools.py", line 366, in inline
**kw)
File "C:\Python27\lib\scipy\weave\inline_tools.py", line 496, in compile_function
verbose=verbose, **kw)
File "C:\Python27\lib\scipy\weave\ext_tools.py", line 373, in compile
verbose=verbose, **kw)
File "C:\Python27\lib\scipy\weave\build_tools.py", line 279, in build_extension
setup(name=module_name, ext_modules=[ext],verbose=verb)
File "C:\Python27\lib\site-packages\numpy\distutils\core.py", line 169, in setup
return old_setup(**new_attr)
File "C:\Python27\lib\distutils\core.py", line 166, in setup
raise SystemExit, "error: " + str(msg)
CompileError: error: Command "g++ -m64 -g -shared c:\users\owner\appdata\local\temp\scipy-owner-tbcany\python27_intermediate\compiler_e3b0c44298fc1c149afbf4c8996fb924\Release\users\owner\appdata\local\temp\owner\python27_compiled\sc_cb1945ea063627b5855c13eafebb07042.o c:\users\owner\appdata\local\temp\scipy-owner-tbcany\python27_intermediate\compiler_e3b0c44298fc1c149afbf4c8996fb924\Release\python27\lib\scipy\weave\scxx\weave_imp.o -LC:\Python27\libs -LC:\Python27\PCbuild\amd64 -lpython27 -lmsvcr90 -o c:\users\owner\appdata\local\temp\owner\python27_compiled\sc_cb1945ea063627b5855c13eafebb07042.pyd" failed with exit status 1
weave.test() didn't find any errors but it only ran 146 tests and the documentation http://docs.scipy.org/doc/scipy/reference/tutorial/weave.html says that it should have ran 180.
>>> weave.test()
Running unit tests for scipy.weave
NumPy version 1.9.1
NumPy is installed in C:\Python27\lib\site-packages\numpy
SciPy version 0.15.1
SciPy is installed in C:\Python27\lib\scipy
Python version 2.7.8 (default, Jun 30 2014, 16:08:48) [MSC v.1500 64 bit (AMD64)]
nose version 1.3.7
..................................S.SSS....SSSSSS.................................................................................................
----------------------------------------------------------------------
Ran 146 tests in 3.439s
OK (SKIP=10)
<nose.result.TextTestResult run=146 errors=0 failures=0>
...quite some time ago I ran into issues with compiling weave code. The problem was probably caused by mixing (Visual Studio) precompiled Python with MinGW-compiled weave code.
Back then, I was using the MinGW64 compiler (MinGW32 worked as well) and developed a three step workaround.
1) In the <pythondir>\libs directory, delete the MSVCR runtime library file, it should be named something like libmsvcr100.a or libmsvcr100d.a (or with 90 or any other version number in it). Along with it delete any file in the folder that has the same creation date (first attempt of using weave).
2) in the (probably not yet created) file <pythondir>\Lib\distutils\distutils.cfg and also <pythondir>\Lib\site-packages\numpy\distutils\distutils.cfg I included the compiler definition
[build]
compiler = mingw32
Maybe you'd need to adjust that to your type of compiler.
3) In <pythondir>\Lib\site-packages\numpy\distutils\mingw32ccompiler.py there comes the real "hack" at around line #329:
in the function implementation of build_msvcr_libaray(debug=False) just hardcode return False as the first line of code.
Now retry your weave code...
Related
The issue:
So, after compilation, inside the dist folder, there is "PyQt5.Qt.pyd" file,
but I am getting this error:
Traceback (most recent call last):
File "main.py", line 102, in <module>
File "<frozen zipimport>", line 259, in load_module
File "<loader>", line 10, in <module>
File "<loader>", line 8, in __load
ImportError: (DLL load failed while importing QtWidgets: The specified module could not be found.) 'Z:\\Project\\dist\\PyQt5.QtWidgets.pyd'
I am pretty sure that that this "Qt" folder from "C:\Program Files (x86)\Python38-32\Lib\site-packages\PyQt5\Qt", which after compilation is converted to "PyQt5.Qt.pyd" file I guess, is responsible for this error. Because when I add this location to my Windows PATH: "C:\Program Files (x86)\Python38-32\Lib\site-packages\PyQt5\Qt\bin", the compiled program works flawlessly.
My temporary fix is:
I copied the "Qt" folder to the "dist", and made a batch script that adds ".\dist\Qt\bin" to PATH, for the current CMD window...Just so I can send it to my client to test it out for now...But this is far from the final solution... What to do?
(I have also tried to copy just "bin", or "platform\qwindows.dll" from "Qt" to dist, but no luck...)
I would appreciate any help or advice regarding this. Thanks in advance!
My info:
OS info:
Windows 10 x64, Python 3.8.6 x32
pip freeze:
altgraph==0.17
cachetools==4.1.1
fbs==0.9.0
future==0.18.2
macholib==1.14
pefile==2019.4.18
Pillow==8.0.1
py2exe==0.10.0.2
PyInstaller==3.4
PyQt5==5.15.1
PyQt5-sip==12.8.1
pywin32==228
pywin32-ctypes==0.2.0
six==1.15.0
py2exe setup.py:
from distutils.core import setup
import py2exe
setup(windows=[{"script":"main.py"}], options={"py2exe":{"includes":["PyQt5.Qt","PyQt5.sip","PyQt5.QtWidgets","PyQt5.QtCore", "PyQt5.QtGui"]}})
Copy all dll's from PyQt5\Qt\bin to dist, except the ones beginning with Qt5* (You might not need d3dcompiler_47, libEGL, libGLESv2 and opengl32sw if your not using direct3d or opengl)
I suggest you try out to run your application converted with py2exe on a newly installed windows (maybe in a virtual machine) to find out if it has other dependencies.
Update: Actually, I only needed to install Microsoft Visual C++ Redistributable for Visual Studio 2015, 2017 and 2019, without copying any dll files. https://support.microsoft.com/en-us/topic/the-latest-supported-visual-c-downloads-2647da03-1eea-4433-9aff-95f26a218cc0
Although I have been using Python for a while, I am relatively new to Anaconda, and package handling in general seems to cause a lot of problems for me.
I am trying to get xgboost up and running with Anaconda. I eventually managed to install it by using the command:
conda install -c anaconda py-xgboost
in the Anaconda prompt.
When I now try import xgboost in the PyCharm Python Console, I am given the following error:
Python 2.7.15 |Anaconda 2.5.0 (64-bit)| (default, May 1 2018, 18:37:09) [MSC v.1500 64 bit (AMD64)] on win32
Backend Qt5Agg is interactive backend. Turning interactive mode on.
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 5.0.4\helpers\pydev\pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "C:\Users\Richard\Anaconda2\lib\site-packages\xgboost\__init__.py", line 11, in <module>
from .core import DMatrix, Booster
File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 5.0.4\helpers\pydev\pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "C:\Users\Richard\Anaconda2\lib\site-packages\xgboost\core.py", line 115, in <module>
_LIB = _load_lib()
File "C:\Users\Richard\Anaconda2\lib\site-packages\xgboost\core.py", line 109, in _load_lib
lib = ctypes.cdll.LoadLibrary(lib_path[0])
File "C:\Users\Richard\Anaconda2\lib\ctypes\__init__.py", line 444, in LoadLibrary
return self._dlltype(name)
File "C:\Users\Richard\Anaconda2\lib\ctypes\__init__.py", line 366, in __init__
self._handle = _dlopen(self._name, mode)
WindowsError: [Error 126] The specified module could not be found
I have searched for similar questions on StackOverflow, but I've had no luck, besides finding complicated answers which I did not feel comfortable implementing without fully understanding, and which I am not sure are applicable to my scenario anyway.
Some further things to note, which may be related:
Originally, I installed the package using pip install xgboost in the Pycharm Terminal before realising my mistake.
When I initially tried testing the xgboost package, I did so (stupidly) in a file named xgboost.py. I have since deleted this project. I uninstalled and reinstalled xgboost afterwards.
I have tried several things to try and resolve this issue which may have complicated things further. For example, I deleted the 'xgboost' folder from inside 'C:\Users\Richard\Anaconda2' when typing conda uninstall xgboost into the Anaconda prompt failed.
Would anyone be able to shed any light on what is causing this issue? This is my first question on stack overflow, so I apologise if my question has not been posed completely correctly with regards to the guidelines.
After further searching, I managed to answer my own question.
The xgboost (C++) library must be compiled and built before it can be used as a Python module. To do so, I carefully followed the instructions on this page:
https://www.ibm.com/developerworks/community/blogs/jfp/entry/Installing_XGBoost_For_Anaconda_on_Windows?lang=en
and now, I think, xgboost is working fine. This is the first time I have encountered a package where this was required, hence the confusion. Hopefully this will help someone else who has the same issue.
I tried to run the following command, in the folder of my Django project:
$ python manage.py dbshell
It shows me this error:
$python manage.py dbshell
Traceback (most recent call last):
File "manage.py", line 11, in <module>
execute_manager(settings)
File "C:\Python25\lib\site-packages\django\core\management\__init__.py", line
362, in execute_manager
utility.execute()
File "C:\Python25\lib\site-packages\django\core\management\__init__.py", line
303, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Python25\lib\site-packages\django\core\management\base.py", line 195,
in run_from_argv
self.execute(*args, **options.__dict__)
File "C:\Python25\lib\site-packages\django\core\management\base.py", line 222,
in execute
output = self.handle(*args, **options)
File "C:\Python25\lib\site-packages\django\core\management\base.py", line 351,
in handle
return self.handle_noargs(**options)
File "C:\Python25\lib\site-packages\django\core\management\commands\dbshell.py
", line 9, in handle_noargs
from django.db import connection
File "C:\Python25\lib\site-packages\django\db\__init__.py", line 41, in <modul
e>
backend = load_backend(settings.DATABASE_ENGINE)
File "C:\Python25\lib\site-packages\django\db\__init__.py", line 17, in load_b
ackend
return import_module('.base', 'django.db.backends.%s' % backend_name)
File "C:\Python25\Lib\site-packages\django\utils\importlib.py", line 35, in im
port_module
__import__(name)
File "C:\Python25\lib\site-packages\django\db\backends\mysql\base.py", line 13
, in <module>
raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No mo
dule named MySQLdb
First question is, why does Python not simply include this MySQLdb module?
OK, just fine, try to search to solve this message.
I have looked around stackoverflow.com for installing this module but did not have a good result.
Download this module at: http://sourceforge.net/projects/mysql-python/
Comes to the installation of this module on my Windows Vista system.
After the extraction of the package, I run the cmd prompt to continue with the installation:
$ python setup.py install
Again it showed me one other message:
D:\SOFTWARE\PROGRAMMING\MySQL-python-1.2.3c1>python setup.py install
Traceback (most recent call last):
File "setup.py", line 5, in <module>
from setuptools import setup, Extension
ImportError: No module named setuptools
Playing around with this error message, I know that there is the ez_setup.py within the package:
$python ez_setup.py
It seems that everything is OK:
D:\SOFTWARE\PROGRAMMING\MySQL-python-1.2.3c1>python ez_setup.py
Downloading http://pypi.python.org/packages/2.5/s/setuptools/setuptools-0.6c9-py
2.5.egg
Processing setuptools-0.6c9-py2.5.egg
Copying setuptools-0.6c9-py2.5.egg to c:\python25\lib\site-packages
Adding setuptools 0.6c9 to easy-install.pth file
Installing easy_install-script.py script to C:\Python25\Scripts
Installing easy_install.exe script to C:\Python25\Scripts
Installing easy_install-2.5-script.py script to C:\Python25\Scripts
Installing easy_install-2.5.exe script to C:\Python25\Scripts
Installed c:\python25\lib\site-packages\setuptools-0.6c9-py2.5.egg
Processing dependencies for setuptools==0.6c9
Finished processing dependencies for setuptools==0.6c9
Now comes back to the setup.py to install again:
$python setup.py install
It again gave me one other error message:
D:\SOFTWARE\PROGRAMMING\MySQL-python-1.2.3c1>python setup.py install
running install
running bdist_egg
....
copying MySQLdb\constants\CLIENT.py -> build\lib.win32-2.5\MySQLdb\constants
running build_ext
error: Python was built with Visual Studio 2003;
extensions must be built with a compiler than can generate compatible binaries.
Visual Studio 2003 was not found on this system. If you have Cygwin installed,
you can try compiling with MingW32, by passing "-c mingw32" to setup.py.
How can I fix this problem?
Did you try looking here: http://sourceforge.net/projects/mysql-python/files/
That is the download area of MySQLdb project, it has nothing to do with django, so your question is incorrect - django does not make switching database backends hard, you just change one line. And of course, your python installation should support that database first, so by downloading binary package for Windows from the link I gave above (chose correct version to match your version of python) you can avoid all the hassle of compiling the source release.
Most probably you need either MySQL-python-1.2.2.win32-py2.5.exe or MySQL-python-1.2.2.win32-py2.4.exe
Uh, this isn't Django, this is you downloading some unspecified Python environment and expecting it to magically do everything exactly the way you wanted it to. Find a good tutorial on this and follow the instructions.
BTW, this is a very helpful forum, but giving no specifics and then delivering a non-question with an attitude is not a good way to get people to feel helpful.
I once had the same problem running Python and MySQL on the same computer. Like the guys/gals said above, Python does not come with built-in support for MySQL, so you will need to download the connectors.
The link given above by #kibitzer will most likely not work on Windows successfully, so go here to download a copy of the connector that works with windows. It comes with installer and no need to run setup.py script manually.
I'm using the pywin32-216.win32-py2.6.exe package to install pywin32 on Python 2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v.1500 32 bit (Intel)] on win32. I am seeing the following post install errors. Could someone help me understand what going wrong? Thanks in advance.
Copied pythoncom26.dll to C:\WINDOWS\system32\pythoncom26.dll
Copied pythoncomloader26.dll to C:\WINDOWS\system32\pythoncomloader26.dll
Copied pywintypes26.dll to C:\WINDOWS\system32\pywintypes26.dll
FAILED to register the Python COM objects
-> Software\Python\PythonCore\2.6\Help[None]=None
-> Software\Python\PythonCore\2.6\Help\Pythonwin Reference[None]='C:\\Python26\\Lib\\site-packages\\PyWin32.chm'
Failed to register pythonwin as editor
Shortcut for Pythonwin created
Shortcut to documentation created
The pywin32 extensions were successfully installed.
Traceback (most recent call last):
File "<string>", line 372, in install
File "<string>", line 170, in RegisterCOMObjects
ImportError: No module named server.register
Traceback (most recent call last):
File "<string>", line 401, in install
File "<string>", line 226, in RegisterPythonwin
File "win32com\shell\shell.pyc", line 12, in <module>
File "win32com\shell\shell.pyc", line 10, in __load
ImportError: DLL load failed: The specified module could not be found.
Most probably pywin32 requires administrator privileges to be installed successfully. I am not sure how to do that on WinXP, but Microsoft has a page about it.
I managed to fix the problem by eventually cleaning all traces of Python 2.6 from my system and re-installing it + pywin32. It was eventually as simple as just double clicking the setup files.
Another answer for the googlers:
I has the same issue, it turns out it originated because I have installed python in the past, removed it and reinstalled it to another location.
In order to solve it I had to:
Remove old installations (Uninstall + manually from registry) - as Danish advised (both in main root and in Wow6432Node).
In the registry update the location of current location of the python folder path (in InstallPath and PythonPath).
I try to build rabbitmq-server-2.4.1 from source. But get error:
make
python codegen.py body codegen/amqp-rabbitmq-0.9.1.json
src/rabbit_framing_amqp_0_9_1.erl
Traceback (most recent call last):
File "codegen.py", line 492, in <module>
"body": generateErl})
File "codegen/amqp_codegen.py", line 283, in do_main_dict
execute(funcDict[function], sources, dest)
File "codegen/amqp_codegen.py", line 262, in execute
fn(amqp_specs)
File "codegen.py", line 485, in generateErl
genErl(AmqpSpec(specPath))
File "codegen/amqp_codegen.py", line 140, in __init__
self.major = self.spec['major-version']
KeyError: 'major-version'
make: *** No rule to make target `deps.mk', needed by
`ebin/bpqueue.beam'. Stop.
I use python 2.7.1
How can i fix it?
Your problem may be the python version.
I was able to compile and install rabbitMQ 2.4.1 using python 2.6.2.
If you use Solaris and use pkgutil, the command to get python 2.6.2 would be
# My version of Sun OS (for comparison)
$ uname -a
SunOS dev21 5.10 Generic_141445-09 i86pc i386 i86pc
# install python 2.6.2
$ sudo pkgutil --install python-2.6.2,REV=2009.08.06
NOTE: I still saw these error messages during make. The build of rabbitMQ 2.4.1 still succeeded.
$ make
/bin/sh: python2.5: not found
python codegen.py body codegen/amqp-rabbitmq-0.9.1.json src/rabbit_framing_amqp_0_9_1.erl
...