Matplotlib not showing up plots (EPD compatibility problems) - python-2.7

I recently installed EPD 7.3-2 (the free version) on my Ubuntu 12.04 (64 bits).
I have some problems when trying to use ipython, I got the following error :
ImportError: Gtk* backend requires pygtk to be installed.
SO I found this article :
https://support.enthought.com/entries/22961778-epd-for-mac-os-x-32-and-64-bit-versions
and even thought it is for Mac OSX it did worked on my Linux machine. The modifications I did was putting the backend like this :
backend : Qt4Agg #GTKAgg
backend.qt4 : PySide
So it used to be GTKAgg. But now I have a new problem. When I try to plot with pylab a simple plot, like :
from pylab import *
plot([1,2,3])
show()
Nothing pops up... And I get the following error :
Error in atexit._run_exitfuncs: Traceback (most recent call last):
File
"/home/mela/Librairies/epd_free-7.3-2-rh5-x86_64/lib/python2.7/atexit.py",
line 24, in _run_exitfuncs
func(*targs, **kargs) File "/home/mela/Librairies/epd_free-7.3-2-rh5-x86_64/lib/python2.7/site-packages/matplotlib/_pylab_helpers.py", line 82, in destroy_all
manager.destroy() File "/home/mela/Librairies/epd_free-7.3-2-rh5-x86_64/lib/python2.7/site-packages/matplotlib/backends/backend_qt4.py",
line 367, in destroy
self._widgetclosed )
RuntimeError: Internal C++ object (PySide.QtGui.QMainWindow) already deleted.
Error in sys.exitfunc:
Traceback (most recent call last): File
"/home/mela/Librairies/epd_free-7.3-2-rh5-x86_64/lib/python2.7/atexit.py",
line 24, in _run_exitfuncs
func(*targs, **kargs)
File "/home/mela/Librairies/epd_free-7.3-2-rh5-x86_64/lib/python2.7/site-packages/matplotlib/_pylab_helpers.py", line 82, in destroy_all
manager.destroy()
File "/home/mela/Librairies/epd_free-7.3-2-rh5-x86_64/lib/python2.7/site-packages/matplotlib/backends/backend_qt4.py",
line 367, in destroy
self._widgetclosed )
RuntimeError: Internal C++ object (PySide.QtGui.QMainWindow) already deleted.
And I really don't get what does it mean or what should I do.
Any clue would be appreciated.

So I found my problem.
First of all, from the problem I undestand that it tries to close a window that's already closed, so I searched why and it looks like now the displays of pyplot are supposed to close directly after so when I add pl.show(block=True). Now I have a display but also a segmentation fault.
After trying different backends it looks like TkAgg solves both problems. So no compatibility issues and I can see my plots.
PS : for changing the backend from matplotlib go to ~/.matplotlib and edit the file matplotlibrc

Related

Problem when downloading Google CRMint: AttributeError: module 'appcli' has no attribute 'entry_point'

I am trying to install CRMint following these instructions: https://google.github.io/crmint/docs/quickstart/cloudshell.md
When I tried to run to check if I have installed it
crmint --help
The following error appeared
Traceback (most recent call last):
File "/home/user/crmint/.venv/bin/crmint", line 33, in <module>
sys.exit(load_entry_point('crmint', 'console_scripts', 'crmint')())
File "/home/user/crmint/.venv/bin/crmint", line 25, in importlib_load_entry_point
return next(matches).load()
File "/usr/lib/python3.9/importlib/metadata.py", line 79, in load
return functools.reduce(getattr, attrs, module)
AttributeError: module 'appcli' has no attribute 'entry_point'
Could someone help me on that? Thank you in advance.
I tried uninstalling and installing 'appcli', but it still didn't work.
This was around the same time that CRMint was upgraded to it's newest architecture, CRMint 3.0. This was a temporary bug that was impacting deployment, however, the current architecture deployment has been tested and should be working quiet reliably.
Sorry for the inconvenience. Let me know if you have other questions!

Django: "django.contrib.gis.gdal.prototypes.ds" crashes with "attributeerror: symbol not found"

Running the latest Django (3.0.4) I am now getting this:
File "[...]site-packages/django/contrib/gis/gdal/driver.py", line 5, in <module>
from django.contrib.gis.gdal.prototypes import ds as vcapi, raster as rcapi
File "[...]site-packages/django/contrib/gis/gdal/prototypes/ds.py", line 71, in <module>
get_field_as_integer64 = int64_output(lgdal.OGR_F_GetFieldAsInteger64, [c_void_p, c_int])
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ctypes/__init__.py", line 361, in __getattr__
func = self.__getitem__(name)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ctypes/__init__.py", line 366, in __getitem__
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: dlsym(0x101667060, OGR_F_GetFieldAsInteger64): symbol not found
My Observations:
I have [ellided] the path names which refer to Django in my virtual-environment. I observe that the module that is actually crashing is in /Library/Frameworks/Python.framework/ ... this on Macintosh OS/X Catalina.
The version of Python that is installed on this computer is 3.6.4. (The version on the hosting service is considerably older ... 3.4.)
Is this, as I suspect, a problem with the Python installation on this computer? (The most recent version that can be installed here is 3.7.7.)
EDIT: NO, it isn't!
After installing Django 3.0.4 on a Linux host I got this:
AttributeError: /usr/local/lib/libgdal.so.1: undefined symbol: OGR_F_GetFieldAsInteger64
Now, once again this is a system-wide library that's being called, but I now suspect that the root cause problem is actually in this line:
File "[...]/lib/python3.6/site-packages/django/contrib/gis/gdal/prototypes/ds.py", line 71, in <module>
get_field_as_integer64 = int64_output(lgdal.OGR_F_GetFieldAsInteger64, [c_void_p, c_int])
I am now rolling Django versions backward to see if I can make the problem go away and if so "answer my own question."
I had to walk back all the way to Django 2.1 before the problem finally went away.
libgdal version 1.6 is installed on this computer's virtual-environment and I don't know if it is practical nor possible for me to change it. ("gcc" is installed here, "configure" is not.)

