Mayavi has stopped working, crashes Python Jupyter notebook - python

I had installed Mayavi package in Anaconda Python on my Windows 7 machine. It was working until today. Today, it has stopped working, and crashes my Python Jupyter notebook. For example, the following simple script causes "Python has stopped working" message and Python kernel death:
import numpy as np
import mayavi
from mayavi import mlab
x, y, z = np.ogrid[-10:10:20j, -10:10:20j, -10:10:20j]
s = np.sin(x*y*z)/(x*y*z)
sf = mlab.pipeline.scalar_field(s)
The versions of Anaconda, Python, and Mayavi are 4.1.1, 3.5.2, and 4.5. Additionally the versions of numpy, traits, and vtk (required packages for Mayavi) 1.11.1, 4.6, and 7.0.0. I tried updating Mayavi and all these packages, and that did not resolve the issue. Can someone please help?

Apparently the issue is that Mayavi display does not work over a remote desktop connection, which is what I was working through yesterday! I have not clue why, and am curious to know if someone has an answer. I'm logged into the machine directly today, and it works.

Related

How I do properly import serial data from arduino using pycharm

I am newbie in python.
After I installed python 3.8 latest version, libraries ...etc
Pycharm IDE, and for every time you create project you have to install packages so your code look nice with no red line under.
after I spent hours trying to find whats going on, Error, visual studio ++14 and not 15 or 19.
The code line, import serial doesn't seem recognized by pycharm or by python.
I have read many people having the same problem but few were successful to solve, other are still not.
My Problem is that I need to plot data from arduino using python over serial.
Anyone have an idea how to solve the import serial not working?
The code implemented:
import serial , error
import numpy as np package not found but managed to install it and have to install it again
import matplotlib.pyplot as plt
%matplotlib qt
ser = serial.Serial('COM4',9600) Syntax error
Just tried to install matplotlib package, I got this error
ModuleNotFoundError: No module named 'Cython'
An hour ago did work just fine downloading the package.
Any recommendation for another python IDE than pycharm ?
U can use anaconda navigator. It comes with many inbuilt libraries such as pandas numpy matlab etc according to me it is best to use anaconda navigator in which u can either use spyder ide or jyputer notebook do upvode if u found helpful

Matplotlib hangs during instantiation on Pixelbook

I am trying to set up a python3 development environment on my Pixelbook.
I enabled native linux app support on it by switching to developer branch, so now I have a working bash shell with apt.
I was able to install gvim and python3.5.3 and pip. I installed numpy, scipy, pandas and matplotlib fine. All the other packages work smoothly, and I can import matplotlib, but as soon as I try to call any method from matplotlib it hangs my shell and never returns.
Here is a simple scripts I use for testing:
import scipy as sp
import matplotlib.pylab as plt
t = sp.arange(0, 10, 1/100)
plt.plot(t, sp.sin(1.7 * 2 * sp.pi * t) + sp.sin(1.9 * 2 * sp.pi * t))
plt.show()
I try to run it like this, but it never returns and Ctrl+C doesn't help either:
Command output
I tried using a different backend like this:
import matplotlib
matplotlib.use("TkAgg")
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2TkAgg
It doesn't help either.
Some people suggest using matplotlib.ion(), but it didn't change anything either.
I found this thread where someone was also having a hard time using matplotlib on a pixelbook.
The solution proposed there was to install spyder, so I did, like this:
sudo pip3 install -U spyder
This didn't help either.
It seems to me that matplotlib cannot find the graphics back end on my machine. I am running crouton and as I mentioned before gvim installed just fine. This is after the google announcement of support of linux native apps on chromebooks, so I am not running in a VM, this is stock chrome os moved to dev branch and switched to enable linux.
I am wondering if I need additional X11 backend installed separately, but I checked google documentation for installing Android Studio on Pixelbook, and it didn't mention any additional graphics installations, just "enable linux and install the linux tgz package". I would really appreciate some pointers.

Python Mayavi In Virtual Environment

I am facing 2 issues while trying to use mayavi on Mac OS in virtual python environment.
Running Mayavi2 from command line throws following message only and does nothing else
"This program needs access to the screen. Please run with a
Framework build of python, and only when you are logged in
on the main display of your Mac."
executing from mayavi import mlab throws the same message as in 1.
Using from mayavi import mlab in eclipse ImportError: cannot import name mlab
After a great hassle I have managed to install mayavi but now I can't execute any of the sample codes involving mlab
vtk is installed. import mayavi has no problem, command line or Eclipse.
It seems you are using the python build provided by Apple in Mac OS. This is apparently not compatible. You should try to use one of the versions from python.org, which are framework builds. Please note that you will have to install your dependencies again.

