Open freedom00y opened 4 years ago
I suspect this has to do with the version of matplotlib
Chimera itself ships, which will get loaded before the one in your conda
env.
This is not an easy problem to solve, but the quickest (and dirtiest) way to do it is to remove matplotlib
from UCSF Chimera. Since this will affect the extension inside Chimera, I would recommend having a separate installation (maybe the headless one?) that you can modify without fear. You can point to that separate installation for pychimera
using the CHIMERADIR
environment variable.
To uninstall libraries already present in Chimera, you need to install pip
first in Chimera, and then use that one to remove whatever you need. Let me know if you need help in this step.
So can I use the matplotlib package in Chimera?
In principle, yes. Try to follow the instructions above and let me know if it works for you!
A second alternative would be:
pychimera notebook
to generate all the numeric data you want to plot, but do not import matplotlib yet. Save the data to disk (via pickle
, numpy.save
, pandas.Dataframe.to_csv
, etc). Get rid of all chimera
objects so you can use the data without pychimera
!jupyter notebook
and load the data. You will be able to plot it with matplotlib just fine.
I tried to use the pychimera in the notebook. I tried to plot something inline using the command “%matplotlib inline”. When I run some code related with plots in “pychimera notebook”, it will show errors. But when I run the same code in “jupiter notebook”, it run successfully. I’d like to know how to solve this problem.
Here is my code and error message:
Code
from pychimera import enable_chimera, enable_chimera_inline, chimera_view enable_chimera() enable_chimera_inline() import chimera import numpy as np import matplotlib.pyplot as plt %matplotlib inline
a = np.arange(10) plt.hist(a) plt.show()
Error message
AttributeError Traceback (most recent call last)