Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python: command not found #106

Closed
bummoblizard opened this issue Dec 11, 2020 · 10 comments
Closed

python: command not found #106

bummoblizard opened this issue Dec 11, 2020 · 10 comments

Comments

@bummoblizard
Copy link

Hi holzschu :)
It's my first time trying out ios_system and everything seems to be working fine except python.

I linked python3_ios framework obtained from here to the project and transferred the python scripts to the library. For some reason ios_system is not recognising it and always show command not found. What am I missing?

@holzschu
Copy link
Owner

Hi,
python3_ios has been replaced by cpython: https://github.com/holzschu/cpython/
The latter is easier to update (for the maintainer), has Python 3.9, and provides all packages in a single compilation step.

@bummoblizard
Copy link
Author

bummoblizard commented Dec 11, 2020

Thanks for the reply! Though I do realise that and is using the xcframework here: https://github.com/holzschu/cpython/releases

There's no error message from Xcode what so ever. Is there anything I need to modify in CommandsDictionary.plist?

@bummoblizard
Copy link
Author

There is indeed. I copied the configuration from a-shell's commandDectionary.plist. Everything works great now!

Thanks for the reply! Though I do realise that and is using the xcframework here: https://github.com/holzschu/cpython/releases

There's no error message from Xcode what so ever. Is there anything I need to modify in CommandsDictionary.plist?

@holzschu
Copy link
Owner

Yes (I thought they were in, but apparently not). Also, the releases are outdated (I'm going to remove them). cpython generates 1000+ frameworks, so it is difficult to make them available as a github release. I suggest cloning the cpython repository as a submodule and compiling locally.

        <key>python3</key>
        <array>
                <string>python3_ios.framework/python3_ios</string>
                <string>Py_BytesMain</string>
                <string>3bBc:dEhiJm:OQ:RsStuUvVW:xX?</string>
                <string>file</string>
        </array>
        <key>python</key>
        <array>
                <string>python3_ios.framework/python3_ios</string>
                <string>Py_BytesMain</string>
                <string>3bBc:dEhiJm:OQ:RsStuUvVW:xX?</string>
                <string>file</string>
        </array>
        <key>pythonA</key>
        <array>
                <string>pythonA.framework/pythonA</string>
                <string>Py_BytesMain</string>
                <string>3bBc:dEhiJm:OQ:RsStuUvVW:xX?</string>
                <string>no</string>
        </array>

@bummoblizard
Copy link
Author

bummoblizard commented Dec 24, 2020

Hello, I have successfully compiled cpython and Python works as intended. However, I couldn't get the submodules, for example math, to work. It gives me an ImportError of image not found. Is there a proper way to embed these modules into my Xcode project?

@holzschu
Copy link
Owner

Hi, you need to add the frameworks requried by the modules you want (so python*-math.xcframework, for the math module) to the list of embedded frameworks (see "Build phases" -> "Embed Frameworks"). No need to link with them, but they must be embedded.

@bummoblizard
Copy link
Author

I tried that and it's still not working. Any idea?

@holzschu
Copy link
Owner

I have no idea. Here's what it looks like on my side:
image

I could maybe understand more with the actual error message.

@bummoblizard
Copy link
Author

bummoblizard commented Dec 26, 2020

Here's the screenshot and the error message from stderr:
image

image

@holzschu
Copy link
Owner

Hi,
OK, I see things better now. First, you don't need to link with the python frameworks, only with ios_system.framework (you do need to embed them, but apparently you did). Here's what it looks like for me:
image

Second, it's worth checking if the framework you embedded is actually complete. With ios_system, you can issue commands like ls $APPDIR/Frameworks/python3_ios-math.framework/ and check whether python3_ios-math is present.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants