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

packing pdm itself apears only to work with python 3.11, but neither 3.9 nor 3.10 on win10 #28

Closed
franzhaas opened this issue Jan 7, 2023 · 8 comments

Comments

@franzhaas
Copy link
Contributor

Hi,

I was succesfully able to pack pdm into a zipapp. This works nicely when I use python 3.11 to execute the zipapp.

I encountered 2 problems with the exe target.
1.) I needed to use the -i command to specify the interpreter "py" which is to my understanding the recommended way to find python on windows.
2.) on the target machine python 3.11 needs to be the default selected by "py".

The issue appears to only affect sync, not lock or search.

I would like to know if there is a possibility to specify the python version which should've used, like "py -3.11" when building an exe

This is the way I create the zipapp.:

git clone https://github.com/pdm-project/pdm.git cd pdm git checkout 2.3.4 pdm add pdm-packer pdm pack pdm pack --exe -i py.exe

Any hints?

Thanks in advance,
Franz

@franzhaas franzhaas changed the title packing pbm itself apears only to work with python 3.11, but neither 3.9 nor 3.10 on win10 packing pdm itself apears only to work with python 3.11, but neither 3.9 nor 3.10 on win10 Jan 7, 2023
@franzhaas
Copy link
Contributor Author

I just checked on linux, here the zip app runs with python3.10.

The error message on windows is.:

[PermissionError]: [WinError 32] The process cannot access the file because it is being used by another process:
'C:\Users\XXXXXXXXXX\AppData\Local\Temp\tmptgba8g_6_in_process.py'

@franzhaas
Copy link
Contributor Author

I think I am mistaken, by using set PY_PYTHON=3.10 / set PY_PYTHON=3.11 /set PY_PYTHON=3.9 it is possible to quickly change the default python interpreter chosen by "py", I can not reproduce the problem with python 3.9, only with 3.10. But this confuses me as the issue was first detected on a machine that was only equipped with python 3.9...

.... strange ....

@frostming
Copy link
Owner

You shouldn't use py.exe as the interpreter, change to a concrete one.

@franzhaas
Copy link
Contributor Author

Ok thanks, what do you mean by a "concrete" interpreter? "C:\Python310\python.exe" ?

Thanks,
Franz

@franzhaas
Copy link
Contributor Author

I note it here as it may help others. PDM uses by default virtualenv to create virtual environments, which is great.

However, it is not part of standard python. You can either install it into your environment or use venv instead. I am using venv...

@franzhaas
Copy link
Contributor Author

I think I know what happened...

It appears as if my Visual studio code installation loads the virtual environment which was created by pdm without me noticing. (the prompt is changed, but I failed to connect this to the loading of the virtual env)

a packed pdm works surprisingly well when it runs with the python from the virtual environment it created, but sync is too much, at least on windows...

@frostming I would still like to understand what you mean with a concrete interpreter. On windows I have multiple python interpreters installed, but they are all named "python.exe", and the way I differentiate between them is py -3.9. C:\Python39\python.exe does not work with user installs...

Thanks,
Franz

@frostming
Copy link
Owner

I think I know what happened...

It appears as if my Visual studio code installation loads the virtual environment which was created by pdm without me noticing. (the prompt is changed, but I failed to connect this to the loading of the virtual env)

a packed pdm works surprisingly well when it runs with the python from the virtual environment it created, but sync is too much, at least on windows...

@frostming I would still like to understand what you mean with a concrete interpreter. On windows I have multiple python interpreters installed, but they are all named "python.exe", and the way I differentiate between them is py -3.9. C:\Python39\python.exe does not work with user installs...

Thanks, Franz

The --py is to specify an executable(absolute path or not) that will appear in the shebang line, and when running the executable, the launcher can use the specified python to run it.

py.exe is just a python finder that will call the real python.exe behind the scene

@frostming frostming closed this as not planned Won't fix, can't repro, duplicate, stale Mar 29, 2023
@franzhaas
Copy link
Contributor Author

Just curiouls

@frostming
pdm-project/pdm#1782

This would be a very elegant solution for my problem... do I get that correctly?

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