Why does qpython say "No module named sl4a"? - system

Install QPython from Google Play store
Open QPython, slide right and click "Console"
Try some code, starting with import androidhelper
u0_a98#android:/ $ python
Python 2.7.2 (default, Jun 3 2013, 20:01:13)
[GCC 4.4.3] on darwin
Type "help", "copyright", "credits" or "license" for more information.
import androidhelper
Traceback (most recent call last):
File "", line 1, in
File "/storage/sdcard0/com.hipipal.qpyplus/lib/site-packages/androidhelper.py", line 43, in
import sl4a
ImportError: No module named sl4a
I'm running Cyanogenmod 10.0.0, Android 4.1.2. Any idea how to import androidhelper successfully?

QPython is still Beta so you'll need to look around for documentation.
I think you haven't added any modules to your library so you'll need to do so for your code to work.
http://qpython.org/question/62/how-to-install-3rd-part-python-modules-for-qpython/

I think the bug you describe only in console now,
But I am sure new version will fix this bug. : ) You can follow it's news on facebook http://www.facebook.com/QPython

Install the latest from the Google Play store. I'm not getting this error using QPython (classic, not QPython3).

Related

Cannot import sentinelsat python module

I am a python newbie and am trying to get the sentinelhub module to work but have been receving this error message on my code:
import sentinelhub
Traceback (most recent call last):
File "<pyshell#0>", line 1, in
import sentinelhub
ImportError: No module named sentinelhub
After I've downloaded the module using "pip install sentinelhub" on the windows command. I am currently using Python version 2.7.18. Any suggestions would be helpful. Thanks.
It looks like sentinelhub requires a different version of Python.
From their own website they specify that it "requires Python >=3.7"
https://sentinelhub-py.readthedocs.io/en/latest/install.html

Pandas runtime error /anaconda3/lib/python3.8/site-packages/pandas/__init__.py", line 13 missing_dependencies

I need to do some stuff using pandas.
Inside my python file, I wrote this:
sys.path.append("/home/user0/anaconda3/lib/python3.8/site-packages")
import pandas as pd
When I run the program,I get this:
File "/home/user0/anaconda3/lib/python3.8/site-packages/pandas/__init__.py", line 13
missing_dependencies.append(f"{dependency}: {e}")
^
SyntaxError: invalid syntax
I installed Anaconda, and I can verify that pandas is available.
My working environment is inside Anaconda's virtual environment, where python version is 3.8.
When I "conda deactivate", my python version is 2.7.
When I login to the server, my Anaconda env is already activated, and I get a prompt like this:
(base) user0#optiplex:~$
"conda list" tells me my pandas version is 1.0.5, and numpy is 1.18.5.
I have already updated Anaconda using "conda update --all". No improvement.
Some diagnostics:
(base) user0#optiplex:~$ python
Python 3.8.3 (default, Jul 2 2020, 16:21:59)
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.executable
'/home/user0/anaconda3/bin/python'
>>> import sys
>>> sys.path
['', '/home/user0/anaconda3/lib/python38.zip', '/home/user0/anaconda3/lib/python3.8',
'/home/user0/anaconda3/lib/python3.8/lib-dynload',
'/home/user0/anaconda3/lib/python3.8/site-packages']
>>>
Someone please give me some hints.
Thank you.
First, I tried different keywords and googled, and landed on exactly this item in stack overflow!
It mentions may be there is python version mismatch.
https://ja.stackoverflow.com/questions/67370/import-pandas-%E3%81%A7-pandas-init-py-%E3%81%AB%E5%AF%BE%E3%81%97%E3%81%A6-syntaxerror-%E3%81%8C%E3%81%A7%E3%81%BE%E3%81%99
I was running my code inside another program that uses python 2.x internally, so it could be the case, I don't know. I don't know much about python, specially working env setup, so I cannot make anymore comments.
Second, I ran the code once again, right after the first error, and the second time, the program worked. I don't know what to make of it either.
BTW, AtanuCSE, thank you for formatting my question!

Anaconda install of Tensorflow missing 'audio_ops' from contrib framework

