matplotlib.show() hangs into an infinite loop - matplotlib

Note: please dont mark it as duplicate, the previous question doesnt answer it completely.
This question has been answered partially in this link:
plt.show() hangs on OSX with Anaconda Python
However, there is no mention of where does the matplotlibrc resides to change the option. Also, specially when we are invoking the notebook using ipython notebook command, where can we use pythonw to overcome the issue?
Any help will be appreciated.

For me (W10 x64), the matplotlibrc resides in the folder
C:\Program Files\Anaconda\Lib\site-packages\matplotlib\mpl-data
It is just a text file you can edit with any editor to change the options.
What worked (but I'm really not understanding all of this) was the following config (line 38 and following):
backend : Qt4Agg
# If you are using the Qt4Agg backend, you can choose here
# to use the PyQt4 bindings or the newer PySide bindings to
# the underlying Qt4 toolkit.
#backend.qt4 : PyQt4 # PyQt4 | PySide
commenting this last line was necessary to finally have any curve plotted.
For your second question, I'm sorry I can't help at all.
I hope this will help you, good luck !

Related

plotnine is broken with matplotlib==3.6

I am getting the following error with plotnine==0.9 and matplotlib==3.6.
File "D:\Python\Python310\lib\site-packages\plotnine\stats\stat_density_2d.py", line 3, in <module>
import matplotlib._contour as _contour
ModuleNotFoundError: No module named 'matplotlib._contour'
If I downgrade matplotlib==3.5, the problem goes away.
It's discussed here and it's already fixed here Note that it's already merged to main.
It was due to a internal matplotlib call that is no longer supported and has been replaced.
So I guess you could choose between:
downgrade to mlp 3.5.3
install plotnine#main
till the next plotnine release.
Carlos's answer is correct. However if anybody else, like me, is uncertain of how to install plotnine#main, you can implement the fix rather easily:
Find the site_packages folder you python script uses. It usually is a subdirectory of the python version you are using, which can located reliably by trying to reinstall matplotlib or any other package you know you have access to, and checking the logs in the console. ex using python -m pip install matplotlib.
Go down into the site_packages/plotnine/stats directory and open up the stats_density_2d.py file in your editor of choice.
Apply & save the modifications made in the fix. Alternatively, overwrite the file with the one from the github.
ModuleNotFoundError: No module named 'matplotlib._contour'
Issues with matplotlib 3.6.1 and
plotnine 0.9.0
K.I.S.S.
in terminal:
pip show matplotlib #enables you to check version
pip install matplotlib==3.5 #revert and problem is resolved for now.
no more:
ModuleNotFoundError: No module named 'matplotlib._contour'
resolves issue for now that will stop progress...

How to read GCS path in local environment

I usually do my Machine Learning work on Kaggle/Colab, however I'm trying to modularize my codes onto github. I face one big problem when I try to read files from GCS.
For example, I have GCS_PATH = "gs://kds-432679f77c5f716920e51fb4289eb7c6d9d6" and wish to do this:
TRAINING_FILENAMES = tf.io.gfile.glob(GCS_PATH + "/train*.tfrec")
However my vscode throws me this error "in get_matching_files_v2 compat.as_bytes(pattern)) tensorflow.python.framework.errors_impl.UnimplementedError: File system scheme 'gs' not implemented (file: 'gs://kds-432679f77c5f716920e51fb4289eb7c6d9d6/train*.tfrec')"
Everything works fine on colab but fails immediately in a local environment. I am quite new to this, please advise on how to approach this problem.
This might be due to the incompatibility of version support for gcs. You may try downgrading tensorflow_datasets from 3.2.1 to 3.1.0. See a similar issue below:
https://github.com/tensorflow/tensorflow/issues/38477#issuecomment-659279614
Good luck!

ModuleNotFoundError: No module named 'telegram'

Trying to run the python-telegram-bot library through Jupyter Notebook I get this question error. I tried many ways to reinstall it, but nothing from answers at any forums helped me. What should be a mistake and how to avoid it while installing?
Do you have a directory with "telegram" name? If you do,rename your directory and try it again to prevent import conflict.
good luck:)

Send help in the form of someone who knows python well

I am currently well versed in java, but I am trying to get into python. I know the basics, but am struggling with package use and implementation into source code.
I have successfully installed both numpy and Pillow (or PIL):
Click here for cmd telling me both packages have been installed
When I typed import numpy into cmd running python, it worked no problem, but now I've tried to open IDLE and import it there, and written source code trying to import it and utalise parts of the numpy lib but it always gives me a ModuleNotFoundError
python idle shell import vs. cmd import
My folder layout is a little wacky:
C:
..Users
....B
......ForImagingProject
........PYTHON
..........(python standard subfolders)
..........Lib
............site-packages
..............numpy and PIL and pip here
Any and all help would be appreciated
Thanks ~ B
EDIT: I messed up and my IDLE shortcut was running idle.pyw instead of idle.bat. Everything working smoothly now.
Check your IDLE's python executable. Is it the same one as in your cmd prompt?
The easiest way to check is to run this:
import sys
print(sys.path)
Look for something like
'PATH_TO_PYTHON/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7'or
'PATH_TO_PYTHON/Frameworks/Python.framework/Versions/2.7/lib/python2.7'
Make sure this is the same in both the IDLE and in cmd.
The reason the shell I was working in was unable to recognize the module was because my IDLE shortcut was mapped to idle.pyw instead of idle.bat. Everything running smoothly now

How to resolve the missing python gsm module while executing airprobe

For quite some while I've been trying to work with usrp, gnuradio and airprobe. I've successfully received a data dump using usrp but when I try to use gsm_receive100.py on the captured cfile, I am always getting this error:
./gsm_receive100.py cfile
Traceback (most recent call last):
File "./gsm_receive100.py", line 12, in <module>
import gsm
ImportError: No module named gsm
I tried to look every possible place for the particular python module that is missing, both in the web and within the distribution itself but without any success so far. Has anyone faced a similar problem before, and do you know how to solve it?
Supratim -
This is either a problem with your install of the out-of-tree module, or with the module itself. To debug this, you (and anyone helping you) really needs a lot more information:
For starters:
1) What happens when you try to import the module in the Python shell?
2) What turns up when you use slocate to find the module on your computer?
3) What does $ env $PYTHONPATH tell you?
Also, this really isn't a good question for Stack Overflow. This would be better asked on the GNURadio mailing list, which is very active.
For support, you should really look to the mailing lists:
For GNU Radio: https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
For things specific to USRPs: http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com
In general, the community uses the lists almost exclusively for support.