Skip to main content
Filter by
Sorted by
Tagged with
0 votes
0 answers
33 views

Right way to avoid multiple definition error when building Python C++ extension with MSVC BuildTools

A python C++ extension has the following structure: /myextension |_____basecode | |__header.h | |__functions.cpp | |_____utilities | |______utilities.h | |...
subhacom's user avatar
  • 908
0 votes
0 answers
13 views

VS code is not able to activate the conda environment automatically all of a sudden. How to resolve this issue?

Do I need to enter anything in workspace settings (JSON)? Usually, it automatically activates the environment once you open the integrated terminal of VS Code. I tried deleting and generating the ...
Akhilesh's user avatar
1 vote
0 answers
40 views

How to wrap a PyDict in PyO3 with a constructor that takes a new parameter?

I am using PyO3 (v0.22.2) / Rust to write something a little similar to defaultdict, but with an integer default rather than a callback: >>> from my_package.pyo3_ext import PyDefaultDict >...
davidA's user avatar
  • 13.4k
0 votes
0 answers
19 views

Gecode Attribute Not Available In Phonenumbers Geocoder Library

I am working on PYCharm IDE application for getting address from latitude and longitude and I have also installed phonenumber and geocoder library to the project in PYCharm IDE but unfortunately ...
user2741987's user avatar
1 vote
0 answers
32 views

Python C++ extension DLL is not imported in python interpreter

