33 questions
1
vote
1
answer
75
views
How to pass kwargs into Python function using PythonKit (Swift)
I am trying to pass keyword arguments into a Python function using PythonKit. So far, I have just passed strings, but this is stumping me. I do not know how PythonKit processes these dictionary inputs....
1
vote
0
answers
166
views
PythonKit integration with Swift - Crashing on release due to module import
I have a project that is using Swift (for interface) and Python (for function) for a Mac application.
I added PythonKit as a dependency and after:
removing "App Sandbox" from "Signing &...
0
votes
1
answer
177
views
Time series forecast ARIMA in iOS
I've a time series with few entries (not enough to ML) and I need to forecast some (more than one) future entries in an iOS app. I tested in Python with statsmodels ARIMA model and works fine but I ...
-1
votes
1
answer
354
views
Swift PythonKit with error for no module found [closed]
I'm trying to run some python code from Xcode but wasn't sure why it can't find the module. All the tutorial I found only shows importing the simple .py file that contains function only no import on ...
1
vote
2
answers
713
views
XCTest Test runner never began executing tests after launching
I am doing a simple XCTest setup using Vapor (XCTVapor) and a Python Test as app dependencies, but it never executes my tests.
,
After 5 minutes it terminates saying, 'Test runner never began ...
0
votes
0
answers
169
views
Calling Python code in Swift Callback from Python called from Swift
Pardon the confusing title but I am doing something truly cursed.
I have a large project written in Python that I want to write a GUI in Swift for. I'm able to use PythonKit to call my Python code ...
2
votes
0
answers
239
views
Importation of pdfminer/tabula in an iOS app
I am working on the development of an iOS application and I am encountering difficulties when importing pdfplumber. I have integrated Python into my application. Everything is working fine and I can ...
0
votes
1
answer
79
views
Swift iOS Ambiguous use of '==' when comparing two PythonObject in PythonKit
Im currently using the PythonKit SPM Package to interact with Python, I'm doing this due to a Algorithm that was written in Python is required by my iOS App to work correctly.
Base on the PythonKit ...
0
votes
0
answers
206
views
How can I link PythonKit Library to my Xcode project?
I added the PythonKit github link to my Xcode project. In my version of Xcode (14.3). I can't see library validation like in a lot of the forums. I get this error:
Python library not found. Set the ...
1
vote
0
answers
2k
views
Add external python packages to iOS app (Swift, PythonKit)
I have an iOS application in Swift.
I was following this video and this usage guide to install Python inside my iOS app:
https://www.youtube.com/watch?v=gznPQpZH1Yc&ab_channel=...
1
vote
0
answers
80
views
Using ffmpeng in swift code using PythonKit
I have a python script that uses ffmpeng. I installed it using brew install ffmpeg. If I run the python script on python IDE it runs perfectly.
But I wanted to run this python script on my macOS app, ...
0
votes
0
answers
644
views
How can I use XlsxWriter or other external libraries with PythonKit?
I've been trying to use my XlsxWriter based python script in my swift app with PythonKit.
At first I tried installing XlsxWriter by running:
pip3 install XlsxWriter
It installed with no errors and the ...
1
vote
1
answer
232
views
Py_Initialize undefined error in Xcode while integrating Python in iOS project
I am trying to integrate Python in iOS app.
Here is the contentview file
import SwiftUI
import Python
import PythonKit
struct ContentView: View {
@State private var showingSheet = false
...
0
votes
1
answer
418
views
Calling a python Command-line tool with arguments, with PythonKit using Swift
I have been experimenting a bit with PythonKit and have some simple examples working. However I would now like to call a python script that takes some command line arguments and I can’t seem to get it ...
2
votes
1
answer
900
views
PythonKit can't find PYTHON_LIBRARY for Python3
I'm using PythonKit in my Swift project for MacOS. At the moment I'm using Python 2.7 but from MacOs 12.3 it isn't no more supported so I'm trying to migrate to Python 3 but it doesn't work.
func ...
0
votes
0
answers
286
views
Using PythonKit in multi-threaded app crashes app
For several reasons it is required to call the python functions from parallel threads, currently PythonKit library is being used for that. While one python module is running and if I try to execute ...
2
votes
0
answers
70
views
How do you connecting a python module to a Swift file in a different directory?
I've been trying to learn how to build Swift programs. For my first Swift program, I decided to build a program where I could log my hours for work. In Swift, I've already made a user interface, but I ...
2
votes
1
answer
455
views
Xcode 13 won't stay paused at breakpoint
I'm on Xcode 13 GM (13A233) and I'm noticing that it won't stay paused when it hits a breakpoint. It stops, but about a minute later it just resumes. Is there a new default setting that might cause ...
0
votes
0
answers
709
views
PythonKit/PythonLibrary.swift:46: Fatal error: Python library not found. Set the PYTHON_LIBRARY environment variable with the path to a Python library
Ok I'm fairly new to swift and am trying to create an app with a button that uses python. I have seem code looking like
//
// ContentView.swift
// Shared
//
// Created by Ulto4 on 10/17/21.
//
...
2
votes
2
answers
1k
views
Python library not found. Set the PYTHON_LIBRARY environment variable with the path to a Python library
I have built a macOS application that using the python language. With the help of PythonKit, I'm using Python in swift.
When I'm trying to use python then it getting an exception.
Python library not ...
1
vote
1
answer
682
views
Executing python from swift via bash: "can't open file...[Errno 1] Operation not permitted"
I am learning how to make apps for mac, and I am starting with an app to manage my many discord bots. Essentially, the goal is to have many switches to turn bots on and off, which requires executing ...
2
votes
1
answer
731
views
PythonKit for OSX Swift project suddenly not finding modules
I built a MacOS app using PythonKit to run some scripts and return the data. I had it running with no issues the other day but now it crashes when trying to load the script file. I've verfied the path ...
2
votes
1
answer
832
views
XCode/Swift and Python files - Want to embed a Python.py file in an XCode project
I want to create a Swift app that calls some embedded Python.py files using PythonKit.
In the docs and a sample file it says that I should use
let sys = Python.import("sys")
sys.path.append(&...
1
vote
1
answer
219
views
swift - pythonKit crashes on release version
I'm trying to use pythonKit in order to run a Pyhton code from swift.
This code works fine:
let sys = Python.import("sys")
sys.path.append("Users/fusic/Desktop/PyrhonTest/...
2
votes
0
answers
300
views
PythonKit Crashing Swift Project
I'm building an ios app using Xcode (11.6) and Swift (5.1.3). The backend of my app relies on a Python library so I'm integrating a python script into my project using the PythonKit library (I'll ...
1
vote
1
answer
558
views
Python-Swift interop (PythonKit) : Change Default Stdin Encoding
I've imported a custom Python package into Swift using PythonKit, within a Swift Package (SPM) using XCode. The Python code at various points performs f = open("somefile","r"), and ...
1
vote
2
answers
3k
views
Set the PYTHON_LIBRARY environment variable with the path to a Python library
I am developing an iOS single view app in Xcode 11.4.1
I added the pythonkit framework in File>Swift packages>Add package dependancy and added the git repo: https://github.com/pvieito/PythonKit.git
...
3
votes
1
answer
4k
views
Using Python modules in Swift and Pythonkit
I was looking to get some help or clarification of the limitations of using PythonKit in Swift. Well I say PythonKit, I actually installed the Tensorflow toolchain in Xcode as I couldn't get Pythonkit ...
6
votes
3
answers
6k
views
PythonKit error "Python library not found. Set the PYTHON_LIBRARY environment variable with the path to a Python library"
I'm using PythonKit with XCode to call spaCy API from swift code. Installed PythonKit from Home-brew, imported it in my project and it built well; however, at runtime I got the error:
Python library ...
3
votes
0
answers
281
views
Utilizing python code within swift using 3rd party software
so I'm pretty new to both swift and stack, but I have a problem with implimenting Pythonkit. But basically to provide a short summary, the kit basically allows you to be able to utilize python inside ...
5
votes
1
answer
717
views
PythonKit crashes on start due to dlopen returning nil
I'm trying to use some Python Code in my Swift project with PythonKit. In order to do that, I've downloaded the new Xcode 11 to add PythonKit as Swift Package.
After adding PythonKit with Swift ...
9
votes
4
answers
8k
views
I can't import Python modules in Xcode 11 using PythonKit
I am now using Swift Package Manager.
Using that, I imported PythonKit into my Swift project.
I can't import the Python modules using the PythonKit now.
It asks me to set the PYTHON_LIBRARY path ...
1
vote
0
answers
827
views
Swift call Python with PythonKit
I want to call Python in Swift so I download a PythonKit and build it, but got the following error message. If I add the PythonKit dependency, it shows "Segmentation fault 11". Does anyone know how to ...