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 subinterpreters are still not working, even with the command line option suggested #54

Open
14sirs opened this issue Sep 3, 2024 · 22 comments

Comments

@14sirs
Copy link

14sirs commented Sep 3, 2024

I have used the command line option --no-python-subinterpreters, as was suggested in order to get numpy to work, but it still ends up breaking the code.
Below shows the code I am running and what happens with and without importing numpy
Without Numpy:
image
With Numpy:
image

@Felk
Copy link
Owner

Felk commented Sep 10, 2024

hmm... I can't quite judge from the screenshot, but I suppose with numpy in the imports, dolphin just freezes, correct?

@14sirs
Copy link
Author

14sirs commented Sep 11, 2024

hmm... I can't quite judge from the screenshot, but I suppose with numpy in the imports, dolphin just freezes, correct?

hmm... I can't quite judge from the screenshot, but I suppose with numpy in the imports, dolphin just freezes, correct?

@Felk Kind of - it more refuses to run any code as soon as I import numpy - Dolphin itself will still run, but the code input just stops working when trying to import numpy. I've tried using sys to append my normal python running directory, but I still get the same error.

@14sirs
Copy link
Author

14sirs commented Sep 12, 2024

@Felk I have just thought that it might be because numpy isn't installed to dolphin, but my PC's version of python312. It has also come with stubs in the IDE I am using, and it errors when trying to find these stubs. Would there be a way to install it into the fork of dolphin itself, and if so how? (I've tried using pip to install it to the python312.zip folder, but this just enters the folder instead of installing it)

@Felk
Copy link
Owner

Felk commented Sep 12, 2024

Ahh, yes you're partially right. The problem is most likely that it just doesn't find numpy. If you open a console as described in the readme you should be able to confirm that it's just an ImportError.

As for how to fix that: you can't install numpy "into" dolphin, but you can extend the search path so the embedded dolphin also finds your system installed libraries:

Please see the snippet regarding "sys.path.append" here: #9 (comment)

@14sirs
Copy link
Author

14sirs commented Sep 13, 2024

@Felk I have tried doing the sys.path.append(site-packages), and that still yields an error in the dolphin log(as shown below). When I don't use sys, it just says numpy not found
Here is the error I get when using sys:
My error
I've tried the thing that it says to fix the issue, but that didn't work. The thing it is failing to import comes from my python-stubs when I import it in my IDE

@Felk
Copy link
Owner

Felk commented Sep 13, 2024

Yip, although the source code is updated for Python 3.12, the binary I shipped (preview 3) has python 3.11 embedded. Please either building felk/dolphin from source, or install python 3.11 locally. Then install numpy there and append the python 3.11 path. Hope that helps.

@Felk
Copy link
Owner

Felk commented Sep 13, 2024

Hold on, judging from the screenshot your copy of dolphin already has python 3.12. did you already build from source?

@14sirs
Copy link
Author

14sirs commented Sep 13, 2024

Hold on, judging from the screenshot your copy of dolphin already has python 3.12. did you already build from source?

Yes, I have built the solution files in the dolphin location after cloning it, as it said to do

@14sirs
Copy link
Author

14sirs commented Sep 13, 2024

For some reason the version that dolphin is installed with is a python312.zip. I did not add this myself. I have tried reinstalling and rebuilding dolphin too, but that still gives python312. (The "attempts" were where I was trying to add numpy to it)
image

@14sirs
Copy link
Author

14sirs commented Sep 13, 2024

I used git clone https://github.com/Felk/dolphin.git in command prompt in a folder where I wanted to install it to, and then built the solution file in dolphin\source using Visual Studio 2022
I have also tried reinstalling dolphin, and also tried it on a different device, but still get the same error @Felk

@14sirs
Copy link
Author

14sirs commented Sep 13, 2024

@Felk here is a video I created of how dolphin runs on my device, and what happens when I try to import numpy: https://youtu.be/gQKiAqVstgw
(The current device I am using is quite slow, but dolphin does continue running when the code errors.)

@Felk
Copy link
Owner

Felk commented Sep 13, 2024

Thanks for the patience. I'll have to take a deeper look sometime soon. I hope to catch some motivation next week, but no promises.
As for what steps you've done so far, it seems you did everything right and it's indeed an issue with the python Integration. Sorry for the problems

@14sirs
Copy link
Author

14sirs commented Sep 13, 2024

Thanks for the patience. I'll have to take a deeper look sometime soon. I hope to catch some motivation next week, but no promises. As for what steps you've done so far, it seems you did everything right and it's indeed an issue with the python Integration. Sorry for the problems

Ok, thank you. Do you have any temporary work-arounds that you know of?

@Felk
Copy link
Owner

Felk commented Sep 13, 2024

You can try Scripting-Preview 3 and python 3.11 instead. It used to work in the past, so you might have luck with older builds

@14sirs
Copy link
Author

14sirs commented Sep 16, 2024

You can try Scripting-Preview 3 and python 3.11 instead. It used to work in the past, so you might have luck with older builds

I've been looking for it, but can't seem to find Scripting-preview 3. Is it on the github somewhere, or does it come installed when I cloned the repo?

@Felk
Copy link
Owner

Felk commented Sep 16, 2024

It's in the GitHub repo under tags/releases. Here's a link for you: https://github.com/Felk/dolphin/releases good luck!

@14sirs
Copy link
Author

14sirs commented Sep 16, 2024

Ok, I'll try cloning that version, I'll let you know if it works for me

@14sirs
Copy link
Author

14sirs commented Sep 16, 2024

image
Slight issue when Building the scripting-preview3 - I am getting this error 704 times, each for a different part
image
Here was what I used to clone the scripting-preview3:
git clone https://github.com/Felk/dolphin.git --branch scripting-preview3

All of the errors seem to be from not being able to find this "pch.pch" file- there is a file called pch in the location it is trying, but it is a text file instead

@Felk
Copy link
Owner

Felk commented Sep 16, 2024

Please try the precompiled executable that's available for download before trying to build it yourself

@14sirs
Copy link
Author

14sirs commented Sep 16, 2024

I believe the version I got from here "https://github.com/Felk/dolphin/releases" (in the assets - "dolphin-scripting-preview3-x64.7z") is working with numpy - thank you for suggesting this! - this version is the one where dolphin hangs itself if you don't use --no-python-subinterpreters in command line

@14sirs
Copy link
Author

14sirs commented Sep 22, 2024

The older version also runs a lot quicker and smoother for some reason @Felk

@14sirs
Copy link
Author

14sirs commented Sep 23, 2024

I have also noticed that the older version hangs itself whenever you try to output/print too many lines too quickly

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

3 participants
@Felk @14sirs and others