I have written a Python extension in C/C++ to wrap my code for Python. I followed CPython documentation in the parts of C/C++ functions each module should provide For example, my module contains: /* ...
girl_coding's user avatar
2 votes
0 answers
38 views

Python C Extension When to Free Internal Free List?

Some Python objects - for example, instances of int, float and dict - use a free list to speed up allocations. The C API provides methods to clear such free lists. By hardcoding PyXXX_ClearFreeList ...
Suen's user avatar
  • 103
0 votes
0 answers
38 views

Python extension in VSCode cannot see virtual python

I working on a Django project. The problem I have is in the screenshot below: I used "python3 -m venv env" to setup the virtual environment. I also installed Django with the "env" ...
daisow's user avatar
  • 1
0 votes
0 answers
94 views

Python C Extension - Access to PyInterpreterState Internal Data Structure

I recently found that I could get the Python interpreter state by PyInterpreterState_Get() C-API. However, when I tried to access its members defined by struct _is in the extension code, during the ...
Natarich J's user avatar
0 votes
1 answer
40 views

How to properly deepcopy linked objects in C Extension

In Python, I have a pair of classes like class Internal: def __init__(self, ref): self.ref = ref class External: def __init__(self): self.storage = [1,2,3] self.int = ...
Askold Ilvento's user avatar
2 votes
1 answer
114 views

Understanding memory leak with C++ extension for python

I have been struggling to understand what I am doing wrong with the memory management of this this C++ function for a python module, but I don't have much experience in this regard. Every time I run ...
van's user avatar
  • 37
3 votes
0 answers
325 views

How do you tell setuptools to build an extension for --debug when using pyproject.toml / PEP 518

I have created a Python project with a C++ extension using pyproject.toml (PEP 518, PEP 517, PEP 621, PEP 660, etc.). I'm sure I could be doing some things better, but generally speaking it's working ...
Nick Williams's user avatar
0 votes
1 answer
230 views

No module named 'pybind11' when using poetry

Used pybind11 in the past without issue pulled in as a submodule and used via cmake. Now working on another project that uses poetry, and so wanted to make everything poetry-centric. Trying to build ...
learnvst's user avatar
  • 16k
2 votes
2 answers
4k views

"The Pylance server crashed 5 times in the last 3 minutes"? (circa v2023.10.40 of the Pylance VS Code extension)

Every time I launch VS code, the Pylance server crashes 5 times in in 3 minutes, or so the output terminal says. The server stops trying to relaunch and I lose out on a handful of features as a result....
ADH's user avatar
  • 21
0 votes
0 answers
125 views

cannot activate the 'ros' extension because it depends on an unknown 'ms-vscode.cpptools' extension. on code server

So I was trying to learn ROS2 iron on the Ubuntu Server. I installed the Ubuntu server on a Raspberry Pi 4 and I used my laptop to SSH into the Raspberry Pi 4. Next, I installed ROS2 iron on the ...
Navid Moghtaderi's user avatar
0 votes
0 answers
148 views

VSCode: "fatal error: Python.h: No such file or directory" even with python-dev installed

Using VSCode (which I'm quite new to) on Ubuntu 20.04, I wish to build a C-extension (actually C++ extension) to Python. I'm trying to build the following MWE: #include <numpy/arrayobject.h> int ...
EZLearner's user avatar
  • 1,774
0 votes
0 answers
142 views

How to compress and decompress stream binary data use python with lz4

I want to compress and decompress network data transmitted through Python. I couldn't find an LZ4 library for Python 2.7 that can be used to compress and decompress streaming data, so I tried to write ...
wenlin Hu's user avatar
0 votes
1 answer
806 views

Build python wheel with precompiled shared library

When building a wheel of a Python extension module, how can I tell setup() to use an existing/precompiled shared library? For awful horrible reasons, the SO/DLL has to be compiled by a build system ...
alexchandel's user avatar
1 vote
4 answers
25k views

How to fix this issue "ERROR: Failed building wheel for insightface"

note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for insightface Failed to build insightface ERROR: Could not build wheels for ...
kin's user avatar
  • 11
0 votes
1 answer
372 views

Undefined symbol at runtime. Import Python C++ extension

I have a python package (my_python_package), part of which is a C++ extension (my_ext) with a single function (my_ext_func). The extension depends on my C++ library (libmycpp) and my C++ library ...
Jerome D Walker's user avatar
0 votes
0 answers
47 views

How to type `PyObject* const*` in Cython

Let's take this as an example: reference The definition of the type _PyCFunctionFastWithKeywords is: PyObject *_PyCFunctionFastWithKeywords(PyObject *self, ...
Jim's user avatar
  • 709
1 vote
0 answers
15 views

Web Scraping using pythn Jupyter Notebook [duplicate]

I have been attempting web scraping, but I encountered an error that states, "We're sorry but default doesn't work properly without JavaScript enabled. Please enable it to continue." I have ...
shubh jain's user avatar
1 vote
1 answer
787 views

Python Wheel that includes shared library is built as pure-Python platform independent none-any

I wish to use some C and CUDA code in my Python package (which I then call using ctypes). Because of the CUDA, it doesn't seem to be easy to use the traditional approach of a setuptools Extension, so ...
user3708067's user avatar
0 votes
1 answer
214 views

Cython: Unable to cimport from `.pxd` file

I have a simple project directory and some simple files which failed to compile. Directory structure: cythonize: ROOT |___ cythonize |___ __init__.pxd |___ __init__.py |___ first.pxd |...
Jim's user avatar
  • 709
3 votes
1 answer
1k views

Building Python C module on Windows

I am trying to build a 'C' python extension on Windows, the core C code compiles absolutely fine, but I am unable to build the python module using setuptool as I am getting mandlebrot.c(36): fatal ...
Swatcat's user avatar
  • 53
-1 votes
1 answer
728 views

segmentation fault Segfault python extension in c++

This extension is used to search data in a linked list and return it as a nested tuple of lists.[(ele1,ele2,),...] However when the program runs for a period of time, segment fault will occur. I know ...
the  drugs don't work's user avatar
5 votes
5 answers
1k views

How to create python C++ extension with submodule that can be imported

I'm creating a C++ extension for python. It creates a module parent that contains a sub-module child. The child has one method hello(). It works fine if I call it as import parent parent.child.hello() ...
BlacKow's user avatar
  • 316
0 votes
1 answer
195 views

How to write a simple VTune wrapper script on Windows?

Question How do I write a wrapper script for VTune for Windows? The documentation provides a simple wrapper script example for bash: #!/bin/bash # Prefix script echo "Target process PID: $...
Samufi's user avatar
  • 2,630
0 votes
1 answer
1k views

How does attaching to a process work in VS Code debugger extensions?

I am trying to understand what happens / is supposed to happen when I attach to a process with a debugger in VS Code. I understand that I can create attach launch configurations in VS Code, and when I ...
Samufi's user avatar
  • 2,630
0 votes
0 answers
65 views

Get the (C) size of a (C) type in a Python extension

I'm writing a C extension for Python and need to pass the size of a C type to the compilation. So I'll want to do extra_compile_args = ['-DSIZEOF_MYTYPE=32'] in my setup.py. My question is: how can ...
jjg's user avatar
  • 983
1 vote
0 answers
483 views

How to install python extension "ms-python.python" in local linux server to debug the scrip in VScode

I ssh the server in VS code and when I install python extension in the VScode, I got "Error: unable to get local issuer certificate". May I know how can I install python extension in the ...
Susan's user avatar
  • 509
1 vote
1 answer
185 views

Get notification in a VS Code extension when the Python interpreter is changed

I am writing a VS Code extension that depends on the currently set Python interpreter. When I change the Python Interpreter via the VS Code UI, the extension needs to refresh and get the latest Python ...
Bernhard's user avatar
0 votes
1 answer
35 views

How does VSCode's Python Extension use the Paths you set?

I'm troubleshooting an issue with VSCode's Python extension trying to load the wrong version of Python. I'd like to know how this extension uses the Path variables you give it in its settings. For ...
Connor's user avatar
  • 967
1 vote
1 answer
143 views

How does VSCode's Python Extension handle a missing .env file?

I'm trying to troubleshoot an issue with VSCode's Python extension loading the wrong version of Python and I'd like to rule out incorrect environment variables being an issue. In the Python Extension'...
Connor's user avatar
  • 967
0 votes
0 answers
84 views

Nested extension module cannot be imported

I am trying to import an extension module contained inside a nested package. For the purposes of this example, it's the only element of the root module, but the real case has others. When I attempt to ...
Vagrant Nexus's user avatar
0 votes
1 answer
108 views

std::cout error when using METH_VARARGS or METH_VARARGS | METH_KEYWORDS

I have created a python extension with C++. Generally, it works fine, and I can use the extension from Python to call C++ functions. When I define a method using the METH_O or METH_NOARGS macros, ...
Guitar Man's user avatar
0 votes
1 answer
120 views

PyPy memory leak with custom C++ extension?

I am trying to write a C++ extension with support for CPython and PyPy. My extension involves creating some custom types that support the call interface. However, I appear to be getting memory leaks ...
Lalaland's user avatar
  • 137
17 votes
6 answers
21k views

VS Code: "The isort server crashed 5 times in the last 3 minutes..."

I may have messed up some environmental path variables. I was tinkering around VS Code while learning about Django and virtual environments, and changing the directory path of my Python install. While ...
Nikola da Vinci's user avatar
1 vote
1 answer
185 views

Kinesis WebRTC C SDK - Convert Frames to Images

I managed to wrap kvsWebRTCClientViewer in a python C extension and I also managed to expose frame data to python via callback function as bytes array but I don't understand how to convert these ...
Farooq Zaman's user avatar
0 votes
0 answers
66 views

Create pip-installable package with C extension pulled from Github

I have a python library that I'm trying to package into something pip-installable. It depends upon a C library (shoco). I'd like to avoid packaging the actual source code to shoco in my own package if ...
Mala's user avatar
  • 14.6k
3 votes
3 answers
23k views

Error while fetching extension. XHR failed [duplicate]

This is my first time installing and using VSCode, and when I try to install a python extension inside a VSCode application I get the error "Error While fetching extension. XHR failed" . How ...
DonnyDongoran's user avatar
1 vote
1 answer
752 views

How to modernize code that uses deprecated NumPy C API?

The following C or C++ code, intended for use in a Python extension module, defines a function f that returns a NumPy array. #include <Python.h> #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION ...
Joachim W's user avatar
  • 7,942
2 votes
0 answers
122 views

Viewing Data in Python Extensions GDB

Suppose I have a class: class RawMessage(NamedTuple): data: Dict timestamp: float ... The keys and values in this dictionary are probably all integers, but I don't want to state that with ...
awy's user avatar
  • 43
0 votes
0 answers
407 views

Visual studio Python extension mixed mode debugging on CMake project

I'm trying to create a C++ Python extension using pybind11 and CMake, and would like to take advantage of visual studio's mixed mode debugging (see) for developing the extension. I tried following the ...
osbt1's user avatar
  • 1
1 vote
1 answer
372 views

Programmatically obtain Python install paths in prefix, without distutils

As distutils is being removed from Python in the > 3.10 versions, and setuptools will not be added to the stdlib, I want to replace an existing setup.py recipe for building/installing a C++ library ...
andybuckley's user avatar
  • 1,144
1 vote
2 answers
611 views

Debugging Python Extensions written in C

I'm pretty familiar with writing C code and I'm comfortable in writing python code. I'm trying to learn how to write modules in C that can be called from Python-3.9.X on OSX 10.15.7. I've gotten a ...
irritable_phd_syndrome's user avatar
0 votes
0 answers
198 views

How to get the arguments for a Python c-extension function?

I'm working on a project that runs in a Python environment with numerous C extensions included that are used to interface with the software that the project runs under. Unfortunately, the ...
Maddy Guthridge's user avatar
1 vote
0 answers
82 views

Linker error despite symbols located in linked library

I am having difficulty importing a python extension module that depends on a separate shared library that I am building via a separate build system. When I attempt to import the module, I get an ...
professional_yet_not_trackable's user avatar
1 vote
0 answers
88 views

azure python extension fail on 'conflict' in deployment ARM

I am using template for azure web app . net deployment. I need python extension to deploy as well after MSbuild is deployed. This script works when resource group and app service plan is new, but it ...
moeen-ud-Din's user avatar
0 votes
1 answer
1k views

how does python package links to dll (.so) files

I am creating a python package based on this repo. The package has few cpp files which are compiled when I build the package using setup.py and running pip install . This generates _C.cpython-36m-...
Gaurav Srivastava's user avatar
1 vote
1 answer
1k views

How to release GIL after Py_Initialize?

I am trying to embed python in a GUI application, and so I have a the python interpreter initialized in the main thread of the application, and I may launch python scripts from another one. I read ...
arthropode's user avatar
  • 1,351

1
2 3 4 5
7