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

2nd
Sep 2015
Vince Knight
@drvinceknight
Sep 02 2015 04:30
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
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
ok
I do think I have it, because I can do stackplots with ablearn
Vince Knight
@drvinceknight
Sep 02 2015 09:32
Is matplotlib installed?
Yeah...
I thought that...
but perhaps you have uninstalled it since or something...
cesaresparza
@cesaresparza
Sep 02 2015 09:36
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
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
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
lol...
cesaresparza
@cesaresparza
Sep 02 2015 09:38
its weird
Vince Knight
@drvinceknight
Sep 02 2015 09:38
Ok what happens when you just type plot?
cesaresparza
@cesaresparza
Sep 02 2015 09:38
maybe is my computer
Vince Knight
@drvinceknight
Sep 02 2015 09:38
Could be...
cesaresparza
@cesaresparza
Sep 02 2015 09:38

plot

<axelrod.plot.Plot object at 0x038A35B0>

Vince Knight
@drvinceknight
Sep 02 2015 09:38
Right...
Now type: plot.stackplot(eco.population_sizes)
cesaresparza
@cesaresparza
Sep 02 2015 09:39
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
What happens when you type: plot.stackplot(eco.population_sizes)
cesaresparza
@cesaresparza
Sep 02 2015 09:40
nothing
Vince Knight
@drvinceknight
Sep 02 2015 09:40
?
cesaresparza
@cesaresparza
Sep 02 2015 09:40
it takes me to the next line
Vince Knight
@drvinceknight
Sep 02 2015 09:40
That’s strange...
what about plot.boxplot()
@cesaresparza ?
cesaresparza
@cesaresparza
Sep 02 2015 09:42
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
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
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
do import axelrod first and then import matplotlib
cesaresparza
@cesaresparza
Sep 02 2015 09:45
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
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
ok
Vince Knight
@drvinceknight
Sep 02 2015 09:50
All ok?
cesaresparza
@cesaresparza
Sep 02 2015 09:51
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
Ahah :)
Ok, we’re getting somewhere :)
cesaresparza
@cesaresparza
Sep 02 2015 09:52
hahaha
Vince Knight
@drvinceknight
Sep 02 2015 09:52
Try: pip install mpl_toolkits
?
cesaresparza
@cesaresparza
Sep 02 2015 09:53
ill try
Vince Knight
@drvinceknight
Sep 02 2015 09:54
(Not in Python right, at the prompt.)
cesaresparza
@cesaresparza
Sep 02 2015 09:54
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
Try again: just paste this pip install mpl_toolkits
cesaresparza
@cesaresparza
Sep 02 2015 10:00
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
Ok this is strange...
mpl_toolkits should be installed via matplotlib.
Run: matplotlib.__version__
cesaresparza
@cesaresparza
Sep 02 2015 10:04
in the prompt?
Vince Knight
@drvinceknight
Sep 02 2015 10:04
In the Python prompt:
import matplotlib
matplotlib.__version__
cesaresparza
@cesaresparza
Sep 02 2015 10:04
1.4.3
is the version
Vince Knight
@drvinceknight
Sep 02 2015 10:05
So weird...
import mpl_toolkits
cesaresparza
@cesaresparza
Sep 02 2015 10:05
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
import numpy
cesaresparza
@cesaresparza
Sep 02 2015 10:07
I did numpy and it doesnt complain
Vince Knight
@drvinceknight
Sep 02 2015 10:08
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
I will go to the labs and try in one of the computers
Vince Knight
@drvinceknight
Sep 02 2015 10:10
That won’t help, you don’t have rights to install anything there.
cesaresparza
@cesaresparza
Sep 02 2015 10:10
Oh
Vince Knight
@drvinceknight
Sep 02 2015 10:11
Do you have an account here: https://cloud.sagemath.com/
If not go set one up.
cesaresparza
@cesaresparza
Sep 02 2015 10:11
yes I have one
Vince Knight
@drvinceknight
Sep 02 2015 10:12
Ok, give me a second, I’m trying something.
cesaresparza
@cesaresparza
Sep 02 2015 10:12
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
It should do yes.
wait a second though, let me try this one thing.
cesaresparza
@cesaresparza
Sep 02 2015 10:13
oh ok
Vince Knight
@drvinceknight
Sep 02 2015 10:17
Do you happen to know the name you’ve used for axelrod?
cesaresparza
@cesaresparza
Sep 02 2015 10:18
no
Vince Knight
@drvinceknight
Sep 02 2015 10:18
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
I will log in
cesaresparza
@cesaresparza
Sep 02 2015 10:21
yes I can see it
Vince Knight
@drvinceknight
Sep 02 2015 10:22
Cool, click on the other link: should take you to an ipython notebook.
cesaresparza
@cesaresparza
Sep 02 2015 10:22
ok
Vince Knight
@drvinceknight
Sep 02 2015 10:24
That all working for you?
cesaresparza
@cesaresparza
Sep 02 2015 10:25
It does appear to work
Vince Knight
@drvinceknight
Sep 02 2015 10:26
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
ok
so that command does a pdf
nevermind I understand now :P
Thank you
this will help me a lot
thank you very much