mayavi remotely running on Jupyter notebook - mayavi.mlab

I trying to run the following code in Jupyter Notebook. But it didn't work and throw out that the server is done.
I could import mayavi, but I could not 'from mayavi import malb'
%gui qt
from mayavi import mlab
import numpy as np
x, y, z = np.mgrid[-10:10:20j, -10:10:20j, -10:10:20j]
s = np.sin(xyz)/(xyz)
mlab.pipeline.volume(mlab.pipeline.scalar_field(x,y,z,s))
mlab.savefig('test')
The sever just shut down.

Related

Jupyter Notebook server crashes when calling pandas.DataFrame.style

My Jupyter Notebook server freezes when I call the style property of a large pandas DataFrame, as in this example:
import pandas as pd
import numpy as np
df = pd.DataFrame(np.random.randn(9999,3),columns=list("ABC"))
df.style
When I replace 9999 by 999 in the above code this issue doesn't occur. The same script also runs fine in the Anaconda prompt. What could be the cause of the freeze?

ImportError: cannot import name '_path'

i must install matplotlib on a offline PC with python 3.5....to run some scripts. I copy the lib to the Right path on the offline PC....all other lib like reportlab are running. But if i trie to write something with matplotlib.pyplot as plt i got the Error Message "ImportError:cannot Import 'path'".
a the first step i
Import matplotlib
matplotlib.use('aggs')
Import matplotlib.pyplot as plt
the biggest Problem i cant download something on this offline pc.
So i am rly new to write some codes with python so pls dont jugde me guys =)
So the frist step was delet the old libs and use older versions of matplotlib
actuel i use 3.0.2.
i copy the Folders matplotlib, matplotlib-3.0.2.dist-info and matplotlib-3.0.2-py3.5-nspkg.pth
import matplotlib
matplotlib.use('agg')
import matplotlib.pyplot as plt
fig = plt.figure(figsize=(9.5, 6), dpi=450)
ax = fig.gca()
ax.set_xticks(np.arange(tick_scale_x))
ax.set_yticks(np.arange(tick_scale_y))
plt.title(dia_title, fontsize=20, color='black')
plt.xlabel(axis_label_x)
plt.ylabel(axis_label_y)

How to run a specific code from Google Colaboratory in Jupyter Notebook?

I am currently doing a Tensorflow course on Udacity. The code is executed there in Google Colaboratory.
Now I tryed to run the code locally on Jupyter Notebook. By doing this I get an error message.
The code is:
from __future__ import absolute_import, division, print_function, unicode_literals
import os
import matplotlib.pyplot as plt
import numpy as np
import tensorflow as tf
from tensorflow.keras.preprocessing.image import ImageDataGenerator
import logging
logger = tf.get_logger()
logger.setLevel(logging.ERROR)
_URL = 'https://storage.googleapis.com/mledu-datasets/cats_and_dogs_filtered.zip'
zip_dir = tf.keras.utils.get_file('cats_and_dogs_filterted.zip', origin=_URL, extract=True)
zip_dir_base = os.path.dirname(zip_dir)
!find $zip_dir_base -type d -print
In Google Colaboratory it runs fine. On Jupyter Notebook I get after the last part the error message that it is the false date type.
What does the following line means?
!find $zip_dir_base -type d -print
What do I have to change to run it in Jupyter Notebook?
You can check out this code from deep learning with python book. its the same datasets but it runs locally.
https://github.com/fchollet/deep-learning-with-python-notebooks/blob/master/5.2-using-convnets-with-small-datasets.ipynb

Sympy doesn't print equations when using matplotlib in PyCharm

I recently started using Pycharm instead of Jupyter on my laptop to do some light scientific work(mainly because I like how it auto-completes the code).
this code works fine I Jupyter
import sympy as sp
import matplotlib.pyplot as plt
x = sp.symbols("x")
sp.Integral(x, x)
but when I run it in Pycharm, nothing happens and I don't get any output and I don't know why.

Jupyter notebook wont show image with matplotlib

I am trying to plot image using jupyter notebook.
import pylab as plt
import numpy as np
Z=np.array(((1,2,3,4,5),(4,5,6,7,8),(7,8,9,10,11)))
im = plt.imshow(Z, cmap='hot')
plt.colorbar(im, orientation='horizontal')
plt.show()
And I get some strange error.
When I ran same code in Pycharm, It worked but wont work in jupyter notebook.
.