These are chat archives for drvinceknight/agent-based-learn

2nd
Sep 2015
Vince Knight
@drvinceknight
Sep 02 2015 04:30 UTC
How strange....
My WiFi in the hotel isn't great but let me see if I can get one of the other developers to take a look.
Ah hold on, do you have matplotlib installed?
@cesaresparza open up a python prompt and run:
>>> import matplotlib
Vince Knight
@drvinceknight
Sep 02 2015 04:38 UTC
If that throws up an error then run pip install matplotlib, I would have thought that you have it installed but I can’t think what else it could be.
Keep an eye on here: https://gitter.im/Axelrod-Python/Axelrod That’s the gitter room for Axelrod, you can see there that I’ve just asked about your problem.
cesaresparza
@cesaresparza
Sep 02 2015 09:32 UTC
ok
I do think I have it, because I can do stackplots with ablearn
Vince Knight
@drvinceknight
Sep 02 2015 09:32 UTC
Is matplotlib installed?
Yeah...
I thought that...
but perhaps you have uninstalled it since or something...
cesaresparza
@cesaresparza
Sep 02 2015 09:36 UTC
yeah checked the matplotlib
PS C:\Python27\Scripts> .\pip install matplotlib --upgrade
Requirement already up-to-date: matplotlib in c:\python27\lib\site-packages\matplotlib-1.4.3-py2.7-win32.egg
Requirement already up-to-date: numpy>=1.6 in c:\python27\lib\site-packages (from matplotlib)
Requirement already up-to-date: six>=1.4 in c:\python27\lib\site-packages\six-1.9.0-py2.7.egg (from matplotlib)
Requirement already up-to-date: python-dateutil in c:\python27\lib\site-packages\python_dateutil-2.4.2-py2.7.egg (from m
atplotlib)
Requirement already up-to-date: pytz in c:\python27\lib\site-packages\pytz-2015.4-py2.7.egg (from matplotlib)
Requirement already up-to-date: pyparsing>=1.5.6 in c:\python27\lib\site-packages\pyparsing-2.0.3-py2.7-win32.egg (from
matplotlib)
its there
Vince Knight
@drvinceknight
Sep 02 2015 09:37 UTC
So open up python and type:
import matplotlib
import axelrod
strategies = [s() for s in axelrod.basic_strategies]
tournament = axelrod.Tournament(strategies)
results = tournament.play()
eco = axelrod.Ecosystem(results)
eco.reproduce(50) # Evolve the population over 50 time steps
plot = axelrod.Plot(results)
p = plot.stackplot(eco.population_sizes)
p.show()
Let me know what the output is.
cesaresparza
@cesaresparza
Sep 02 2015 09:37 UTC
import matplotlib
import axelrod
strategies = [s() for s in axelrod.basic_strategies]
tournament = axelrod.Tournament(strategies)
results = tournament.play()
eco = axelrod.Ecosystem(results)
eco.reproduce(50) # Evolve the population over 50 time steps
plot = axelrod.Plot(results)
p = plot.stackplot(eco.population_sizes)
p.show()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'NoneType' object has no attribute 'show'
Vince Knight
@drvinceknight
Sep 02 2015 09:37 UTC
lol...
cesaresparza
@cesaresparza
Sep 02 2015 09:38 UTC
its weird
Vince Knight
@drvinceknight
Sep 02 2015 09:38 UTC
Ok what happens when you just type plot?
cesaresparza
@cesaresparza
Sep 02 2015 09:38 UTC
maybe is my computer
Vince Knight
@drvinceknight
Sep 02 2015 09:38 UTC
Could be...
cesaresparza
@cesaresparza
Sep 02 2015 09:38 UTC

plot

<axelrod.plot.Plot object at 0x038A35B0>

