-
Notifications
You must be signed in to change notification settings - Fork 69
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
Import error when running from a venv #238
Comments
I am new to peru and a long time user of pipx. peru looks really promising and pipx is brilliant. It would be super to get them working together. Reproducing the issueStart with a cut down version of the example in the README:
Make sure Install
Install peru using pipx:
Make sure git is installed Try to sync:
The error message is:
I reproduced this on Fedora 38, so Python 3.11. I believe this issue relates to the plugin architecture for peru. IIUC peru plugins are executable files; for this issue If I install peru with pipx; then pipx sets up a virtual environment and installs peru there. pipx adds a symbolic link to the peru command from that virtual envinronment to the PATH. Continuing the example above, the shebang line is:
However the shebang line for
This means that @oconnor663 is support for pipx something you would consider? Thank you for your work on peru! If anyone has suggestions for an implementation perhaps I can start on a PR. I'm not very familiar with the peru code; one option might be to switch to an entry point for WorkaroundAs a workaround is to manually change the shebang line for
This change will be lost on any subsequent upgrade. It also makes installation of peru with pipx more complex. Support for installation with pipx would be ideal. I appreciate that this is open source and maintainers and contributors are volunteers. Thank you for reading! |
The curl plugin for peru uses the following as its shebang line: #! /usr/bin/env python3 If the user is using pipx, then the system Python interpreter — `/usr/bin/env python3` — likely does not have the peru package installed. Before this change the curl plugin always uses a `get_version` function from the peru package and therefore will error if the Python interpreter does not have the peru package installed. After this change the curl plugin can succeed with only standard library modules available.
The curl plugin for peru uses the following as its shebang line: #! /usr/bin/env python3 If the user is using pipx, then the system Python interpreter — `/usr/bin/env python3` — likely does not have the peru package installed. Before this change the curl plugin always uses a `get_version` function from the peru package and therefore will error if the Python interpreter does not have the peru package installed. After this change the curl plugin can succeed with only standard library modules available.
Turns out there was a much easier fix than I expected; I've opened a pull request. To test the proposed fix using the steps to reproduce above; in place of using
Or if you prefer to run sync directly:
|
I used
pipx
to installperu
in a venv.peru
runs thegit module
properly but thecurl module
fails. Specifically theimport peru.main
at line 13 inperu/resources/plugins/curl/curl_plugin.py
failsTo test, I installed
peru
usingpip
but not inside a venv and it works fine so its either something weird thatpipx
is doing, or the venv in generalThe text was updated successfully, but these errors were encountered: