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

Bundling with specifying interpreter? #45

Open
CanaryWharf opened this issue Feb 2, 2023 · 2 comments
Open

Bundling with specifying interpreter? #45

CanaryWharf opened this issue Feb 2, 2023 · 2 comments

Comments

@CanaryWharf
Copy link

I'm trying to bundle into a specific folder, which I can do with

poetry bundle venv /path/to/folder

However, This folder is mounted and dismounted into various containers, with the actual location of the mount changing.

In this scenario, I would like the shebang at the top of the bin files to just be #!python , instead they are the full #!/path/to/folder/python. Leading to the following error

/some/script.sh: /mnt/bin/executable: /path/to/folder/python: bad interpreter: No such file or directory

Adding --python python does not seem to change this, it sets it to the python executable location that is present on the container that performs the bundle.

Is there a way around this?

@neersighted
Copy link
Member

Virtual environments are not portable -- to try and "fake" it as you want, you'll need to provide a stable #!/usr/bin/python3.Y and use the same 3.Y version in all your containers.

@CanaryWharf
Copy link
Author

CanaryWharf commented Feb 3, 2023

Yes, I've got that setup. The containers use the same versions as the mounted venv. The setup currently uses pip itself, and I'm trying to transition it all to using poetry.

The is that the plugin is using the new executable inside the bundle target and passing that to poetry, instead of using the executable that the command was called from, which poetry then uses to run the pip installs, which creates the shebangs pointing to the new python executable.

It would be nice to have a way to specify which python to use for installation, I assumed that's what --python did but I imagine that it simple uses that to create the new executable.

I've found a workaround here with the poetry export command with a few people having similar issues. It would be nice as an additional bundler to use, alongside the venv bundler.

If this sounds like within the scope of this plugin, I'm happy to work on a PR for this feature?

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