I've been trying to find a question like this for ages, couldn't find this so I'll ask it.
I have tried pip installing and PYTHONPATH but it hasn't worked
import webapp2
but every time it gives me:
Unable to import 'webapp2' pylint(import-error)
anybody else had this problem? have you found a solution?
webapp2 is part of the google-cloud-sdk library and is only for Python 2.7. Check if you have it installed.
If you're on a Mac, check
/Users/<user>/google-cloud-sdk/platform/google_appengine/lib/
If you're on a Windows machine, check
C:\Users\<user>\AppData\Local\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\lib\
Related
this is my first post and I am very new to coding so please let me know if you need more information. I have been running some AI to generate artwork and it has been working but when I reloaded it the script won't work and it is now saying "No module named 'transformers'". Can anyone help me out? It was when I upgraded to google colab pro that I started to encounter issues although I am not sure why that would make a difference
ModuleNotFoundError
Probably it is because you have not installed in your (new, since you've upgraded to colabs pro) session the library transformers. Try to run as first cell the following: !pip install transformers (the "!" at the beginning of the instruction is needed to go into "terminal mode" ). This will download the transformers package into the session's environment.
assuming you are referring to the module here: https://pypi.org/project/transformers/
you need to install transformers with pip
after you install transformers, make sure to import it , and import the Module youre gonna use
I am using qpython for programming python on android.In my script I am importing requests module and so I have tp install requests module from pip.When I run pip install requests command I get the following error:
error build/lib.linux-armv71-2.7/requests/auth.py:operation not permitted qpython
I get this error twice while installing requests and so I am not being able to run my script.
You might need to manually download requests, extract and move it to your Lib/site-packages/Requests/ folder, from there python should be able to import from it. I don't see that package available for qpython, it might work out of the box or it might still need to be ported.
After installing qpython on my current device I was able to open the app, go to My QPython ->Scripts and use pip_console.py to try to install it but as you said it fails. I'm going to test later my above recommendation. My install directory is /sdcard/com.hipipal.qpyplus/lib/python2.7/site-packages/ and that is where I'm going to drop the requests library.
To run pip on qpython just use the steps below:
import pip
pip.main(['install', 'bs4'])
The above is to install bs4 for BeautifulSoup. Worked for me :)
The newest version ( 1.3.1 ) from google play has fixed this issue.
This solution did not work or me...but I did resolve it by downloading the new beta v2.1 from
https://github.com/qpython-android/qpython/releases
Google play did not give me the latest version (I had 1.xx)
I was able to use QPYPY to install requests and it automatically installed the required library urllib3.
Yesterday I updated my google cloud SDK along with the python runtime. Now an app I was able to run locally in the SDK complains about the PIL / Python Imaging Library not being available:
bash-3.2$ dev_appserver.py . --host=0.0.0.0
INFO 2014-05-31 17:07:52,313 devappserver2.py:706] Skipping SDK update check.
WARNING 2014-05-31 17:07:52,319 api_server.py:378] Could not initialize images API; you are likely missing the Python "PIL" module.
Not true, however. I DO have PIL installed and it works swimmingly with jpegs, which is what I expect:
bash-3.2$ ipython
Python 2.7.5 (default, Mar 9 2014, 22:15:05)
In [1]: from PIL import Image
In [2]: my_image = Image.open('motorcycle.jpg')
In [3]: my_image.show()
Works just fine. FWIW, I declare my app.yaml use of PIL as such:
libraries:
...
- name: webapp2
version: latest
- name: PIL
version: latest
I've tested it, so it's not a false negative. When I try to use the GAE images module, it's blows up with the same problem. It works just fine in production. Clearly Python has what it needs to work. Why is App Engine unable to make use of it?
The problem I was having had to do with having a clash between a brew version of python installed versus the system version. Fixing my shell's path to point to the correct python installation sorted this problem, too. For GAE users: I also had to make sure my app engine SDK path was correct as well.
If you're having problems installing or getting PIL to work, understand that there are many dependencies involved with PIL, including what file format codecs you will want to support (there is a PNG library, a TIFF library and a JPEG library), and whether you want to draw text in your images and need truetype font support via the freetype library. Know that you may have PIL installed and no codec support libraries and effectively PIL won't be usable.
A good starting place for this issue might be this other question:
How to deal with Linux/Python dependencies?
No module named Crypto.Cipher
when I try to import
from Crypto.Cipher import AES
My folder structure looks like this:
test/
test/main.py
test/pycrypto-2.3
I ran the build and install inside of the pycrypto folder but I keep getting the error, any ideas?
It does not work with the usual easy_install, or running setup.py, depending on your Mac OS X version. This is due to how Google App Engine only allows for libraries loaded from certain directories. See here for more discussion: http://code.google.com/p/googleappengine/issues/detail?id=1627
You don't need to include pycrypto in your app; you need to install it the standard way for a Python library. If you've done that, the most likely reason it's not working is because you installed it (Eg, using easy_install) for a different version or installation of Python than the one that you're running the dev_appserver with. Macs are particularly notorious for this. Make sure you installed it in the same version of Python as the one the dev_appserver is running.
Please set PYTHONHOME if you have installed pycrypto in a user-defined directory. Also
/home/user# python -v
>>> from Crypto.Cipher import AES
will give you some idea what's the exact error.
I am trying to use AppEngine TaskQueue API, so I import it like this:
from google.appengine.api import taskqueue
The code works perfectly online. But when I try to run it locally, I get this error:
ImportError: cannot import name taskqueue
I checked the directory of AppEngine and I didn't find the file taskqueue.py which explains the error. Is there any reason why this file isn't included in the AppEngine SDK? And is there anyway to install it locally? I wouldn't trust just copying the file to the folder, because I am sure it depends on tens of other files.
Download and install the current SDK. You're using an older version.
OK, I found the solution for this myself. I just downloaded the latest AppEngine SDK (version 1.4) and it has the taskqueue.