EndstoneMC / endstone

Endstone - High-level Plugin API for Bedrock Dedicated Servers (BDS), in both Python and C++.
http://endstone.dev/
Apache License 2.0
269 stars 26 forks source link

[bug] Endstone is unable to find Python executable when use endstone in venv #28

Closed killcerr closed 4 months ago

killcerr commented 4 months ago

Describe the bug Endstone is unable to find Python executable when use endstone in venv

To Reproduce Steps to reproduce the behavior: 1.install endstone in venv 2.add a plugin to bedrock_server/plugins

mkdir endstone
cd endstone
python -m venv .
.\Scripts\Activate.ps1
pip install endstone
endstone

Expected behavior A clear and concise description of what you expected to happen. Plugins shoule be loaded without any errors

Screenshots If applicable, add screenshots to help explain your problem. image

Details (please complete the following information):

Additional context https://github.com/EndstoneMC/endstone/blob/main/python/src/endstone/_internal/plugin_loader.py#L18

wu-vincent commented 4 months ago

Thanks for reporting this. I am not able to reproduce this on my machine. It seems endstone is not able to locate python.exe in your python installation.

Can you check if the file is there? I suggest you print out sys.prefix, sys.exec_prefix and sys.base_prefix and let me know if python.exe is missing in any of them.

killcerr commented 4 months ago

image It is this directory

killcerr commented 4 months ago

image All those paths are incorrect. The correct path is "C:\Users\killcerr\Desktop\endstone\Scripts"

wu-vincent commented 4 months ago

Okay, i see that's why. An easy solution would probably be using sys.base_prefix instead of sys.prefix.

Using the base python executable instead of the one in the virtual environment should be fine.

killcerr commented 4 months ago

image I got this error after I replace sys.prefix to sys.base_prefix.

Cryotap commented 4 months ago

image I got this error after I replace sys.prefix to sys.base_prefix.

0.4.10 doesn't have forms. That's for the next version.

wu-vincent commented 4 months ago

So it seems replacing with base_prefix does fix the issue. Thanks.

For the screenshot, it's not a bug. endstone.form is not released just yet. We aim to release the new version today or tomorrow.