ImportError: No module named 'matplotlib'

Brand new to Python (typically program in MSDN C#) and I'm trying to make use of the matplotlib to generate some graphics from .csv files
I've downloaded & installed Python as well as Anaconda onto my Windows 10 machine, the versions are Python 3.5.2 and Anaconda 4.1.1
I open up the Python "notepad" interface and do
import matplotlib.pyplot as plt
plt.plot([1,2,3],[3,2,1])
plt.show()
but when I run the code I get the error:
ImportError: No module named 'matplotlib'
I've looked at some other posts for this but they all seem to be in regard to Mac OSX or Linux. Some have pointed to multiple installs of matplotlib, but I haven't turned up such a situation so far. What might be causing this, or how can I troubleshoot it?
**Edit:
The path returned to me from the import sys recommended in the comments gave me this response
['C:\Users\a.watts.ISAM-NA\Desktop',
'C:\Users\a.watts.ISAM-NA\AppData\Local\Programs\Python\Python35-32\python35.zip',
'C:\Users\a.watts.ISAM-NA\AppData\Local\Programs\Python\Python35-32\DLLs',
'C:\Users\a.watts.ISAM-NA\AppData\Local\Programs\Python\Python35-32\lib',
'C:\Users\a.watts.ISAM-NA\AppData\Local\Programs\Python\Python35-32',
'C:\Users\a.watts.ISAM-NA\AppData\Local\Programs\Python\Python35-32\lib\site-packages',
'C:\Users\a.watts.ISAM-NA\AppData\Local\Programs\Python\Python35-32\lib\site-packages\setuptools-26.1.1-py3.5.egg']
You essentially have 2 versions of python on your system - the standard one you downloaded and the one that ships with Anaconda. When you are running code in the IDLE you are using the standard version (in C:\Users\a.watts.ISAM-NA\AppData\Local\Programs\Python\Python35-32\python.exe) where matplotlib isn't installed which is why you are getting the error.
You need to use the Anaconda version (C:\Users\a.watts.ISAM-NA\AppData\Local\continuum\anaconda3\python.exe) that comes with the scientific stuff already setup. It looks like your system is using this one from the cmd so if you run scripts from there it should use the Anaconda version. If you want to use something more interactive you can also use spyder - the Anaconda version of the IDLE - or run jupyter notebook from cmd to get a browser based platform for interactive development

Anaconda / IPython / matplotlib Issue

I've just completed the installation of Anaconda on my MacBook Pro (running OS X 10.10 Yosemite). I installed the recommended package, which includes Python 2.7.
The versions I have of the (I think) pertinent packages are:
Numpy: 1.9.0
Scipy: 0.14.0
IPython: 2.2.0
matplotlib: 1.4.0
I was following the instructions for testing the installation listed here:
https://python4astronomers.github.io/installation/python_install.html#test-the-installation
Everything was fine, except for running IPython with matplotlib integration. Based on the guide on that page (which do not tell you to explicitly import matplotlib), and on my limited knowledge of IPython, I was under the impression that invoking IPython with
ipython --matplotlib
would "automagically" import the matplotlib modules somehow.
However, when I typed the line below into the IPython interpreter session:
print(matplotlib.__version__)
an error message was displayed which indicated that matplotlib was unavailable:
NameError
Traceback (most recent call last)
<ipython-input-1-dc737d9da186> in <module>()
----> 1 print(matplotlib.__version__)
NameError: name 'matplotlib' is not defined
However, IPython does say this when it is invoked:
IPython 2.2.0 -- An enhanced Interactive Python.
...
Using matplotlib backend: MacOSX
I know that IPython develops at a rapid pace, so my question is:
Did I miss something in the installation process (although it was performed using the Anaconda pre-compiled binary installer), or has the was matplotlib integration is achieved with IPython changed, or could the set of instructions I followed for testing the installation be missing something? I checked that site for a way to contact those guys before coming here, but I could not find it.
I've been through period of extraordinary hair loss due to having pulled huge tufts of it out while trying to sort out $PATH issues with Python and related problems while using Python on OS X, so this time I went with Anaconda and am just trying to quash any problems that may arise before I further complicate the situation by installing other modules not included with Anaconda.
Thanks in advance!
All the --matplotlib option does is set IPython up to display images generated by matplotlib so they are not blocking. It doesn't import anything. You still have to import matplotlib manually.

Categories