Closed cgoliver closed 7 years ago
Perhaps ipython
has already set the backend to use? I think can happen, for example, if you run %pylab
.
What does the ipython
start-up message say in regards to the backend?
Does this script work if you run it from the command line?
import matplotlib.pyplot as plt
plt.plot([1,2,3])
plt.show()
Python 3.5.2 |Continuum Analytics, Inc.| (default, Jul 2 2016, 17:52:12)
Type "copyright", "credits" or "license" for more information.
IPython 5.0.0 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
In [1]: %pylab
Using matplotlib backend: MacOSX
Populating the interactive namespace from numpy and matplotlib
In [2]: plt.plot([1, 2, 3])
Out[2]: [<matplotlib.lines.Line2D at 0x110c87dd8>]
If I run from the command line, also nothing happens. So it appears it's not using the iterm backend.
However in my ~/.bash_profile I have the following lines:
export PYTHONPATH=~/itermplot:$PYTHONPATH
export MPLBACKEND="module://itermplot"
export ITERMPLOT="rv"
And I have the itermplot/ directory in ~/
So I guess this is not successfully setting the backend?
Thanks for the help.
Yeah, the problem is the line: Using matplotlib backend: MacOSX
.
Don't use %pylab
and try pasting the above test script in ipython directly.
Btw, I've updated the installation instructions to use a setup.py
and pip
. This means you no longer have to set PYTHONPATH
as it will put it in your site-packages
directory.
Ok, I am trying to install with pip now but it seems to not be able to find the module..
(py35) carlosgonzalezoliver@sasja-air: ~> pip install git+https://github.com/daleroberts/itermplot.git
Collecting git+https://github.com/daleroberts/itermplot.git
Cloning https://github.com/daleroberts/itermplot.git to /private/var/folders/nm/q6jm6_sj1kj7ff1_vpz2r7740000gn/T/pip-nvwaj35l-build
Requirement already satisfied (use --upgrade to upgrade): itermplot==0.1 from git+https://github.com/daleroberts/itermplot.git in ./anaconda/envs/py35/lib/python3.5/site-packages
(py35) carlosgonzalezoliver@sasja-air: ~> python
Python 3.5.2 |Continuum Analytics, Inc.| (default, Jul 2 2016, 17:52:12)
Type "copyright", "credits" or "license" for more information.
IPython 5.0.0 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
In [1]: import itermplot
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-1-4f66c2c10566> in <module>()
----> 1 import itermplot
ImportError: No module named 'itermplot'
In [2]:
However, when I do conda list
I see itermplot 0.1 <pip>
.
Ok, I probably messed something up with setup.py. I'll need to investigate but currently I have a few errands to run... On Sat., 14 Jan. 2017 at 08:37, Carlos G. Oliver notifications@github.com wrote:
Ok, I am trying to install with pip now but it seems to not be able to find the module..
(py35) carlosgonzalezoliver@sasja-air: ~> pip install git+https://github.com/daleroberts/itermplot.git Collecting git+https://github.com/daleroberts/itermplot.git Cloning https://github.com/daleroberts/itermplot.git to /private/var/folders/nm/q6jm6_sj1kj7ff1_vpz2r7740000gn/T/pip-nvwaj35l-build Requirement already satisfied (use --upgrade to upgrade): itermplot==0.1 from git+https://github.com/daleroberts/itermplot.git in ./anaconda/envs/py35/lib/python3.5/site-packages (py35) carlosgonzalezoliver@sasja-air: ~> python Python 3.5.2 |Continuum Analytics, Inc.| (default, Jul 2 2016, 17:52:12) Type "copyright", "credits" or "license" for more information.
IPython 5.0.0 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.%quickref -> Quick reference.help -> Python's own help system.object? -> Details about 'object', use 'object??' for
extra details.
In [1]: import itermplot---------------------------------------------------------------------------ImportError Traceback (most recent call last)
in ()----> 1 import itermplot ImportError: No module named 'itermplot' In [2]:
However, when I do conda list I see itermplot 0.1
. — You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/daleroberts/itermplot/issues/5#issuecomment-272554457, or mute the thread https://github.com/notifications/unsubscribe-auth/AAjjJKnyplZ7QiBeSqSSRhoIxLb638KCks5rR-6VgaJpZM4LjS50 .
no worries, take your time. thanks again!
Hopefully this should all be fixed now @cgoliver. Try pip3 install -U itermplot
Hi! So I tried that and i'm still getting the same issue of nothing being displayed. Let me know if you want more info on my setup or if you have any more suggestions. Thanks!
Hi Carlos, could you try the latest version? pip install -U itermplot
On Tue, Jan 17, 2017 at 4:02 AM, Carlos G. Oliver notifications@github.com wrote:
Hi! So I tried that and i'm still getting the same issue of nothing being displayed. Let me know if you want more info on my setup or if you have any more suggestions. Thanks!
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/daleroberts/itermplot/issues/5#issuecomment-272915544, or mute the thread https://github.com/notifications/unsubscribe-auth/AAjjJEOtX0ieY_dRoqx5MwpDBXs_4UP1ks5rS6LDgaJpZM4LjS50 .
hello! just tried that and now I get this error lol..
In [1]: import matplotlib.pyplot as plt
/Users/carlosgonzalezoliver/anaconda/envs/py35/lib/python3.5/site-packages/matplotlib/font_manager.py:280: UserWarning: Matplotlib is building the font cache using fc-list. This may take a moment.
'Matplotlib is building the font cache using fc-list. '
In [2]: plt.plot([1, 2, 3])
Out[2]: [<matplotlib.lines.Line2D at 0x105ec7748>]
In [3]: plt.show()
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
<ipython-input-3-c4e69632d98a> in <module>()
----> 1 plt.show()
/Users/carlosgonzalezoliver/anaconda/envs/py35/lib/python3.5/site-packages/matplotlib/pyplot.py in show(*args, **kw)
251 """
252 global _show
--> 253 return _show(*args, **kw)
254
255
/Users/carlosgonzalezoliver/anaconda/envs/py35/lib/python3.5/site-packages/itermplot/__init__.py in show()
116 figmanager = Gcf.get_active()
117 if figmanager is not None:
--> 118 figmanager.show()
119 else:
120 for manager in Gcf.get_all_fig_managers():
/Users/carlosgonzalezoliver/anaconda/envs/py35/lib/python3.5/site-packages/itermplot/__init__.py in show(self)
208 data = io.BytesIO()
209 self.canvas.print_figure(data, facecolor='none',
--> 210 edgecolor='none', transparent=True)
211 if hasattr(data, 'getbuffer'):
212 imgcat(data.getbuffer())
/Users/carlosgonzalezoliver/anaconda/envs/py35/lib/python3.5/site-packages/matplotlib/backend_bases.py in print_figure(self, filename, dpi, facecolor, edgecolor, orientation, format, **kwargs)
2242 orientation=orientation,
2243 bbox_inches_restore=_bbox_inches_restore,
-> 2244 **kwargs)
2245 finally:
2246 if bbox_inches and restore_bbox:
/Users/carlosgonzalezoliver/anaconda/envs/py35/lib/python3.5/site-packages/itermplot/__init__.py in print_pdf(self, filename, **kwargs)
195
196 if 'rv' in os.getenv('ITERMPLOT', ''):
--> 197 self.reverse()
198
199 FigureCanvasPdf.print_pdf(self, filename, **kwargs)
/Users/carlosgonzalezoliver/anaconda/envs/py35/lib/python3.5/site-packages/itermplot/__init__.py in reverse(self, **kwargs)
170 for obj in self.figure.findobj():
171 if not obj in seen:
--> 172 modify(obj)
173 seen.add(obj)
174
/Users/carlosgonzalezoliver/anaconda/envs/py35/lib/python3.5/site-packages/itermplot/__init__.py in modify(c)
163 if not fcset:
164 c = obj.get_color()
--> 165 obj.set_color(revvideo(c))
166 except AttributeError as e:
167 pass
/Users/carlosgonzalezoliver/anaconda/envs/py35/lib/python3.5/site-packages/itermplot/__init__.py in revvideo(x)
61 return np.array([rev(el) for el in x])
62 else:
---> 63 return rev(x)
64
65 except ValueError:
/Users/carlosgonzalezoliver/anaconda/envs/py35/lib/python3.5/site-packages/itermplot/__init__.py in rev(c)
46 def rev(c):
47 if isinstance(c, str):
---> 48 c = COLORS[c]
49
50 if len(c) == 4:
KeyError: '#1f77b4'
In [4]:
Try now? :)
On Wed, Jan 18, 2017 at 2:47 AM, Carlos G. Oliver notifications@github.com wrote:
hello! just tried that and now I get this error lol..
In [1]: import matplotlib.pyplot as plt/Users/carlosgonzalezoliver/anaconda/envs/py35/lib/python3.5/site-packages/matplotlib/font_manager.py:280: UserWarning: Matplotlib is building the font cache using fc-list. This may take a moment. 'Matplotlib is building the font cache using fc-list. '
In [2]: plt.plot([1, 2, 3]) Out[2]: [<matplotlib.lines.Line2D at 0x105ec7748>]
In [3]: plt.show()---------------------------------------------------------------------------KeyError Traceback (most recent call last)
in ()----> 1 plt.show() /Users/carlosgonzalezoliver/anaconda/envs/py35/lib/python3.5/site-packages/matplotlib/pyplot.py in show(*args, *kw) 251 """ 252 global _show--> 253 return _show(args, kw) 254 255 /Users/carlosgonzalezoliver/anaconda/envs/py35/lib/python3.5/site-packages/itermplot/init.py in show() 116 figmanager = Gcf.get_active() 117 if figmanager is not None:--> 118 figmanager.show() 119 else: 120 for manager in Gcf.get_all_fig_managers():/Users/carlosgonzalezoliver/anaconda/envs/py35/lib/python3.5/site-packages/itermplot/init.py in show(self) 208 data = io.BytesIO() 209 self.canvas.print_figure(data, facecolor='none',--> 210 edgecolor='none', transparent=True) 211 if hasattr(data, 'getbuffer'): 212 imgcat(data.getbuffer())/Users/carlosgonzalezoliver/anaconda/envs/py35/lib/python3.5/site-packages/matplotlib/backend_bases.py in print_figure(self, filename, dpi, facecolor, edgecolor, orientation, format, kwargs) 2242 orientation=orientation, 2243 bbox_inches_restore=_bbox_inches_restore,-> 2244 kwargs) 2245 finally: 2246 if bbox_inches and restore_bbox:/Users/carlosgonzalezoliver/anaconda/envs/py35/lib/python3.5/site-packages/itermplot/init.py in print_pdf(self, filename, kwargs) 195 196 if 'rv' in os.getenv('ITERMPLOT', ''):--> 197 self.reverse() 198 199 FigureCanvasPdf.print_pdf(self, filename, kwargs)/Users/carlosgonzalezoliver/anaconda/envs/py35/lib/python3.5/site-packages/itermplot/init.py in reverse(self, kwargs) 170 for obj in self.figure.findobj(): 171 if not obj in seen:--> 172 modify(obj) 173 seen.add(obj) 174 /Users/carlosgonzalezoliver/anaconda/envs/py35/lib/python3.5/site-packages/itermplot/init.py in modify(c) 163 if not fcset: 164 c = obj.get_color()--> 165 obj.set_color(revvideo(c)) 166 except AttributeError as e: 167 pass/Users/carlosgonzalezoliver/anaconda/envs/py35/lib/python3.5/site-packages/itermplot/init.py in revvideo(x) 61 return np.array([rev(el) for el in x]) 62 else:---> 63 return rev(x) 64 65 except ValueError:/Users/carlosgonzalezoliver/anaconda/envs/py35/lib/python3.5/site-packages/itermplot/init.py in rev(c) 46 def rev(c): 47 if isinstance(c, str):---> 48 c = COLORS[c] 49 50 if len(c) == 4:KeyError: '#1f77b4'In [4]: — You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/daleroberts/itermplot/issues/5#issuecomment-273207143, or mute the thread https://github.com/notifications/unsubscribe-auth/AAjjJIWqxu7-_BQGglUYYiAkctG0_5fTks5rTOKrgaJpZM4LjS50 .
same error :(
Did you do an update? pip3 install -U itermplot
If it still doesn't work, could you send me a test script that causes this error? I am suspecting it had to do with a line where you set the color "# 1f77b4".
On Wed, Jan 18, 2017 at 8:50 AM, Carlos G. Oliver notifications@github.com wrote:
same error :(
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/daleroberts/itermplot/issues/5#issuecomment-273311384, or mute the thread https://github.com/notifications/unsubscribe-auth/AAjjJDW2GBQcsAIRK59dG7gUdyNsNnMyks5rTTfDgaJpZM4LjS50 .
hi! yep i did that and I even made a fresh environment with anaconda to make sure I wasn't changing something or some other module was changing something.
$ conda create --name fresh python=3.5
$ source activate fresh
$ pip install -U itermplot
Running interactively or from script yields the same error. Here is the script:
import matplotlib.pyplot as plt
plt.plot([1, 2, 3])
plt.show()
I just installed anaconda. It seems like they force the use of the Mac matplotlib backend... Not sure how to override this.
On Wed, Jan 18, 2017 at 9:41 AM, Carlos G. Oliver notifications@github.com wrote:
hi! yep i did that and I even made a fresh environment with anaconda to make sure I wasn't changing something or some other module was changing something.
$ conda create --name fresh python=3.5 $ source activate fresh $ pip install -U itermplot
Running interactively or from script yields the same error. Here is the script:
import matplotlib.pyplot as plt
plt.plot([1, 2, 3]) plt.show()
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/daleroberts/itermplot/issues/5#issuecomment-273324180, or mute the thread https://github.com/notifications/unsubscribe-auth/AAjjJArdmxkfNj8ZLyJw5fEKrBu-Ox8eks5rTUOvgaJpZM4LjS50 .
hmm okay i'll look into it
in the meantime I ran with non-anaconda python
carlosgonzalezoliver@wpa167102: Figures> /usr/local/Cellar/python3/3.6.0/bin/python3
Python 3.6.0 (default, Dec 24 2016, 08:01:42)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import itermplot
>>> import matplotlib.pyplot as plt
>>> plt.plot([1, 2, 3])
[<matplotlib.lines.Line2D object at 0x1103b1f98>]
>>> plt.plot()
[]
>>>
Hi Carlos, could you update pip3 install -U itermplot
and give it another
go following the testing instructions here:
https://github.com/daleroberts/itermplot#testing
On Wed, Jan 18, 2017 at 10:07 AM, Carlos G. Oliver <notifications@github.com
wrote:
hmm okay i'll look into it
in the meantime I ran with non-anaconda python
carlosgonzalezoliver@wpa167102: Figures> /usr/local/Cellar/python3/3.6.0/bin/python3 Python 3.6.0 (default, Dec 24 2016, 08:01:42) [GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin Type "help", "copyright", "credits" or "license" for more information.>>> import itermplot>>> import matplotlib.pyplot as plt>>> plt.plot([1, 2, 3]) [<matplotlib.lines.Line2D object at 0x1103b1f98>]>>> plt.plot() []>>>
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/daleroberts/itermplot/issues/5#issuecomment-273330320, or mute the thread https://github.com/notifications/unsubscribe-auth/AAjjJOwiI0xSA5phuu_DyUErj7qulPCNks5rTUnBgaJpZM4LjS50 .
Hello,
Thanks for sharing this tool.
I am running on MacOS 10.2 Sierra with anaconda python 3.5. I also have XQuartz installed.
I set the environment variables correctly and have the latest version of the script.
When I try to run test.py or a simple plot in ipython, i just get a blank space and no display.
I was wondering if you have any suggestions
Thanks!