I'm trying to follow along the Audio Recognition Network tutorial.
I've created an Anaconda environment with python 3.6 and followed the install instruction accordingly for installing the GPU whl.
I can run the 'hello world' TF example.
When I go to run 'train.py' in the Audio Recognition Network tutorial/example, I get:
Traceback (most recent call last):
File "train.py", line 79, in <module>
import input_data
File "/home/philglau/speech_commands/input_data.py", line 35, in <module>
from tensorflow.contrib.framework.python.ops import audio_ops as contrib_audio
ImportError: cannot import name 'audio_ops'
The code in the tutorial that fails is:
from tensorflow.contrib.framework.python.ops import audio_ops as contrib_audio
I then backed up that chain until I could import some part of it:
import tensorflow.contrib.framework as test ==> works
import tensorflow.contrib.framework.python as test --> fail:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'tensorflow.contrib.framework' has no attribute 'python'
Not sure where I'm going wrong on my install.
Details:
Ubuntu 16.04
Anaconda env with python 3.6
Followed the 'anaconda' instruction on the TF install page. (GPU version)
I also tried using a python 2.7 env for anaconda but got the same results.
It looks like they're releasing the audio_ops modules in version 1.4 (https://github.com/tensorflow/tensorflow/issues/11339#issuecomment-327879009).
Until v1.4 is released, an easy way around this is to install the nightly tensorflow build
pip install tf-nightly
or with the docker image linked in the issue comment.
The short answer:
The framework is missing the "audio_ops.py" and the example wont work until the file is released. Or you code the wrappers.
More on this:
If you go to the: tensorflow.contrib.framework.python.ops local folder you can find other *_ops.py files but not the "audio_ops.py".
If you get it from the Master at: https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/framework/python/ops
You will find the file is almost empty and with import labels wrong: "audio_ops" vs "gen_audio_ops".
With almost empty I mean that: decode_wav, encode_wav, audio_spectrogram , mfcc are not implemented/wrapped.
So, no working example and no fun.
We need to check again when "audio_ops.py" is released.
Here:
https://github.com/tensorflow/tensorflow/issues/11339
You can find a Developer saying: "we don't actually want to make them public / supported yet. I'm sorry this decision wasn't better documented"

Adding beautifulsoup in pycharm

How to install beautifulsoup4 in pycharm:
Click on settings, now look for the project interpreter. This is where you can add beautifulsoup by clicking on the green cross on the right side of the screen.
I did this in pycharm, but there occurs error in installation. The error message is:
Traceback (most recent call last):
File "C:/Users/Rishi/PycharmProjects/untitled2/beautifuls.py", line 3, in
from bs4 import BeautifulSoup
File "C:\Python34\lib\site-packages\bs4_init_.py", line 175
except Exception, e:
^
SyntaxError: invalid syntax
Process finished with exit code 1
python.org/pypi
This is the repositories set in the available packages list.
Do you have a version of Python 2 on the same machine as your Python 3.4 interpreter?
If so you may want to check to make sure that you are using the correct version of pip. I would suggest removing beautiful soup and re-adding it manually as a test.
pip3 install BeautifulSoup4
You also need to find "beautifulsoup4" (for python 3.x)

Python3: no gzip or zlib?

is this module named something else now? I can't seem to find any info saying that this module was deprecated or dropped completely. (which would confuse me further)
Anyone know where this went?
Python 3.1.2 (r312:79147, May 20 2010, 09:09:30)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-48)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import gzip
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python3.1/gzip.py", line 9, in
import zlib
ImportError: No module named zlib
UPDATE: I found this in the source bundle i used Python-3.1.2/Modules/zlib/ChangeLog
The last change was in 2005 and it doesn't mention anything telling.
ChangeLog file for zlib
Changes in 1.2.3 (18 July 2005)
- Apply security vulnerability fixes to contrib/infback9 as well
- Clean up some text files (carriage returns, trailing space)
- Update testzlib, vstudio, masmx64, and masmx86 in contrib [Vollant]
[SOLVED]
http://www.1stbyte.com/2005/06/26/configure-and-compile-python-with-zlib/
(Answered by editing a URL into the question. Converted to a community wiki answer. See Question with no answers, but issue solved in the comments (or extended in chat) )
The OP wrote:
[SOLVED] http://www.1stbyte.com/2005/06/26/configure-and-compile-python-with-zlib/
SO deprecates URL only answers, and it would be inappropriate to transcribe the blog from GregTheGeek on that site. However, in summary, the steps necessary are:
Install the appropriate Zlib-dev package. For example on Ubuntu it is called zlib1g-dev. This will provide the zlib.h include file.
After compiling your python sources run the configure script: ./configure –with-zlib=/usr/include
Now make and make install should work.