I'm a newbie trying to learn Cython. My operating system is Windows 7 and I'm using Eclipse PyDev as my IDE for Python development.
I have tried to install and test Cython according to this guide:
Here is the content of my environment variable PATH:
C:\texlive\2012\bin\win32;C:\Users\jjepoh\Jonne's_Programs\CodeBlocks\MinGW\bin;C:\Users\jjepoh\Jonne's_Programs\SSH client;C:\Users\jjepoh\Jonne's_Programs\Python\Scripts;
MinGW is installed under Codeblocks:
I have installed Cython 0.20.1 using the Windows binaries from here:
I have Python 2.7.5 installed:
Here you can see Cython installed under Python:
My hello.pyx, test_cython.py and setup.py according to the guide:
It seems I can compile the c-file, but I am doing something wrong I think..here is the end result:
Do you guys have any idea, what am I missing here? Why can't I import the hello.pyx module?
Thank you for any assistance. Sorry for the large amount of pictures, I thought it would help to give as much details as possible. I will give more details when asked =)
I got it solved with the hints provided by user #IanH =)
Here are the links to the solution:
error: Unable to find vcvarsall.bat
Compiling with cython and mingw produces gcc: error: unrecognized command line option '-mno-cygwin'
Here you can see the result =)
Related
I'm running clang on mac to compile a c file created by running a very simple program through cython, but the compiler always give me a "Python.h not found" fatal error. I've tried every solution I could find, reinstalling python 3.9, using the -I/path/to/headerfile method, and rewriting the include statement in the code to contain the full filepath, but nothing has worked. When I do include the full filepath, I get fatal error: 'cpython/initconfig.h' file not found. What could the issue possibly be, and how would I fix it? The program itself works fine in the standard python interpreter, pyinstaller, and nuitka.
Today I needed to embed Python into a C application developed on XCode with Clang compiler, and I've met the same problems and solved them. Let me share the tips:
1. Python not found error
You should install a Python framework to your MacOS, and attach it into Frameworks and Libraries project settings tab. Also, specify it's path in Framework Search Paths inside Build Settings tab if XCode hasn't done it automatically.
2. Undefined symbols / Implicit declaration errors
Verify you're using a modern version of Python framework. Versions prior to 3.6 had different ABI which leads to the mentioned errors.
3. cpython/initconfig.h file not found
Versions prior to ~3.9 had some header inclusion problem for the cpython/initconfig.h file (issues 40642, 39026).
Check the builds of Python that your OS currently has. I found Pythons installed in the following paths:
# Default 2.7 MacOSX installation is here
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/
/Applications/Xcode.app/Contents/Developer/Library/Frameworks/
/Library/Frameworks/
Or install a recent Python version. I recommend using "universal binary" build, see the docs.
I am trying to compile my python script into single EXE. Nuitka can do this and has an acceptable license (Apache free license https://nuitka.net/pages/overview.html).
I was able to resolve 2 warnings by adding command line params below but I can't resolve the error below.
I've searched the web for a combination of Nuitka AND the error below but don't receive results specific enough to solve the issue.
I know it may be difficult to troubleshoot without the code, however let me know if there is a portion of the code I should extract to repro.
Do I need to somehow install "sklearn.utils._unittest_backport" to resolve this error?
I am running the following:
Nuitka v0.6.4
Python: 3.7.0
MSC v.1912 64 bit
OS: Windows
Arch: x86_64
The command line I am using is:
python -m nuitka --standalone --plugin-enable=sklearn --plugin-enable=numpy --nofollow-import-to=sklearn.utils._unittest_backport MyFile.py
The error I receive is:
Error, implicit module 'sklearn.utils._unittest_backport' expected by 'sklearn.utils' not found.
Any help you can provide would be appreciated.
I found a way to work around the error above. I ran
pip install --user -U scikit-learn
To check, I ran the following from the Python command line and it completed successfully:
import sklearn.utils._unittest_backport
I had scikit-learn previously installed, but it seems to have been missing the files I needed.
FYI, _unittest_backport.py is here:
C:\ProgramData\Anaconda3\Lib\site-packages\sklearn\utils
I have been trying to get SCons working now for quite a time, but didn't succeed yet. Before everything else: I'm running Windows 7 x64.
I have firstly installed Python 2.7.11 in C:\Software\Python27 and added both that directory as C:\Software\Python\Scripts to
the system path (for all users, that is). Then I installed SCons in C:\Software\Python27\Lib\site-packages\scons-2.4.1, and
the scripts in the previous mentioned scripts-directory (the directories which the SCons installation msi defaults to).
And now when I try to run SCons I get this error message:
Import failed. Unable to find SCons files in:
...
ImportError: No module named SCons.Script
As a user I really don't have any idea where the error comes from, other than that SCons can't resolve it's own imports.
I got it working by creating though by creating a new folder: C:\Software\Python27\Scripts\scons-local and moving the
contents of the SCons installation folder (...\Python27\Lib\site-packages\scons-2.4.1) to the newly created folder. But this
gives me a syntax error:
I found here that this error is due to my Python version not supporting conditional expressions, because this kind of
expressions are supported from Python 2.4 and higher. The thing is though that I am using Python 2.7.11, and thus I shouldn't get
this error.
Some help would be highly appreciated, thanks in advance!
The windows installer is no longer supported.
The best way to install SCons is now via pip
so:
python -Mpip install SCons
Note you will need Python 3.5 or newer (though at this point I'd suggest 3.10 or newer)
Like many before me I don´t succeed in installing a few Python packages (mysql, pycld2, etc.) on Windows. I have a Windows 8 machine, 64-bit, and Python 3.4. At first I got the well-known error "can´t find vcvarsall.bat - install VS C++ 10.0". This I tried to solve by installing MinGW and use that as compiler. This did not work. Then finally I found an installer for this VS C++ 10.0 here http://microsoft-visual-cpp-express.soft32.com/free-download/. This doesn´t work too good either. Now it seems to find the vcvarsall file but instead gives me a couple of new errors
nclude -IC:\Python34\include /Tc_mysql.c /Fobuild\temp.win32-3.4\Release\_mysql.
obj /Zl_mysql.c_mysql.c(42) : fatal error C1083: Cannot open include file: 'config-win.h':
No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\BIN\\cl.exe' failed with exit status 2
And:
pycldmodule.cc
bindings\pycldmodule.cc(16) : fatal error C1083: Cannot open include file: '
strings.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\BIN\\cl.exe' failed with exit status 2
So now it doesn´t find strings.h and config-win.h and I´m too new to these sorts of problems to know what to look for. Anyone knows what I should do?
The thing is that I could just not use Windows and go over to Ubuntu as, for what I´ve understood, works painlessly with python. However, I have to use the win32com package which doesn´t exist on Ubuntu (have I understood that right?).
If I can´t solve these installing hassles on Windows, would a solution be to use a Windows virtual machine for the win32com part and do the rest on a host Ubuntu (or the other way around)? Would there be anyway to communicate between the two in that case? I.e. sending strings or arrays of data.
I have faced the exact same issues for Python 2.7 on 64 bit Windows trying to install pycld2.
Tried many methods like installing VS express 2008, MingW, etc and it just doesnt work.
What saved me is this link:
https://github.com/aboSamoor/polyglot/issues/11
The proposed solution is to download the binaries from http://www.lfd.uci.edu/~gohlke/pythonlibs/ and pip install .whl
The cpXX denotes the version of python. So in my case, I used cp27.
Hope it helps
I would recommend installing Ubuntu (as a Ubuntu user), you can dual-boot. However, that isn't an answer.
MySQLClient (the fork for Python3) is available a precompiled binary from here:
http://www.lfd.uci.edu/~gohlke/pythonlibs/#mysqlclient
Try to find precompiled binaries for simplicity sake. As far as troubleshooting the install goes, I've tried the recommend VC Studio 9.0 on fresh installs and it cannot find stdint.h (which, like yours, suggests it's more than broken).
You could try http://www.activestate.com/activepython/downloads for Windows. I t includes compiled binaries, avoiding the need for a C complier.
I grew frustrated with trying to get python and other packages to compile/play nicely on Windows as well. Switching over to Ubuntu was a breath of fresh air, for sure.
The win32com package is made specifically for Windows hosts, so that could not longer be used, but there are other ways to achieve the same thing in Ubuntu.
Are you trying to target Windows specifically? What are you using win32com for?
Looks like you're missing MySQL dev package. Another StackOverflow question has the details. But if I were you, I'd go the route Alexander Huszagh recommended and get my precompiled binaries from http://www.lfd.uci.edu/~gohlke/pythonlibs/#mysqlclient
I am following closely the installation guide for pylucene. I am unable to get past the first step, which requires installing JCC.
To install JCC the instructions briefly note that mac users will need to:
Edit setup.py and review that values in the INCLUDES, CFLAGS,
DEBUG_CFLAGS, LFLAGS and JAVAC are correct for your system. These
values are also going to be compiled into JCC's config.py file and are
going to be used by JCC when invoking distutils or setuptools to
compile extensions it is generating code for.
I am not sure what exactly to edit. I have Java 1.6 installed. When I run the setup.py (without any edits), it gives me the error (which I expect because I haven't edited anything, as instructed):
Can't determine where the Java JDK has been installed on this machine. Please set the environment variable JCC_JDK to that location
before running setup.py.
I am a novice coder, so am having trouble finding what I should edit in the setup.py to make this work on a mac? I have tried putting in the file path to java, but this has not helped. Any advice would be much appreciated, thanks!