Questions tagged [cythonize]

Use this tag for questions about the compilation of python extension modules based on cython using "cythonize". Use the more generic [cython] tag if the question isn't about the actual compilation process.

The cythonize function can be imported from Cython.Build and is used to compile extensions for python. It is responsible for compiling the .pyx (cython files) to .c files.

The cython "Compilation" documentation contains several examples how to include cythonize in the build process for python modules.

342 questions
-1
votes
1 answer

Is there a way to compile a ".pyx" into a ".pyc" with Cython instead of ".pyd"?

I was wondering : is there a way to compile a ".pyx" file (with Cython code) into a ".pyc" (thats works with windows and linux) : instead of : ".pyd" for Window or ".so" for Linux ? I use the function cythonize. Indeed, the ".pyc" works with both…
AdrienC
  • 59
  • 3
-1
votes
1 answer

Can't import a cynthonized file after successful compilation (Python3)

I want to speed up my python code so i tried to translate it in c thanks to cython. I followed the basics tutorials and other youtube videos and i finally could create a functions_cython.c file. But somehow i just can't import it. I tried to import…
-1
votes
1 answer

Cython fast list / numpy accessing

I have a Python function I'm trying to speed up, which just takes a line of tshark output, eg: '1\t0.000000000\tTCP\t100.0.1.190,111.0.0.2\t35291\t55321\t\t\t56\t20\t··········S·\t36\n' and assigns the data to variables like so: arr =…
Frankfurters
  • 108
  • 8
-1
votes
1 answer

ImportError: Cannot import Cython module

I have a class named neuron in Cython syntax which works perfectly fine with Jupyter inline using magic (%%cython): cdef class neuron: pass and I am trying to cythonize this so that I can import it on a cluster and run larger scale experiments…
Ulgen
  • 93
  • 1
  • 8
-1
votes
1 answer

TypeError: an integer is required when using Cython

I am working with Cython to speed up some python code and I am running into the following error: Traceback (most recent call last): File "d:\ReinforcementLearning\BaseLines\A\Cythonver\testing.py", line 1, in import RL_Cython File…
sword134
  • 91
  • 1
  • 11
-1
votes
1 answer

Cython problem, can't use cdef on class variables

Im trying to convert a python class to C for time-complexity improvment using Cython. My most used variables are the class varibales defined in the init method and therefore I would like to define them as cdef double. I have tried everything I can…
JakobVinkas
  • 1,003
  • 7
  • 23
-1
votes
1 answer

How to compile / obfuscate a .kv (kivy) file for a raspberry pi

I've been searching for a while now and I can't seem to find any help on this one... My scenario: I got a python/kivy project and I already got my python-files compiled using setup and cythozine(). My problem: I somehow have to compile, or at…
LanoChaos
  • 1
  • 3
-1
votes
1 answer

ImportError: File.so undefined symbol: PyInterpreterState_GetID

When Cythonizing a file and running it via import, an error is presented that claims there is a problem getting the python interpreter state. Removing multiprocessing code like multiprocessing.start(); switching to Cython's own prange(). Googling…
Promus Aster
  • 23
  • 1
  • 5
-1
votes
1 answer

Cython set variable to named constant

I'm chasing my tail with what I suspect is a simple problem, but I can't seem to find any explanation for the observed behavior. Assume I have a constant in a C header file defined by: #define FOOBAR 128 typedef uint32_t mytype_t; I convert this in…
ralph
  • 141
  • 7
-2
votes
1 answer

Automatically converting .py file to .pyx using python type hints

Recently I had to convert a module written in pure python to pyx in in order to compile with cython. The procedure for converting from py to pyx was very straight forward since the all the variables and functions were type hinted. So it was a just a…
Samm Flynn
  • 314
  • 2
  • 13
-2
votes
1 answer

Why is the python code in the zip package after py2app is packaged?

Who is familiar with py2app, how can the python code packaged by py2app not be placed in a tarball. And can be converted to so file
王可乾
  • 1
  • 1
-2
votes
1 answer

Cython call optimization

I've got a Python function I try to export to Cython. I have tested two implementations but I don't understand why the second one is slower than the first one. Furthermore, I am looking for ways to improve speed a little more but I have no clue how…
GuillaumeA
  • 3,493
  • 4
  • 35
  • 69
1 2 3
22
23