-
Notifications
You must be signed in to change notification settings - Fork 3
-
Notifications
You must be signed in to change notification settings - Fork 3
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
Error when trying to deploy on heroku : no module named requests #1
Comments
Thanks for reporting all of that. So you're using it as a library in another package and you're having this issue? I'm not python expert but have done several apps this way, with libraries I've created like this, though not deployed them to heroku so that's something to consider here. I've typically deployed them as docker images. Not saying you should have to deploy it as docker, I'll investigate what's going on here and learn from it. |
I'm using lnpay-py as a library in my python app's server (using Flask framework). Thanks, keep me posted please! |
What if the error is in this line? Line 4 in 757f4ba
Maybe a package shouldn't depend on itself at build time? I'm not sure. |
Yeah that's interesting, I can definitely replace that and see what happens, did that out of habit but I don't think I'm using it elsewhere anyways. I'll try to set up an example heroku project importing this library and play around with it over the next few days. |
this is still the case. but its a pain when deploying to different platforms |
Hello,
I got an
error : no module named requests
, during the installation oflnpay-py
when trying to deploy an app on Heroku.The
requests
module is in myrequirements.txt
beforelnpay-py
.I contacted Heroku support, and here is what they told me :
"Hi Gustave,
Sorry about that! I completely missed it in your first comment, thank you for clarifying.
Our Python language owner was kind enough to take a look at your situation and I've included the feedback he provided below. Ultimately most likely issue here is that the
lnpay-py
package is broken.Python packages can be shipped as either wheels (newer; preferred) or sdists (source distributions). For sdists, when the package is installed, setuptools invokes
setup.py
as part of the install.Looking at the package it seems
setup.py
imports a file that in turn imports requests, meaning that the package actually has not only a run time dependency on requests, but also a build time dependency.Adding
requests
torequirements.txt
won't help, since during the very first pip install, requests won't yet have been installed whenlnpay-py
's setup.py is being invoked. The Python ecosystem is partway through devising a way to handle build time dependencies (https://www.python.org/dev/peps/pep-0518/) though in this case the package is just accidentally importing it and doesn't necessarily need it.To ultimately resolve the issue you'll need to reach out to the the author of the package to see if they can fix the import issue. You can specifically mention that the package maintainer should rework the
__version__
import such that it doesn't also importrequests
during pip install, since the current implementation will break installing into any clean environment, not just Heroku. In addition, the package maintainer should ideally also ship wheels, since they are the preferred package format (and would have wallpapered over this issue too):https://pythonwheels.com/Does all of that make sense? Please let me know if you have any questions or if I can assist any further!
Thanks,
Lucas"
I don't understand everything, but I hope you and others will! Don't hesitate to tell me if you want me to ask them more information.
The text was updated successfully, but these errors were encountered: