numpy asarray float32 works on Ubuntu but not Windows 7 - python

I followed the instructions here
Steps 1 and 2 have been checked. My Intel(R) Core(TM) i7-2860QM CPU # 2.50GHz CPU can support 64-bit and Intel virtalization tech and it is currently using virtualization tech according to my BIOS. Checking step 3: I'm on Ubuntu so no antivirus software and I'm not running any system level debugging. Now see the attached image, even though I set the VM to be 64-bit on the left, it is still 32-bit on the right.
I know that the settings are merely for organizational purposes and that they can't actually change the bitness of the VM. I downloaded the VM here - https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/linux/. None of them are marked as 64-bit, so I do not know how to guarantee that I have a 64-bit Windows image
This is not the main issue I'm trying to solve though. It has been inferred as being the cause of my main issue.
Same code works on Ubuntu 14.04 but not the Windows 7 VM. Below you'll see me debugging and all variables look identical.
Next I type the error-causing line into the console and sure enough on one OS we have no issues and on the other we blow up
>>> np.asarray(frames, dtype=np.float32)
Traceback (most recent call last):
File "C:\Program Files\JetBrains\PyCharm 2016.1.2\helpers\pydev\_pydevd_bundle\pydevd_exec.py", line 3, in Exec
exec exp in global_vars, local_vars
File "<input>", line 1, in <module>
File "C:\Python27\lib\site-packages\numpy\core\numeric.py", line 482, in asarray
return array(a, dtype, copy=False, order=order)
MemoryError
Now the part that gives me the creeps. When I go back to the debugging tab from the console in Ubuntu I see many new variables have spontaneously been created even though I only typed one line into the Python console
I figure there should be a package problem.
I'm using Python 2.7.11 on the Windows 7 VM and these packages are installed
FITS-tools 0.0.dev0
Pillow 3.2.0 3.2.0
Pillow-PIL 0.1.dev0 0.1dev
PyQt4 4.11.4 4.11.4
astropy 1.1.2 1.1.2
cycler 0.10.0
image-registration 0.2.2.dev272
matplotlib 1.5.1 1.5.1
numpy 1.11.0 1.11.0
parmap 1.2.3 1.2.3
pip 8.1.1 8.1.1
pyfits 3.4 3.4
pyparsing 2.1.1 2.1.1
pyqtgraph 0.9.10 0.9.10
python-dateutil 2.5.3 2.5.3
pytz 2016.4 2016.4
scipy 0.17.0 0.17.0
setuptools 20.10.1 21.0.0
six 1.10.0 1.10.0
wheel 0.29.0 0.29.0
On Ubuntu - to my surprise - I'm using Python 2.7.6 (and for some reason I get a make: *** [libinstall] Error 1 when I try to upgrade to 2.7.11 but that's another issue). Here are the packages I ave installed on the working Ubuntu side
BeautifulSoup 3.2.1 3.2.1
CherryPy 3.2.2 5.3.0
Cython 0.22 0.24
Django 1.9.1 1.9.6
Markdown 2.4 2.6.6
PAM 0.4.2
Pillow 2.3.0 3.2.0
PyOpenGL 3.0.2 3.1.1a1
Pygments 1.6 2.1.3
Routes 2.0 2.3.1
Twisted-Core 13.2.0
Twisted-Web 13.2.0
VTK 5.8.0
WebOb 1.3.1 1.6.0
adium-theme-ubuntu 0.3.4
amqplib 1.0.2 1.0.2
apptools 4.3.0 4.4.0
apsw 3.8.2-r1 3.9.2-r1
apt-xapian-index 0.45
argparse 1.2.1 1.4.0
astropy 1.1.2 1.1.2
cffi 0.8.6 1.6.0
chardet 2.0.1 2.3.0
colorama 0.2.5 0.3.7
command-not-found 0.3
configobj 5.0.6 5.0.6
cssselect 0.9.1 0.9.1
cssutils 0.9.10 1.0.1
debtagshw 0.1
defer 1.0.6 1.0.4
deluge 1.3.6
dirspec 13.10 13.08
dnspython 1.11.1 1.12.0
duplicity 0.6.23
envisage 4.1.0 4.5.1
feedparser 5.1.3 5.2.1
h5py 2.2.1 2.6.0
html5lib 0.999 0.9999999
httplib2 0.8 0.9.2
image-registration 0.2.2.dev272
ipython 3.1.0 4.2.0
libtfr 1.0.4 2.0.0b4
lockfile 0.8 0.12.2
lxml 3.3.3 3.6.0
matplotlib 1.4.3 1.5.1
mayavi 4.4.3 4.4.4
mechanize 0.2.5 0.2.5
mock 1.0.1 2.0.0
netifaces 0.8 0.10.4
nose 1.3.7 1.3.7
numexpr 2.2.2 2.5.2
numpy 1.9.2 1.11.0
oauthlib 0.6.1 1.1.1
oneconf 0.3.7.14.04.1 0.0.1.dev0
pandas 0.16.1 0.18.1
parmap 1.2.3 1.2.3
pexpect 3.1 4.0.1
pip 1.5.4 8.1.1
piston-mini-client 0.7.5 0.7.5
plotly 1.6.17 1.9.10
ply 3.4 3.8
py 1.4.31 1.4.31
pyFFTW 0.9.2 0.10.1
pyOpenSSL 0.13 16.0.0
pycparser 2.10 2.14
pycrypto 2.6.1 2.6.1
pycups 1.9.66 1.9.73
pyface 5.0.0 5.1.0
pygame 1.9.1release
pygobject 3.12.0
pygpgme 0.3 0.3
pyparsing 2.0.3 2.1.1
pyqtgraph 0.9.10 0.9.10
pyserial 2.6 3.0.1
pysmbc 1.0.14.1 1.0.15.5
pytest 2.9.1 2.9.1
python-apt 0.9.3.5ubuntu2 0.7.8
python-dateutil 2.4.2 2.5.3
python-debian 0.1.21-nmu2ubuntu2 0.1.23
python-libtorrent 0.16.13 1.1.0
pytz 2015.4 2016.4
pyxdg 0.25 0.25
pyzmq 14.7.0 15.2.0
reportlab 3.0 3.3.0
repoze.lru 0.6 0.6
requests 2.2.1 2.10.0
scikit-learn 0.17.1 0.17.1
scipy 0.15.1 0.17.0
sessioninstaller 0.0.0
setuptools 3.3 21.0.0
simplejson 3.7.3 3.8.2
six 1.5.2 1.10.0
sklearn 0.0 0.0
software-center-aptd-plugins 0.0.0
system-service 0.1.6
tables 3.1.1 3.2.2
traits 4.5.0 4.5.0
traitsui 5.0.0 5.1.0
uTidylib 0.2 0.2
unity-lens-photos 1.0
urllib3 1.7.1 1.15.1
vboxapi 1.0 1.0
wheel 0.24.0 0.29.0
wsgiref 0.1.2 0.1.2
wxPython 2.8.12.1 2.9.1.1
wxPython-common 2.8.12.1 2.6.3.3
xdiagnose 3.6.3build2
xppy 0.7.0
zope.interface 4.0.5 4.1.3

You've got MemoryError. Means you requested allocation which is beyond available memory on your VM. Some potential reasons:
not enough memory allocated for VM (try to increase it)
2GB limit for process on Windows (run LARGEADDRESSAWARE python or move to 64 bit)
memory corruption so your heap is corrupted (debug your code)
Similar discussion Memory errors and list limits?

Related

Matplotlib style.use('tex') error in MacOS

Firstly apologies for the similarity to other questions, but I believe this is a different issue from all the previous questions/answers I have found. Please refer me to other questions if you think I'm wrong, but please also read the full question to check I haven't already tried the solution provided in the other question.
I had a working setup using Conda and matplotlib to do data-processing and plot figure with latex formatted captions etc, due to some lingering issues I did a full clean install. Trying to recreate my environment from before produces this error, unsure exactly what version of Catalina I was running pre-reboot but the Big Sur version I'm now running is 11.2.1.
Code required to reproduce the issue (running in a miniconda environment, full package list at the end):
import matplotlib.pyplot as plt
plt.style.use('tex')
I have confirmed the following:
tex and latex are both installed and work, both are found by "which" and both run, version information:
tex: Version 3.14159265 (TeX Live 2020)
latex: pdfTeX, Version 3.14159265-2.6-1.40.21 (TeX Live 2020)
dvipng is installed and runs (v 1.17)
Ghostscript is installed and runs (v 9.50)
The above are all present in PATH, as well as os.environ['PATH']:
latex, tex, dvipng are in /Library/TeX/texbin/
gs is in /usr/local/bin
Full error output:
Traceback (most recent call last):
File "/Users/will_gerrard/opt/miniconda3/envs/plotting/lib/python3.8/site-packages/matplotlib/style/core.py", line 121, in use
rc = rc_params_from_file(style, use_default_template=False)
File "/Users/will_gerrard/opt/miniconda3/envs/plotting/lib/python3.8/site-packages/matplotlib/__init__.py", line 883, in rc_params_from_file
config_from_file = _rc_params_in_file(fname, fail_on_error=fail_on_error)
File "/Users/will_gerrard/opt/miniconda3/envs/plotting/lib/python3.8/site-packages/matplotlib/__init__.py", line 812, in _rc_params_in_file
with _open_file_or_url(fname) as fd:
File "/Users/will_gerrard/opt/miniconda3/envs/plotting/lib/python3.8/contextlib.py", line 113, in __enter__
return next(self.gen)
File "/Users/will_gerrard/opt/miniconda3/envs/plotting/lib/python3.8/site-packages/matplotlib/__init__.py", line 790, in _open_file_or_url
with open(fname, encoding=encoding) as f:
FileNotFoundError: [Errno 2] No such file or directory: 'tex'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/will_gerrard/opt/miniconda3/envs/plotting/lib/python3.8/site-packages/matplotlib/style/core.py", line 124, in use
raise IOError(
OSError: 'tex' not found in the style library and input is not a valid URL or path; see `style.available` for list of available styles
Questions I have:
How can I have the following sequence of outputs:
os.environ['PATH'] and sys.path both show '/Library/TeX/texbin'
os.path.isfile('/Library/TeX/texbin/tex') -> True
os.path.isfile('tex') -> False
Why is Matplotlib trying to open the tex executable as if its a (utf-8) text file ?
What other things should I try / verify ?
Thanks in advance !
Full Conda list output:
# Name Version Build Channel
blas 1.0 mkl
ca-certificates 2020.12.5 h033912b_0 conda-forge
cairo 1.16.0 h0ab9d94_1001 conda-forge
certifi 2020.12.5 py38h50d1736_1 conda-forge
curl 7.71.1 hb0a8c7a_1
cycler 0.10.0 py38_0
fontconfig 2.13.1 hd23ceaa_1004 conda-forge
freetype 2.10.4 ha233b18_0
gettext 0.19.8.1 h7937167_1005 conda-forge
glib 2.67.4 hdf23fa2_1
gmp 6.1.2 h0a44026_1000 conda-forge
graphite2 1.3.13 h12caacf_1001 conda-forge
harfbuzz 1.8.8 hb8d4a28_0
icu 58.2 h0a44026_1000 conda-forge
intel-openmp 2019.4 233
jpeg 9b he5867d9_2
kiwisolver 1.3.1 py38h23ab428_0
krb5 1.18.2 h75d18d8_0
lcms2 2.11 h92f6f08_0
libcurl 7.71.1 h8a08a2b_1
libcxx 10.0.0 1
libedit 3.1.20191231 h1de35cc_1
libffi 3.3 hb1e8313_2
libgfortran 3.0.1 h93005f0_2
libiconv 1.16 haf1e3a3_0 conda-forge
libpng 1.6.37 ha441bb4_0
libssh2 1.9.0 h52ee1ee_6 conda-forge
libtiff 4.1.0 hcb84e12_1
libxml2 2.9.10 h7cdb67c_3
lz4-c 1.9.3 h23ab428_0
matplotlib 3.3.4 py38hecd8cb5_0
matplotlib-base 3.3.4 py38h8b3ea08_0
mkl 2019.4 233
mkl-service 2.3.0 py38h9ed2024_0
mkl_fft 1.3.0 py38ha059aab_0
mkl_random 1.1.1 py38h959d312_0
mpfr 4.0.2 h44b798e_0 conda-forge
ncurses 6.2 h0a44026_1
numpy 1.19.2 py38h456fd55_0
numpy-base 1.19.2 py38hcfb5961_0
olefile 0.46 py_0
openjpeg 2.3.1 h254dc36_3 conda-forge
openssl 1.1.1j hbcf498f_0 conda-forge
ordered-set 4.0.2 pypi_0 pypi
pandas 1.2.3 py38hb2f4e1b_0
pcre 8.44 h4a8c4bd_0 conda-forge
pillow 8.1.2 py38h5270095_0
pip 21.0.1 py38hecd8cb5_0
pixman 0.38.0 h01d97ff_1003 conda-forge
poppler 0.81.0 h2ef9dbd_1
poppler-data 0.4.10 0 conda-forge
pyparsing 2.4.7 pyhd3eb1b0_0
python 3.8.8 h88f2d9e_4
python-dateutil 2.8.1 pyhd3eb1b0_0
python_abi 3.8 1_cp38 conda-forge
pytz 2021.1 pyhd3eb1b0_0
readline 8.1 h9ed2024_0
scipy 1.6.1 py38h2515648_0
seaborn 0.11.1 pyhd3eb1b0_0
setuptools 52.0.0 py38hecd8cb5_0
six 1.15.0 py38hecd8cb5_0
sqlite 3.33.0 hffcf06c_0
texlive-core 20180414 ha09c46f_0
tk 8.6.10 hb0a8c7a_0
tornado 6.1 py38h9ed2024_0
wheel 0.36.2 pyhd3eb1b0_0
xz 5.2.5 h1de35cc_0
zlib 1.2.11 h1de35cc_3
zstd 1.4.5 h41d2c2f_0
UPDATE:
Tried using
plt.rcParams.update({
"text.usetex": True})
And producing a simple plot, the following error occurs:
Traceback (most recent call last):
File "/Users/will_gerrard/opt/miniconda3/envs/plotting/lib/python3.8/site-packages/matplotlib/texmanager.py", line 275, in _run_checked_subprocess
report = subprocess.check_output(command,
File "/Users/will_gerrard/opt/miniconda3/envs/plotting/lib/python3.8/subprocess.py", line 415, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "/Users/will_gerrard/opt/miniconda3/envs/plotting/lib/python3.8/subprocess.py", line 516, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['latex', '-interaction=nonstopmode', '--halt-on-error', '/Users/will_gerrard/.matplotlib/tex.cache/d2acc2706db635f7f7afe7dc80ac47f1.tex']' returned non-zero exit status 1.
Here is the full report generated by latex:
warning: kpathsea: configuration file texmf.cnf not found in these directories: /Users/will_gerrard/opt/miniconda3/envs/plotting/bin:/Users/will_gerrard/opt/miniconda3/envs/plotting/bin/share/texmf-local/web2c:/Users/will_gerrard/opt/miniconda3/envs/plotting/bin/share/texmf-dist/web2c:/Users/will_gerrard/opt/miniconda3/envs/plotting/bin/share/texmf/web2c:/Users/will_gerrard/opt/miniconda3/envs/plotting/bin/texmf-local/web2c:/Users/will_gerrard/opt/miniconda3/envs/plotting/bin/texmf-dist/web2c:/Users/will_gerrard/opt/miniconda3/envs/plotting/bin/texmf/web2c:/Users/will_gerrard/opt/miniconda3/envs/plotting:/Users/will_gerrard/opt/miniconda3/envs/plotting/share/texmf-local/web2c:/Users/will_gerrard/opt/miniconda3/envs/plotting/share/texmf-dist/web2c:/Users/will_gerrard/opt/miniconda3/envs/plotting/share/texmf/web2c:/Users/will_gerrard/opt/miniconda3/envs/plotting/texmf-local/web2c:/Users/will_gerrard/opt/miniconda3/envs/plotting/texmf-dist/web2c:/Users/will_gerrard/opt/miniconda3/envs/plotting/texmf/web2c:/Users/will_gerrard/opt/miniconda3/texmf-local/web2c:/Users/will_gerrard/opt/miniconda3/envs:/Users/will_gerrard/opt/miniconda3/envs/share/texmf-local/web2c:/Users/will_gerrard/opt/miniconda3/envs/share/texmf-dist/web2c:/Users/will_gerrard/opt/miniconda3/envs/share/texmf/web2c:/Users/will_gerrard/opt/miniconda3/envs/texmf-local/web2c:/Users/will_gerrard/opt/miniconda3/envs/texmf-dist/web2c:/Users/will_gerrard/opt/miniconda3/envs/texmf/web2c.
This is pdfTeX, Version 3.14159265-2.6-1.40.19 (TeX Live 2018) (preloaded format=latex)
kpathsea: Running mktexfmt latex.fmt
warning: kpathsea: configuration file texmf.cnf not found in these directories: /Users/will_gerrard/opt/miniconda3/envs/plotting/bin:/Users/will_gerrard/opt/miniconda3/envs/plotting/bin/share/texmf-local/web2c:/Users/will_gerrard/opt/miniconda3/envs/plotting/bin/share/texmf-dist/web2c:/Users/will_gerrard/opt/miniconda3/envs/plotting/bin/share/texmf/web2c:/Users/will_gerrard/opt/miniconda3/envs/plotting/bin/texmf-local/web2c:/Users/will_gerrard/opt/miniconda3/envs/plotting/bin/texmf-dist/web2c:/Users/will_gerrard/opt/miniconda3/envs/plotting/bin/texmf/web2c:/Users/will_gerrard/opt/miniconda3/envs/plotting:/Users/will_gerrard/opt/miniconda3/envs/plotting/share/texmf-local/web2c:/Users/will_gerrard/opt/miniconda3/envs/plotting/share/texmf-dist/web2c:/Users/will_gerrard/opt/miniconda3/envs/plotting/share/texmf/web2c:/Users/will_gerrard/opt/miniconda3/envs/plotting/texmf-local/web2c:/Users/will_gerrard/opt/miniconda3/envs/plotting/texmf-dist/web2c:/Users/will_gerrard/opt/miniconda3/envs/plotting/texmf/web2c:/Users/will_gerrard/opt/miniconda3/texmf-local/web2c:/Users/will_gerrard/opt/miniconda3/envs:/Users/will_gerrard/opt/miniconda3/envs/share/texmf-local/web2c:/Users/will_gerrard/opt/miniconda3/envs/share/texmf-dist/web2c:/Users/will_gerrard/opt/miniconda3/envs/share/texmf/web2c:/Users/will_gerrard/opt/miniconda3/envs/texmf-local/web2c:/Users/will_gerrard/opt/miniconda3/envs/texmf-dist/web2c:/Users/will_gerrard/opt/miniconda3/envs/texmf/web2c.
/Users/will_gerrard/opt/miniconda3/envs/plotting/bin/mktexfmt: kpsewhich -var-value=TEXMFROOT failed, aborting early.
BEGIN failed--compilation aborted at /Users/will_gerrard/opt/miniconda3/envs/plotting/bin/mktexfmt line 25.
I can't find the format file `latex.fmt'!

How to fix Jupyter notebook dependancies? ModuleNotFoundError: No module named 'boto3'

I am running EMR cluster(AWS) but I do not understand how notebook imports packages. I am running PySpark kernel.
import boto3
No module named 'boto3'
Traceback (most recent call last):
ModuleNotFoundError: No module named 'boto3'
print (sys.version) shows
3.7.6 (default, Feb 26 2020, 20:54:15)
[GCC 7.3.1 20180712 (Red Hat 7.3.1-6)]
print(sys.executable) shows
/tmp/1594625399736-0/bin/python
I have both Conda and pip3 install of boto3.
How to solve this?
Are you using pyspark? If yes, then you need to install the packages in the spark context. Refer to this AWS document: https://aws.amazon.com/blogs/big-data/install-python-libraries-on-a-running-cluster-with-emr-notebooks/
similarly install any dependency packages if you see module not found error on import. Make sure the versions are compatible.
sc.list_packages()
Package Version
-------------------------- -------
beautifulsoup4 4.9.0
boto 2.49.0
cycler 0.10.0
jmespath 0.9.5
kiwisolver 1.2.0
lxml 4.5.0
matplotlib 3.2.2
mysqlclient 1.4.2
nltk 3.4.5
nose 1.3.4
numpy 1.19.0
pandas 1.0.5
pip 9.0.1
py-dateutil 2.2
py4j 0.10.9
pyparsing 2.4.7
pyspark 3.0.0
python-dateutil 2.8.1
python37-sagemaker-pyspark 1.3.0
pytz 2020.1
PyYAML 5.3.1
setuptools 28.8.0
six 1.15.0
soupsieve 1.9.5
wheel 0.29.0
windmill 1.6
I have boto.
sc.install_pypi_package("boto3")

ipywidgets.embed missing dependencies? Key error when run in venv

I am writing a script that simply asks the google api for the latitudes and longitudes for a list of addresses read in from a csv file and outputs an html with the googlemap widget embedded. Further I hoped to run pyinstaller in order to make this into a .exe.
Running the code on my original conda environment it works fine however the .exe that pyinstaller creates is massive for such a small script (over 300mb). As such, I created a new virtual environment in which to work and have installed what I believe to be the bare minimum packages necessary and have rewritten the code to use as few packages as I am able which for the currently working portion of the code dropped it down considerably to just over 10 mb. (No numpy or pandas for me... ah well).
The code again works fine up until the final step:
from ipywidgets.embed import embed_minimal_html
embed_minimal_html("exporttest.html", None)
The above line should take any widgets, in particular the figure created from
fig = gmaps.figure(layout=figure_layout)
markers = gmaps.marker_layer(coordinates)
fig.add_layer(markers)
fig
Running the currently modified version in my original conda environment with all my of my usual packages installed this runs as expected without errors. Running on the virtual environment however on the mentioned lines I get the following key error:
KeyError Traceback (most recent call last)
c:\programdata\anaconda3\envs\synod_environ\lib\sre_parse.py in
parse_template(source, pattern)
1020 try:
-> 1021 this = chr(ESCAPES[this][1])
1022 except KeyError:
KeyError: '\\u'
During handling of the above exception, another exception occurred:
error Traceback (most recent call last)
<ipython-input-5-3359941239ab> in <module>
1 from ipywidgets.embed import embed_minimal_html
2
----> 3 embed_minimal_html("exporttest.html", None)
...
error: bad escape \u at position 0
(For clarification, key error has two slashes before the u, some frustration in getting this to post correctly)
As the code runs correctly in the one environment but not the other, I can only assume that I'm missing a package somewhere that ipywidgets requires, but running pip check doesn't notify me of anything missing.
pip list returns the following packages:
altgraph 0.16.1
backcall 0.1.0
bleach 3.0.2
certifi 2018.10.15
chardet 3.0.4
colorama 0.4.0
decorator 4.3.0
defusedxml 0.5.0
entrypoints 0.2.3
future 0.17.1
geojson 2.4.1
gmaps 0.8.2
idna 2.7
ipykernel 5.1.0
ipython 7.1.1
ipython-genutils 0.2.0
ipywidgets 7.4.2
jedi 0.13.1
Jinja2 2.10
jsonschema 2.6.0
jupyter 1.0.0
jupyter-client 5.2.3
jupyter-console 6.0.0
jupyter-core 4.4.0
macholib 1.11
MarkupSafe 1.0
mistune 0.8.4
nbconvert 5.4.0
nbformat 4.4.0
notebook 5.7.0
pandocfilters 1.4.2
parso 0.3.1
pefile 2018.8.8
pickleshare 0.7.5
pip 10.0.1
prometheus-client 0.4.2
prompt-toolkit 2.0.7
Pygments 2.2.0
PyInstaller 3.4
python-dateutil 2.7.5
pywin32-ctypes 0.2.0
pywinpty 0.5.4
pyzmq 17.1.2
qtconsole 4.4.2
requests 2.20.0
Send2Trash 1.5.0
setuptools 40.4.3
six 1.11.0
terminado 0.8.1
testpath 0.4.2
tornado 5.1.1
traitlets 4.3.2
urllib3 1.24
wcwidth 0.1.7
webencodings 0.5.1
wheel 0.32.2
widgetsnbextension 3.4.2
wincertstore 0.2
Any thoughts on how to further identify what went wrong, what package might be missing or how to fix the issue, and/or alternate ways to save a googlemaps output?
Fiddling with it and comparing from one environment to the other, I found that my virtual environment had ipywidgets 7.4.2 while the base environment had ipywidgets 7.2.1. Downgrading versions fixed the issue I was having.

Paging async iterator protocol is not available (Azure SDK for Python)

What I'm trying to achieve
I'm trying to automate subscription and resource group creation on Azure using the Python SDK.
To do that, I need a Service Principal Account (Client Id; Client Secret; Tenant Id) with Permissions to at least retrieve Enrollment Accounts and create the subscriptions and resource groups.
How I'm trying to achieve it
I tried listing the enrollment accounts without success (yes, I'm importing azure.mgmt.billing, azure.mgmt and azure.common, among others)
First I instantiate the client:
billing_client = azure.mgmt.billing.BillingManagementClient(credentials, subscription_id)
Then I tried printing the results in two different ways:
# A
print(list(billing_client.enrollment_accounts.list()))
# B
for enrollment_account in billing_client.enrollment_accounts.list():
print(enrollment_account)
What problem am I facing?
The problem I'm experiencing is that I get the following error:
Paging async iterator protocol is not available for EnrollmentAccountPaged
This also happens with other list() methods, like when I retrieve resource groups using something like
rm_client = ResourceManagementClient(credentials, subscription_id)
resource_groups = rm_client.resource_groups.list()
Then, I get the error:
Paging async iterator protocol is not available for ResourceGroupPaged
How would I consider my problem solved?
I'd love to know why I'm getting this error, and how to fix it. The example code from Azure doesn't use the methods or objects in a different way.
How's the environment?
Python version: Python 3.7
Packages:
Package Version Latest Version
PyJWT 1.6.4 1.6.4
adal 1.1.0 1.1.0
asn1crypto 0.24.0 0.24.0
azure-common 1.1.16 1.1.16
azure-mgmt 4.0.0 4.0.0
azure-mgmt-advisor 1.0.1 1.0.1
azure-mgmt-applicationinsights 0.1.1 0.1.1
azure-mgmt-authorization 0.50.0 0.50.0
azure-mgmt-batch 5.0.1 5.0.1
azure-mgmt-batchai 2.0.0 2.0.0
azure-mgmt-billing 0.2.0 0.2.0
azure-mgmt-cdn 3.0.0 3.0.0
azure-mgmt-cognitiveservices 3.0.0 3.0.0
azure-mgmt-commerce 1.0.1 1.0.1
azure-mgmt-compute 4.3.0 4.3.0
azure-mgmt-consumption 2.0.0 2.0.0
azure-mgmt-containerinstance 1.2.0 1.2.0
azure-mgmt-containerregistry 2.2.0 2.2.0
azure-mgmt-containerservice 4.2.2 4.2.2
azure-mgmt-cosmosdb 0.4.1 0.5.0
azure-mgmt-datafactory 0.6.0 0.6.0
azure-mgmt-datalake-analytics 0.6.0 0.6.0
azure-mgmt-datalake-nspkg 2.0.0 3.0.0
azure-mgmt-datalake-store 0.5.0 0.5.0
azure-mgmt-datamigration 1.0.0 2.0.0
azure-mgmt-devspaces 0.1.0 0.1.0
azure-mgmt-devtestlabs 2.2.0 2.2.0
azure-mgmt-dns 2.1.0 2.1.0
azure-mgmt-eventgrid 1.0.0 1.0.0
azure-mgmt-eventhub 2.1.0 2.1.0
azure-mgmt-hanaonazure 0.1.1 0.2.1
azure-mgmt-iotcentral 0.1.0 0.2.0
azure-mgmt-iothub 0.5.0 0.6.0
azure-mgmt-iothubprovisioningservices 0.2.0 0.2.0
azure-mgmt-keyvault 1.1.0 1.1.0
azure-mgmt-loganalytics 0.2.0 0.2.0
azure-mgmt-logic 3.0.0 3.0.0
azure-mgmt-machinelearningcompute 0.4.1 0.4.1
azure-mgmt-managementgroups 0.1.0 0.1.0
azure-mgmt-managementpartner 0.1.0 0.1.0
azure-mgmt-maps 0.1.0 0.1.0
azure-mgmt-marketplaceordering 0.1.0 0.1.0
azure-mgmt-media 1.0.0 1.0.0
azure-mgmt-monitor 0.5.2 0.5.2
azure-mgmt-msi 0.2.0 0.2.0
azure-mgmt-network 2.2.1 2.2.1
azure-mgmt-notificationhubs 2.0.0 2.0.0
azure-mgmt-nspkg 3.0.2 3.0.2
azure-mgmt-policyinsights 0.1.0 0.1.0
azure-mgmt-powerbiembedded 2.0.0 2.0.0
azure-mgmt-rdbms 1.3.0 1.3.0
azure-mgmt-recoveryservices 0.3.0 0.3.0
azure-mgmt-recoveryservicesbackup 0.3.0 0.3.0
azure-mgmt-redis 5.0.0 5.0.0
azure-mgmt-relay 0.1.0 0.1.0
azure-mgmt-reservations 0.2.1 0.3.0
azure-mgmt-resource 2.0.0 2.0.0
azure-mgmt-scheduler 2.0.0 2.0.0
azure-mgmt-search 2.0.0 2.0.0
azure-mgmt-servicebus 0.5.2 0.5.2
azure-mgmt-servicefabric 0.2.0 0.2.0
azure-mgmt-signalr 0.1.1 0.1.1
azure-mgmt-sql 0.9.1 0.9.1
azure-mgmt-storage 2.0.0 3.0.0
azure-mgmt-subscription 0.2.0 0.2.0
azure-mgmt-trafficmanager 0.50.0 0.50.0
azure-mgmt-web 0.35.0 0.40.0
azure-nspkg 3.0.2 3.0.2
certifi 2018.8.24 2018.8.24
cffi 1.11.5 1.11.5
chardet 3.0.4 3.0.4
cryptography 2.3.1 2.3.1
idna 2.7 2.7
isodate 0.6.0 0.6.0
msrest 0.6.0 0.6.0
msrestazure 0.5.0 0.5.0
oauthlib 2.1.0 2.1.0
pip 10.0.1 18.1
pycparser 2.19 2.19
python-dateutil 2.7.3 2.7.3
requests 2.19.1 2.19.1
requests-oauthlib 1.0.0 1.0.0
setuptools 39.1.0 40.4.3
This is a log warning to tell you that this package is not ready to support async syntax, and this is true, we released the first part of the runtime in msrest 0.6.0, but we didn't released any packages with async support yet.
For reference that it's just a warning:
https://github.com/Azure/msrest-for-python/blob/master/msrest/async_paging.py#L40
It will not impact any code and will not raise any exception. You will get a problem only if you try to use async for of async syntax (because as the warning tells you, it's not ready for).
When we'll start shipping async compatible packages by the end of this year, this warning will disappear automatically as more and more package becomes ready.
If this warning is really a problem for you, you can disable the logger "msrest.async_paging" or pin msrest to 0.5.5 (before async core support).
Feel free to open an issue on our tracker if you feel this is really a massive problem, and depending on how many people I get bad feedback, I might change it to debug for a few months. But once async packages will be released, it will be an important source of feedback and I truly think it would deserve a warning.
https://github.com/Azure/azure-sdk-for-python/issues
Thank you for your feedback!
(I own this code at Microsoft).
Edit: Being that you're not the only one with questions about this, I released a 0.6.1 that removes this warning.

ExtendedSelenium2Library - failed: ImportError: No module named keywords

I am running from a batch file that basically runs the robot.bat command.
Any suggestion on why would that be an issue and how to solve it? I see the packages are installed correctly. This is the first time I am attempting to run a test.
$ ./bin/run-windows.bat
>C:\Users\kondalar\workspace\rafa\cra-ui-qa>robot.bat --pythonpath C:/Users/kondalar/apps/conda/envs/robot-cray-ui-test2 --critical Critical --outputdir ..\report --variablefile C:/Users/kondalar/workspace/rafa/cra-ui-qa/config/windows-local-config.py C:/Users/kondalar/workspace/rafa/cra-ui-qa/cases/01*
[ ERROR ] Error in file 'C:\Users\kondalar\workspace\rafa\cra-ui-qa\resources\project-import.robot': Importing test library 'C:/Users/kondalar/apps/conda/envs/robot-cray-ui-test2/Lib/site-packages/ExtendedSelenium2Library' failed: ImportError: No module named keywords
Traceback (most recent call last):
File "C:\Users\kondalar\apps\conda\envs\robot-cray-ui-test2\Lib\site-packages\ExtendedSelenium2Library\__init__.py", line 27, in <module>
from ExtendedSelenium2Library.keywords import ExtendedElementKeywords
File "C:\Users\kondalar\apps\conda\envs\robot-cray-ui-test2\Lib\site-packages\ExtendedSelenium2Library\keywords\__init__.py", line 24, in <module>
from ExtendedSelenium2Library.keywords.extendedelement import ExtendedElementKeywords
File "C:\Users\kondalar\apps\conda\envs\robot-cray-ui-test2\Lib\site-packages\ExtendedSelenium2Library\keywords\extendedelement.py", line 27, in <module>
from Selenium2Library.keywords import _ElementKeywords
PYTHONPATH:
C:\Users\kondalar\apps\conda\envs\robot-cray-ui-test2
C:\Users\kondalar\apps\conda\envs\robot-cray-ui-test2
C:\Users\kondalar\apps\conda\envs\robot-ui-test\python27.zip
C:\Users\kondalar\apps\conda\envs\robot-ui-test\DLLs
C:\Users\kondalar\apps\conda\envs\robot-ui-test\lib
C:\Users\kondalar\apps\conda\envs\robot-ui-test\lib\plat-win
C:\Users\kondalar\apps\conda\envs\robot-ui-test\lib\lib-tk
C:\Users\kondalar\apps\conda\envs\robot-ui-test
C:\Users\kondalar\apps\conda\envs\robot-ui-test\lib\site-packages
$ conda list
>packages in environment at C:\Users\kondalar\apps\conda\envs\robot-cray-ui-test2:
certifi 2017.11.5 py27h03b45e1_0
chardet 3.0.4 <pip>
coverage 4.4.2 <pip>
decorator 4.1.2 <pip>
idna 2.6 <pip>
jsonpath-rw 1.4.0 <pip>
jsonpath-rw-ext 1.1.3 <pip>
pbr 3.1.1 <pip>
pip 9.0.1 py27hdaa76b4_4
pluggy 0.6.0 <pip>
ply 3.10 <pip>
py 1.5.2 <pip>
python 2.7.13 h1b6d89f_16
requests 2.18.4 <pip>
robotframework 3.0.2 <pip>
robotframework-databaselibrary 1.0.1 <pip>
robotframework-debuglibrary 0.8.1 <pip>
robotframework-extendedselenium2library 0.9.1 <pip>
robotframework-jsonlibrary 0.2 <pip>
robotframework-requests 0.4.7 <pip>
robotframework-selenium2library 3.0.0 <pip>
robotframework-seleniumlibrary 3.0.0 <pip>
selenium 3.8.0 <pip>
ExtendedSelenium2Library doesn't support SeleniumLibrary version 3. It's trying to import things that are in Selenium2Library which no longer exists with version 3.

Categories

Resources