Error during the installation of Cython - cython

I have installed SimpleCV 1.3 powerpack in my Windows 8.1. Then i set up the required path. And then i installed pyreadline, PIL, pip, ipython via cmd. But when i tried to run easy_install cython, i'm getting the following error,
C:\Users\Ankit>easy_install Cython
Searching for Cython
Reading http://pypi.python.org/simple/Cython/
Best match: Cython 0.22
Downloading https://pypi.python.org/packages/source/C/Cython/Cython-0.22.tar.gz#
md5=1ae25add4ef7b63ee9b4af697300d6b6
Processing Cython-0.22.tar.gz
Running Cython-0.22\setup.py -q bdist_egg --dist-dir c:\users\ankit\appdata\local
\temp\easy_install-lvjvzj\Cython-0.22\egg-dist-tmp-aeuxtq
Unable to find pgen, not compiling formal grammar.
Compiling module Cython.Plex.Scanners ...
Compiling module Cython.Plex.Actions ...
Compiling module Cython.Compiler.Lexicon ...
Compiling module Cython.Compiler.Scanning ...
Compiling module Cython.Compiler.Parsing ...
Compiling module Cython.Compiler.Visitor ...
Compiling module Cython.Compiler.FlowControl ...
Compiling module Cython.Compiler.Code ...
Compiling module Cython.Tempita._tempita ...
warning: no files found matching '*.pyx' under directory 'Cython\Debugger\Test'
warning: no files found matching '*.pxd' under directory 'Cython\Debugger\Test
warning: no files found matching '*.pxd' under directory 'Cython\Utility'
Scanners.c
C:\Python27\include\pyconfig.h(227) : fatal error C1083: Cannot open include file: 'basetsd.h': No such fil
e or directory
error: Setup script exited with error: command '"C:\Program Files (x86)\Microsof
t Visual Studio 9.0\VC\BIN\cl.exe"' failed with exit status 2
Please help me out.

I'm using a double partition system Windows8/Xubuntu14.04LTS.
I had the same issue when attempting to install Cython onto Xubuntu via pip.
So I installed Cython with below command and and everything went ok.
bashsh $ sudo apt-get install cython
This is not the best fix. But, may worth a trial if you are really
looking to port an almost complete project to Windows8.
You compile your Python main (without main):
bash $ cython --embed -o prog.c prog.py
You may decide to install Mxe (MingW) gcc on linux and do
cross compiling or, as me, to compile directly in the windows8:
bash $ gcc -Os -IC:\Python27\include -LC:\Python27\libs -o prog.exe prog.c -lpython27 -DMS_WIN64
Hope this might be of any help.

Related

Fedora Arm pkg-config file not found error (armv7hl... should be armv7hnl...)

I'm trying to compile a cmake project on a RasberryPi with Fedora Arm 36 and in cmake I use pkg-config. It is correctly installed but I get this error:
/usr/bin/pkg-config: line 8: /usr/bin/armv7hnl-redhat-linux-gnueabi-pkg-config: No such file or directory
In the /usr/bin directory there is a file called armv7hl-redhat-linux-gnueabi-pkg-config (missing n in armv7hnl) is this a bug?
What can I do?
Edit
I've reinstalled pkg-config but still the same error.
/usr/bin/pkg-config is just a bash script that calls the appropriate executable and so I hard coded the one previously mentioned, I don't get an error but pkg-config can't find gtkmm-4.0 which is installed.

How to set up a windows cython environment from scratch?

I have been searching on the internet for hours to find out how to make cython work with no success.
I am on windows , i use python3 with Anaconda and i also have Codeblocks using the mingw GCC compiler.
I would like to be able to run even the most basic code (like 'helloworld') with cython because untill now i've only encountered errors i don't understand. They may come from an unstable developping environment so this is why i ask this question.
The main errors happen when translating the .pyx code to .c and even when i achieve that there are even more errors on the .c generated.
here is my 'helloworld.pyx' :
print('Hello Wolrd')
here is my setup.py :
from distutils.core import setup
from Cython.Build import cythonize
setup(ext_modules=cythonize('helloworld.pyx'))
when i run python3 setup.py i get ModuleNotFoundError: No module named 'Cython'
when i run cython helloworld.pyx , I get a file helloworld.c
but when i run it in Codeblocks i get the error Python.h : no such file or directory
so i temporary fixed it by puting the absolute path in the include command but i still get errors.
i also tried using python setup.py build_ext --inplace but i get
running build_ext
building 'helloworld' extension
C:\MinGW\bin\gcc.exe -mdll -O -Wall -DMS_WIN64 -IC:\Users\Julien\anaconda3\include -IC:\Users\Julien\anaconda3\include -c helloworld.c -o build\temp.win-amd64-3.7\Release\helloworld.o
In file included from C:\Users\Julien\anaconda3\include/Python.h:87:0,
from helloworld.c:4:
C:\Users\Julien\anaconda3\include/pytime.h:123:59: warning: 'struct timeval' declared inside parameter list
C:\Users\Julien\anaconda3\include/pytime.h:123:59: warning: its scope is only this definition or declaration, which is probably not what you want
C:\Users\Julien\anaconda3\include/pytime.h:131:5: warning: 'struct timeval' declared inside parameter list
C:\Users\Julien\anaconda3\include/pytime.h:136:5: warning: 'struct timeval' declared inside parameter list
helloworld.c:201:41: warning: division by zero
helloworld.c:201:12: error: enumerator value for '__pyx_check_sizeof_voidp' is not an integer constant
error: command 'C:\\MinGW\\bin\\gcc.exe' failed with exit status 1
I followed tutorials to install mingw (it works for coding in C in codeblocks so I should have installed it properly) and I verified that Cython was correctly installed in Python libraries. What did I do wrong ??
Ok so the problem was effectively in the compilers.
the problem was because my mingw compiler was not correct : i suggest following
these instructions which you will find at https://wiki.python.org/moin/WindowsCompilers.
/!\ do not forget to install setuptools on your python environment (using the command given works for me)
this should at least allow you to make the basic tutorial for cython