trigger.io error building "No module named generate_dynamic"

I seem to have a strange error when trying to build my app
Couldn't import generation code: No module named generate_dynamic
What is strange about this error is that I can seem to resolve the error if I uninstall and re-install trigger.io but if I make any changes tot he config the error comes back and I have to uninstall and re-install each time I make a change to the configs. It never used to do this.
Traceback (most recent call last):
File "C:\Users\Michael\AppData\Local\Trigger Toolkit\build-tools\forge\async.py", line 106, in run
result = self._target(*self._args, **self._kwargs)
File "C:\Users\Michael\AppData\Local\Trigger Toolkit\trigger\api\app.py", line 290, in package
build(cookies, path, target)
File "C:\Users\Michael\AppData\Local\Trigger Toolkit\trigger\api\app.py", line 329, in build
forge_main.development_build([target, '--general.interactive', 'no'])
File "C:\Users\Michael\AppData\Local\Trigger Toolkit\build-tools\forge\main.py", line 335, in development_build
manager.fetch_instructions()
File "C:\Users\Michael\AppData\Local\Trigger Toolkit\build-tools\forge\templates.py", line 90, in fetch_instructions
import_generate_dynamic(do_reload=True)
File "C:\Users\Michael\AppData\Local\Trigger Toolkit\build-tools\forge\build.py", line 48, in import_generate_dynamic
raise ForgeError("Couldn't import generation code: {0}".format(e))
ForgeError: Couldn't import generation code: No module named generate_dynamic
That is the debug. Note sure what is going on.
Thanks.
So it looks like its not resolved, I tried to update a module and the whole thing blew up again. I sent the logs to support so we will see how long this will take.
* Edit *
I was able to resolve this by deleting the trigger.Io directory ( the uninstall does not do this ) then reinstalling and importing my project again. Not sure what happened but it's working now
I deleted the .tempalte folder and re-built. Looks like the content of that folder got jacked during a failed or canceled build.

libsvm in Python : getting error

I am new to Python. I wanted to use svm for my project. I was using libsvm 3.12 but when i do ..
from svm import *
then i get the following error :
Traceback (most recent call last):
File "C:/Python27/main.py", line 31, in
from svm import *
File "C:/Python27\svm.py", line 12, in
libsvm = CDLL(find_library('libsvm'))
File "C:\Python27\lib\ctypes\__init__.py", line 353, in __init__
self._handle = _dlopen(self._name, mode)
WindowsError: [Error 193] %1 is not a valid Win32 application
What should I do?
The libsvm README file suggested that I copy libsvm.dll into the system32 folder, which I did .. but still I am getting the error. I am using 64 bit Python. Maybe that is causing the problem?
I just had the same issue.
As Velociraptors posted in VLC Python Bindings -- Error 193:
I'm going to guess that the problem is trying to load a 32-bit DLL from a 64-bit process. You may be able to fix it by using a 32-bit Python build.
We solved the issue by downloading libSVM for python from http://www.lfd.uci.edu/~gohlke/pythonlibs/#libsvm

Weird behavior causes my runserver to not respond

I've been having some very weird problems. Yesterday I updated my master branch on a project and after that, when I tried to do manage.py runserver the runserver wouldn't serve any page. I had to ctrl + c to exit the server and I would later receive this message.
Exception happened during processing of request from ('127.0.0.1', 53975)
Unhandled exception in thread started by <function inner_run at 0x2ec8488>
Traceback (most recent call last):
File "/home/marco/virtualenvs/designersenv/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 60, in inner_run
run(addr, int(port), handler)
File "/home/marco/virtualenvs/designersenv/lib/python2.7/site-packages/django/core/servers/basehttp.py", line 721, in run
httpd.serve_forever()
File "/usr/lib/python2.7/SocketServer.py", line 227, in serve_forever
self._handle_request_noblock()
File "/usr/lib/python2.7/SocketServer.py", line 286, in _handle_request_noblock
self.handle_error(request, client_address)
File "/usr/lib/python2.7/SocketServer.py", line 342, in handle_error
import traceback
ImportError: No module named traceback
I found out by experimentation that erasing the database(sqlite) and recreating it with syncdb and migrate removed the issue, but once I add something to the models via the admin page, I would get the same error again, no pages would be served.
I also noticed that when this was going on, python starting to occupy around 40-60% of my CPU and RAM. I later noticed on the project folder, where database.db is located, a database.db-journal file would be created every 2-3 seconds, get deleted and then reappear. Googling didn't bring me any results so I am laying my hands on SO wisdom. Thanks.
I can see you are running in a virtual enviroment. It's possible that it became corrupted while downloading. I would recreate it from scratch.
Also, check in that enviroment shell if you can import traceback and check outside the enviroment too. It may give you some clues.
disclaimer: this answer is 90% intuition, sorry :/
A couple months late but anyway, here is what my problem was:
A django app was messing up and getting stuck in a bug. I believe it was Django Cache Bot.
Cheers.