Vince Knight
@drvinceknight
Sep 02 2015 09:38 UTC
Right...
Now type: plot.stackplot(eco.population_sizes)
cesaresparza
@cesaresparza
Sep 02 2015 09:39 UTC
dir(plot.stackplot)
['call', 'class', 'cmp', 'delattr', 'doc', 'format', 'func', 'get', 'getattribute',
'hash', 'init', 'new', 'reduce', 'reduce_ex', 'repr', 'self', 'setattr', 'sizeof', '
str', 'subclasshook', 'im_class', 'im_func', 'im_self']
Vince Knight
@drvinceknight
Sep 02 2015 09:39 UTC
What happens when you type: plot.stackplot(eco.population_sizes)
cesaresparza
@cesaresparza
Sep 02 2015 09:40 UTC
nothing
Vince Knight
@drvinceknight
Sep 02 2015 09:40 UTC
?
cesaresparza
@cesaresparza
Sep 02 2015 09:40 UTC
it takes me to the next line
Vince Knight
@drvinceknight
Sep 02 2015 09:40 UTC
That’s strange...
what about plot.boxplot()
@cesaresparza ?
cesaresparza
@cesaresparza
Sep 02 2015 09:42 UTC
same appears to do nothing
takes me to the next line
plot.boxplot()
well that doesnt show much
Vince Knight
@drvinceknight
Sep 02 2015 09:43 UTC
That’s really looking like you don’t have matplotlib installed...
You’ve definitely type import matplotlib there right?
try it again, import matplotlib...
cesaresparza
@cesaresparza
Sep 02 2015 09:43 UTC
ok
import matplotlib
import axelrod
strategies = [s() for s in axelrod.basic_strategies]
tournament = axelrod.Tournament(strategies)
results = tournament.play()
eco = axelrod.Ecosystem(results)
eco.reproduce(50) # Evolve the population over 50 time steps
plot = axelrod.Plot(results)
p = plot.stackplot(eco.population_sizes)
p.show()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'NoneType' object has no attribute 'show'
same
let me close it and open again the powershell
Vince Knight
@drvinceknight
Sep 02 2015 09:44 UTC
do import axelrod first and then import matplotlib
cesaresparza
@cesaresparza
Sep 02 2015 09:45 UTC
I just did that and get the same
import axelrod
import matplotlib
strategies = [s() for s in axelrod.basic_strategies]
tournament = axelrod.Tournament(strategies)
results = tournament.play()
eco = axelrod.Ecosystem(results)
eco.reproduce(50) # Evolve the population over 50 time steps
plot = axelrod.Plot(results)
p = plot.stackplot(eco.population_sizes)
p.show()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'NoneType' object has no attribute 'show'
Vince Knight
@drvinceknight
Sep 02 2015 09:49 UTC
Ok...
For some reason it doesn’t think that matplotlib is loading for you.
run:
import matplotlib.pyplot as plt
import matplotlib.transforms as transforms
from mpl_toolkits.axes_grid1 import make_axes_locatable
cesaresparza
@cesaresparza
Sep 02 2015 09:50 UTC
ok
Vince Knight
@drvinceknight
Sep 02 2015 09:50 UTC
All ok?
cesaresparza
@cesaresparza
Sep 02 2015 09:51 UTC
no
import matplotlib.pyplot as plt
import matplotlib.transforms as transforms
from mpl_toolkits.axes_grid1 import make_axes_locatable
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named mpl_toolkits.axes_grid1
Vince Knight
@drvinceknight
Sep 02 2015 09:51 UTC
Ahah :)
Ok, we’re getting somewhere :)
cesaresparza
@cesaresparza
Sep 02 2015 09:52 UTC
hahaha
Vince Knight
@drvinceknight
Sep 02 2015 09:52 UTC
Try: pip install mpl_toolkits
?
cesaresparza
@cesaresparza
Sep 02 2015 09:53 UTC
ill try
Vince Knight
@drvinceknight
Sep 02 2015 09:54 UTC
(Not in Python right, at the prompt.)
cesaresparza
@cesaresparza
Sep 02 2015 09:54 UTC
yes
PS C:\Python27\Scripts> .\pip install mpl_toolkits
Collecting mpl-toolkits
Could not find a version that satisfies the requirement mpl-toolkits (from versions: )
No matching distribution found for mpl-toolkits
Vince Knight
@drvinceknight
Sep 02 2015 09:58 UTC
Try again: just paste this pip install mpl_toolkits
cesaresparza
@cesaresparza
Sep 02 2015 10:00 UTC
yeah, I have to include the .\ at the beginning