Openmpi on Fedora 21

I am trying to compile some code in Fedora 21 using 'mpif90'.
First I install openmpi with 'yum':
[root#localhost Inversion]# yum install openmpi
Loaded plugins: langpacks
Package openmpi-1.8.3-2.fc21.x86_64 already installed and latest version
Nothing to do
But then when I compile using 'make' it doesn't work:
[root#localhost Inversion]# make all
mpif90 -O3 -c src/dispersion.f90
make: mpif90: Command not found
Makefile:18: recipe for target 'obj' failed
make: *** [obj] Error 127
As you can see I've downloaded openmpi package but it wont compile.
You cannot compile because you haven't loaded the necessary module.
You need to load the environmental module, this is how Fedora is handling openmpi when you install it using:
dnf install openmpi
(in Fedora 25)
Just follow the following steps:
In your terminal, do:
module avail
You should see an output something like this:
--------------------- /usr/share/Modules/modulefiles ----------------------
dot module-git module-info modules null use.own
---------------------------- /etc/modulefiles -----------------------------
mpi/openmpi-x86_64
Notice there is the mpi/openmpi-x86_64 module available for you to 'load'.
In your terminal, you just do:
module load mpi/openmpi-x86_64
Now you have access to all the mpi compilers like mpif90 and mpic++ etc. You can see that the compiler binaries are stored in: /usr/lib64/openmpi/bin:
$ which mpif90
and you see the output is:
/usr/lib64/openmpi/bin/mpif90
dnf whatprovides "*/mpif90"
tells you what package provides this binary. In Fedora, you can get it from openmpi-devel or mpich packages. So running
yum install openmpi-devel
should do the job for you.

Unable to compile mysql-proxy into an rpm

I am trying to compile and package mysql-proxy-0.8.4.tar.gz into rpm. I followed the instructions to build
[root#localhost mysql-proxy]# rpmbuild -ta --clean mysql-proxy-0.8.4.tar.gz
I get this error
checking which pkg-config file to use to find Lua... configure: error: MySQL Proxy can't be built using --without-lua, lua 5.1 is required
error: Bad exit status from /var/tmp/rpm-tmp.r6iTWn (%build)
RPM build errors:
Bad exit status from /var/tmp/rpm-tmp.r6iTWn (%build)
I checked my build machine and I have all the build dependencies, I can see that pkg-config listing lua libraries
[root#localhost mysql-proxy]# pkg-config --list-all | less
lua Lua - An Extensible Extension Language
Could someone let me know what am I missing?
That error is telling you that you might need to pass --with-lua to rpmbuild when you build the package.
You also, as #hjpotter92 was getting at, likely need to install the lua-devel package to go along with the lua package.
Try installing that first and then re-running your command and see if the error changes.

Problem compiling C program that interacts with MySql db

I have a problem compiling a program written in C which should interact with a MySql db.
I'm using Ubuntu 11.04.
I type this:
gcc -o magazzino main_magazzino.c -L/usr/lib/mysql -lmysqlclient
and I get this error:
main_magazzino.c:4:25: fatal error: mysql/mysql.h: No such file or directory
compilation terminated.
-L and -l are only relevant in the linking phase, and the program already fails to compile.
Check that /usr/include/mysql/mysql.h exists. If you have installed the header files somewhere else (say /opt/mysql/include), add that location with -I/opt/mysql/include.
you need to install mysql c connector.
you can download from http://dev.mysql.com/downloads/connector/c/
after downloading you can specify header include path using -I option.