cython Questions

2

Solved

I need to sort uint64 arrays of length 1e8-1e9, which is one of the performance bottlenecks in my current project. I have just recently updated numpy v2.0 version, in which the sorting algorithm is...

3

Solved

I am currently trying to deploy a project using openmp. I have the flag '-fopenmp' on Travis. How could I fix that ? In local I just brew install libopenmp which solved the issue. But not on Trav...
Dorsal asked 31/1, 2020 at 13:48

1

Overview There are a few questions similar to this one but they are all slightly different. To be clear, if values is an array of integers, I want to find perm such that sorted_values (values sort...
Antilles asked 15/2, 2018 at 9:42

10

Solved

I'm trying do from Cython.Build import cythonize and I get the message ImportError: No module named 'Cython', but I installed the Cython with the comand pip install Cython. What's wrong? Python 3.5...
Vendetta asked 15/5, 2017 at 14:51

4

Operating System: macOS Monterey 12.6 Chip: Apple M1 Python version: 3.11.1 I try: pip3 install gensim The install process starts well but fatally fails towards the end while running 'clang'. The ...
Metopic asked 2/1, 2023 at 6:55

4

Solved

I'm building a standalone executable using Cython on Linux. I have the following code: import psycopg2 as pg conn = pg.connect('dbname=**** user=**** password=****') cur = conn.cursor() cur.exec...
Newsy asked 21/3, 2014 at 18:46

2

I'm wrapping a C++ class with Python, and I cannot compile any C++11 features with the Cython module. Everything compiles okay when compiling the C++ alone. But when I run this setup.py below: se...
Agnusago asked 4/12, 2014 at 22:25

10

Solved

I am building a django-react site and suddenly my docker-compose no longer builds despite any changes to requirements or image versions. My requirements.txt looks as follows: Django>=3.2.4,<4...
Biotechnology asked 17/7, 2023 at 21:57

2

Solved

I am struggling to correctly parallelise a function using Cython. Basically, the problem is to bin some data. The actual code is a bit long, but in the end it does something like this: def bin_var(...

4

Solved

I have been using Cython to compile my Python files into C files and then use MinGW to create an executable from the C file. Cython works fine, I can type cython test.pyx into the command line and ...
Waistband asked 8/1, 2016 at 2:46

4

Solved

I am trying to create an apk file from bulldozer in Linux, but every time I receive this error that cython is not found. Although I tried installing it, I found the whole internet but didn't get th...
Brenza asked 6/4, 2021 at 17:40

1

Solved

$ python -m pip install tables stops with Error: compiling Cython file Environment (I am within a virtual environment, created with pyenv. ) Only few packages installed atm Package Version -----...
Exemplary asked 27/7, 2023 at 14:52

1

My problem: I am trying to create a python package to upload it to PyPI. However, when I run python -m build inside the project directory (example_package), then I get the following output and err...
Lamothe asked 18/9, 2022 at 22:59

4

I'm trying to build scipy and I get a RuntimeError: $sudo python setup.py build Processing scipy/cluster/_vq_rewrite.pyx Traceback (most recent call last): File "tools/cythonize.py", line 172, in...
Age asked 2/3, 2013 at 13:43

4

Solved

I would like to do cdef int mom2calc[3] mom2calc[0] = 1 mom2calc[1] = 2 mom2calc[2] = 3 in a more compact way. Something similar to cdef int mom2calc[3] = [1, 2, 3] which is an invalid Cython...
Plod asked 22/9, 2014 at 13:9

4

Solved

Since I found memory-views handy and fast, I try to avoid creating NumPy arrays in cython and work with the views of the given arrays. However, sometimes it cannot be avoided, not to alter an exist...
Sweetsop asked 8/1, 2014 at 20:19

2

I have a simple loop that just sums the second row of a numpy array. In numba I need only do: from numba import njit @njit('float64(float64[:, ::1])', fastmath=True) def fast_sum_nb(array_2d): s ...
Poser asked 5/6, 2023 at 14:5

3

Solved

I convert my python code to c by cython and after that compile .c file and use .so in my project. My problem: I use __file__ in my python code and in while compile by gcc, it doesn't get error. bu...
Jed asked 7/10, 2013 at 12:39

6

Solved

In order to install cython ( for python 2.7 , windows 8.1 ), made the download in .zip format, extracted the whole file and run the setup.py . Thus, python shell shows this : Unable to find pgen, n...
Canyon asked 30/1, 2016 at 0:3

7

Solved

I have a function that reads a file byte by byte and converts it to a floating point array. It also returns the number of elements in said array. Now I want to reshape the array into a 2D array wit...
Demagogic asked 31/8, 2016 at 11:20

1

How can I create .pyi files from cython source code (.pyx)?
Polygraph asked 29/9, 2019 at 12:48

2

Solved

I have an existing python project that is using mostly setup.py to build the project. The project has 2 x Cython extension modules configured in setup.py. Initially I did pip install -e . for devel...
Dupin asked 21/9, 2022 at 12:27

2

Solved

Why is np.dot so much faster than np.sum? Following this answer we know that np.sum is slow and has faster alternatives. For example: In [20]: A = np.random.rand(1000) In [21]: B = np.random.rand(...
Lottielotto asked 24/2, 2023 at 11:48

6

Solved

I have a bunch of functions that I've written in C and I'd like some code I've written in Python to be able to access those functions. I've read several questions on here that deal with a similar...
Dulcedulcea asked 20/5, 2013 at 10:11

4

Solved

I am converting a Cython memoryview to a numpy array (to be able to use it in pure Python code): from libc.stdlib cimport realloc cimport numpy as np DTYPE = np.float64 ctypedef np.float64_t DTYP...
Hamrah asked 11/9, 2014 at 13:43

© 2022 - 2024 — McMap. All rights reserved.