pip : The term 'pip' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1

  • pip install mpl_toolkits
  • ~~~
    • CategoryInfo : ObjectNotFound: (pip:String) [], CommandNotFoundException
    • FullyQualifiedErrorId : CommandNotFoundException

Suggestion [3,General]: The command pip was not found, but does exist in the current location. Windows PowerShell does n
ot load commands from the current location by default. If you trust this command, instead type ".\pip". See "get-help ab
out_Command_Precedence" for more details.

Vince Knight
@drvinceknight
Sep 02 2015 10:02 UTC
Ok this is strange...
mpl_toolkits should be installed via matplotlib.
Run: matplotlib.__version__
cesaresparza
@cesaresparza
Sep 02 2015 10:04 UTC
in the prompt?
Vince Knight
@drvinceknight
Sep 02 2015 10:04 UTC
In the Python prompt:
import matplotlib
matplotlib.__version__
cesaresparza
@cesaresparza
Sep 02 2015 10:04 UTC
1.4.3
is the version
Vince Knight
@drvinceknight
Sep 02 2015 10:05 UTC
So weird...
import mpl_toolkits
cesaresparza
@cesaresparza
Sep 02 2015 10:05 UTC
import mpl_toolkits
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named mpl_toolkits
Vince Knight
@drvinceknight
Sep 02 2015 10:07 UTC
import numpy
cesaresparza
@cesaresparza
Sep 02 2015 10:07 UTC
I did numpy and it doesnt complain
Vince Knight
@drvinceknight
Sep 02 2015 10:08 UTC
How strange...
Ok so I think you’re going to need to basically code this yourself as your machine seems to have an issue with mpl_toolkits which is in fact only used for 1 very specific thing.
cesaresparza
@cesaresparza
Sep 02 2015 10:10 UTC
I will go to the labs and try in one of the computers
Vince Knight
@drvinceknight
Sep 02 2015 10:10 UTC
That won’t help, you don’t have rights to install anything there.
cesaresparza
@cesaresparza
Sep 02 2015 10:10 UTC
Oh
Vince Knight
@drvinceknight
Sep 02 2015 10:11 UTC
Do you have an account here: https://cloud.sagemath.com/
If not go set one up.
cesaresparza
@cesaresparza
Sep 02 2015 10:11 UTC
yes I have one
Vince Knight
@drvinceknight
Sep 02 2015 10:12 UTC
Ok, give me a second, I’m trying something.
cesaresparza
@cesaresparza
Sep 02 2015 10:12 UTC
I will ask a friend to lend me his computer he has a mac maybe it will work there
Vince Knight
@drvinceknight
Sep 02 2015 10:13 UTC
It should do yes.
wait a second though, let me try this one thing.
cesaresparza
@cesaresparza
Sep 02 2015 10:13 UTC
oh ok
Vince Knight
@drvinceknight
Sep 02 2015 10:17 UTC
Do you happen to know the name you’ve used for axelrod?
cesaresparza
@cesaresparza
Sep 02 2015 10:18 UTC
no
Vince Knight
@drvinceknight
Sep 02 2015 10:18 UTC
Sorry, I don’t mean axelrod, I mean cloud.sagemath?
I have found you.
Do you see axelrod?
cesaresparza
@cesaresparza
Sep 02 2015 10:20 UTC
I will log in
cesaresparza
@cesaresparza
Sep 02 2015 10:21 UTC
yes I can see it
Vince Knight
@drvinceknight
Sep 02 2015 10:22 UTC
Cool, click on the other link: should take you to an ipython notebook.
cesaresparza
@cesaresparza
Sep 02 2015 10:22 UTC
ok
Vince Knight
@drvinceknight
Sep 02 2015 10:24 UTC
That all working for you?
cesaresparza
@cesaresparza
Sep 02 2015 10:25 UTC
It does appear to work
Vince Knight
@drvinceknight
Sep 02 2015 10:26 UTC
Cool, did you see my p.savefig('figure.pdf’). If you go backk to where you can see your files that’s where it puts it.
That should take care of all your problems :)
cesaresparza
@cesaresparza
Sep 02 2015 10:30 UTC
ok
so that command does a pdf
nevermind I understand now :P
Thank you
this will help me a lot
thank you very much