Build matplotlib dependencies for both python2 and python3

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP








up vote
1
down vote

favorite












I would like to have various virtual environments in my computer, some of them running python 2.7 and others with python3, and some of them must have full matplotlib support, which is achieved with --system-syte-packages when creating the virtual environment (see matplotlib faqs).



Therefore, I need to biuld the dependencies of matplotlib for both python versions. I started with:



sudo apt-get build-dep python-matplotlib


Which installed everything properly, and then I tried to run:



sudo apt-get build-dep python3-matplotlib


Which did nothing, it only printed the following messages:



Reading package lists... Done
Picking 'matplotlib' as source package instead of 'python3-matplotlib'
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 to upgrade, 0 to newly install, 0 to remove and 6 not to upgrade.


How can this be solved? Both a pip or apt-get related solutions are welcome.



EDIT:



I can install matplotlib in a python3 virtual environment without any problem, however, it does not support many of the backends. For instance:



>>> import matplotlib
>>> matplotlib.use('GTK')
>>> import matplotlib.pyplot as plt
Traceback (most recent call last):
File "/home/oriol/venvs/pic_python3.5/lib/python3.5/site-packages/matplotlib/backends/backend_gtk.py", line 17, in <module>
import gobject
ImportError: No module named 'gobject'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/oriol/venvs/pic_python3.5/lib/python3.5/site-packages/matplotlib/pyplot.py", line 115, in <module>
_backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
File "/home/oriol/venvs/pic_python3.5/lib/python3.5/site-packages/matplotlib/backends/__init__.py", line 62, in pylab_setup
[backend_name], 0)
File "/home/oriol/venvs/pic_python3.5/lib/python3.5/site-packages/matplotlib/backends/backend_gtk.py", line 21, in <module>
raise ImportError("Gtk* backend requires pygtk to be installed.")
ImportError: Gtk* backend requires pygtk to be installed.


Even though pip freeze inside the virtual environment includes pygobject==3.20.0. I thought that this pygobject may be the python2 one, however, the sys.path in the virtual environment is:



['', '/usr/lib/python35.zip', '/usr/lib/python3.5', '/usr/lib/python3.5/plat-x86_64-linux-gnu', '/usr/lib/python3.5/lib-dynload', '/home/oriol/venvs/pic_python3.5/lib/python3.5/site-packages', '/usr/local/lib/python3.5/dist-packages', '/usr/lib/python3/dist-packages']






share|improve this question






















  • what happens when you try to create a python3 virtualenv and install matplotlib there? could it be that it works (and you don't need any additional packages)?
    – d3vid
    May 10 at 12:23










  • do you know which 6 packages aren't upgraded (or is that unrelated)?
    – d3vid
    May 10 at 12:24










  • @d3vid I have updated the question to answer your first question. About the 2nd question, I have no idea what packages are this 6. How can I see them?
    – xg.plt.py
    May 10 at 15:32










  • this looks to me like matplotlib is installing correctly, and you have a different dependency issue - can you confirm it works with a simpler backend?
    – d3vid
    May 11 at 16:47










  • for GTK/pygobject you need a different dependency that hooks into your system-level gtk files from within the virtualenv - I'm afraid I don't recall the name right now
    – d3vid
    May 11 at 16:49














up vote
1
down vote

favorite












I would like to have various virtual environments in my computer, some of them running python 2.7 and others with python3, and some of them must have full matplotlib support, which is achieved with --system-syte-packages when creating the virtual environment (see matplotlib faqs).



Therefore, I need to biuld the dependencies of matplotlib for both python versions. I started with:



sudo apt-get build-dep python-matplotlib


Which installed everything properly, and then I tried to run:



sudo apt-get build-dep python3-matplotlib


Which did nothing, it only printed the following messages:



Reading package lists... Done
Picking 'matplotlib' as source package instead of 'python3-matplotlib'
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 to upgrade, 0 to newly install, 0 to remove and 6 not to upgrade.


How can this be solved? Both a pip or apt-get related solutions are welcome.



EDIT:



I can install matplotlib in a python3 virtual environment without any problem, however, it does not support many of the backends. For instance:



>>> import matplotlib
>>> matplotlib.use('GTK')
>>> import matplotlib.pyplot as plt
Traceback (most recent call last):
File "/home/oriol/venvs/pic_python3.5/lib/python3.5/site-packages/matplotlib/backends/backend_gtk.py", line 17, in <module>
import gobject
ImportError: No module named 'gobject'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/oriol/venvs/pic_python3.5/lib/python3.5/site-packages/matplotlib/pyplot.py", line 115, in <module>
_backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
File "/home/oriol/venvs/pic_python3.5/lib/python3.5/site-packages/matplotlib/backends/__init__.py", line 62, in pylab_setup
[backend_name], 0)
File "/home/oriol/venvs/pic_python3.5/lib/python3.5/site-packages/matplotlib/backends/backend_gtk.py", line 21, in <module>
raise ImportError("Gtk* backend requires pygtk to be installed.")
ImportError: Gtk* backend requires pygtk to be installed.


Even though pip freeze inside the virtual environment includes pygobject==3.20.0. I thought that this pygobject may be the python2 one, however, the sys.path in the virtual environment is:



['', '/usr/lib/python35.zip', '/usr/lib/python3.5', '/usr/lib/python3.5/plat-x86_64-linux-gnu', '/usr/lib/python3.5/lib-dynload', '/home/oriol/venvs/pic_python3.5/lib/python3.5/site-packages', '/usr/local/lib/python3.5/dist-packages', '/usr/lib/python3/dist-packages']






share|improve this question






















  • what happens when you try to create a python3 virtualenv and install matplotlib there? could it be that it works (and you don't need any additional packages)?
    – d3vid
    May 10 at 12:23










  • do you know which 6 packages aren't upgraded (or is that unrelated)?
    – d3vid
    May 10 at 12:24










  • @d3vid I have updated the question to answer your first question. About the 2nd question, I have no idea what packages are this 6. How can I see them?
    – xg.plt.py
    May 10 at 15:32










  • this looks to me like matplotlib is installing correctly, and you have a different dependency issue - can you confirm it works with a simpler backend?
    – d3vid
    May 11 at 16:47










  • for GTK/pygobject you need a different dependency that hooks into your system-level gtk files from within the virtualenv - I'm afraid I don't recall the name right now
    – d3vid
    May 11 at 16:49












up vote
1
down vote

favorite









up vote
1
down vote

favorite











I would like to have various virtual environments in my computer, some of them running python 2.7 and others with python3, and some of them must have full matplotlib support, which is achieved with --system-syte-packages when creating the virtual environment (see matplotlib faqs).



Therefore, I need to biuld the dependencies of matplotlib for both python versions. I started with:



sudo apt-get build-dep python-matplotlib


Which installed everything properly, and then I tried to run:



sudo apt-get build-dep python3-matplotlib


Which did nothing, it only printed the following messages:



Reading package lists... Done
Picking 'matplotlib' as source package instead of 'python3-matplotlib'
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 to upgrade, 0 to newly install, 0 to remove and 6 not to upgrade.


How can this be solved? Both a pip or apt-get related solutions are welcome.



EDIT:



I can install matplotlib in a python3 virtual environment without any problem, however, it does not support many of the backends. For instance:



>>> import matplotlib
>>> matplotlib.use('GTK')
>>> import matplotlib.pyplot as plt
Traceback (most recent call last):
File "/home/oriol/venvs/pic_python3.5/lib/python3.5/site-packages/matplotlib/backends/backend_gtk.py", line 17, in <module>
import gobject
ImportError: No module named 'gobject'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/oriol/venvs/pic_python3.5/lib/python3.5/site-packages/matplotlib/pyplot.py", line 115, in <module>
_backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
File "/home/oriol/venvs/pic_python3.5/lib/python3.5/site-packages/matplotlib/backends/__init__.py", line 62, in pylab_setup
[backend_name], 0)
File "/home/oriol/venvs/pic_python3.5/lib/python3.5/site-packages/matplotlib/backends/backend_gtk.py", line 21, in <module>
raise ImportError("Gtk* backend requires pygtk to be installed.")
ImportError: Gtk* backend requires pygtk to be installed.


Even though pip freeze inside the virtual environment includes pygobject==3.20.0. I thought that this pygobject may be the python2 one, however, the sys.path in the virtual environment is:



['', '/usr/lib/python35.zip', '/usr/lib/python3.5', '/usr/lib/python3.5/plat-x86_64-linux-gnu', '/usr/lib/python3.5/lib-dynload', '/home/oriol/venvs/pic_python3.5/lib/python3.5/site-packages', '/usr/local/lib/python3.5/dist-packages', '/usr/lib/python3/dist-packages']






share|improve this question














I would like to have various virtual environments in my computer, some of them running python 2.7 and others with python3, and some of them must have full matplotlib support, which is achieved with --system-syte-packages when creating the virtual environment (see matplotlib faqs).



Therefore, I need to biuld the dependencies of matplotlib for both python versions. I started with:



sudo apt-get build-dep python-matplotlib


Which installed everything properly, and then I tried to run:



sudo apt-get build-dep python3-matplotlib


Which did nothing, it only printed the following messages:



Reading package lists... Done
Picking 'matplotlib' as source package instead of 'python3-matplotlib'
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 to upgrade, 0 to newly install, 0 to remove and 6 not to upgrade.


How can this be solved? Both a pip or apt-get related solutions are welcome.



EDIT:



I can install matplotlib in a python3 virtual environment without any problem, however, it does not support many of the backends. For instance:



>>> import matplotlib
>>> matplotlib.use('GTK')
>>> import matplotlib.pyplot as plt
Traceback (most recent call last):
File "/home/oriol/venvs/pic_python3.5/lib/python3.5/site-packages/matplotlib/backends/backend_gtk.py", line 17, in <module>
import gobject
ImportError: No module named 'gobject'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/oriol/venvs/pic_python3.5/lib/python3.5/site-packages/matplotlib/pyplot.py", line 115, in <module>
_backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
File "/home/oriol/venvs/pic_python3.5/lib/python3.5/site-packages/matplotlib/backends/__init__.py", line 62, in pylab_setup
[backend_name], 0)
File "/home/oriol/venvs/pic_python3.5/lib/python3.5/site-packages/matplotlib/backends/backend_gtk.py", line 21, in <module>
raise ImportError("Gtk* backend requires pygtk to be installed.")
ImportError: Gtk* backend requires pygtk to be installed.


Even though pip freeze inside the virtual environment includes pygobject==3.20.0. I thought that this pygobject may be the python2 one, however, the sys.path in the virtual environment is:



['', '/usr/lib/python35.zip', '/usr/lib/python3.5', '/usr/lib/python3.5/plat-x86_64-linux-gnu', '/usr/lib/python3.5/lib-dynload', '/home/oriol/venvs/pic_python3.5/lib/python3.5/site-packages', '/usr/local/lib/python3.5/dist-packages', '/usr/lib/python3/dist-packages']








share|improve this question













share|improve this question




share|improve this question








edited May 10 at 15:31

























asked May 10 at 10:44









xg.plt.py

1065




1065











  • what happens when you try to create a python3 virtualenv and install matplotlib there? could it be that it works (and you don't need any additional packages)?
    – d3vid
    May 10 at 12:23










  • do you know which 6 packages aren't upgraded (or is that unrelated)?
    – d3vid
    May 10 at 12:24










  • @d3vid I have updated the question to answer your first question. About the 2nd question, I have no idea what packages are this 6. How can I see them?
    – xg.plt.py
    May 10 at 15:32










  • this looks to me like matplotlib is installing correctly, and you have a different dependency issue - can you confirm it works with a simpler backend?
    – d3vid
    May 11 at 16:47










  • for GTK/pygobject you need a different dependency that hooks into your system-level gtk files from within the virtualenv - I'm afraid I don't recall the name right now
    – d3vid
    May 11 at 16:49
















  • what happens when you try to create a python3 virtualenv and install matplotlib there? could it be that it works (and you don't need any additional packages)?
    – d3vid
    May 10 at 12:23










  • do you know which 6 packages aren't upgraded (or is that unrelated)?
    – d3vid
    May 10 at 12:24










  • @d3vid I have updated the question to answer your first question. About the 2nd question, I have no idea what packages are this 6. How can I see them?
    – xg.plt.py
    May 10 at 15:32










  • this looks to me like matplotlib is installing correctly, and you have a different dependency issue - can you confirm it works with a simpler backend?
    – d3vid
    May 11 at 16:47










  • for GTK/pygobject you need a different dependency that hooks into your system-level gtk files from within the virtualenv - I'm afraid I don't recall the name right now
    – d3vid
    May 11 at 16:49















what happens when you try to create a python3 virtualenv and install matplotlib there? could it be that it works (and you don't need any additional packages)?
– d3vid
May 10 at 12:23




what happens when you try to create a python3 virtualenv and install matplotlib there? could it be that it works (and you don't need any additional packages)?
– d3vid
May 10 at 12:23












do you know which 6 packages aren't upgraded (or is that unrelated)?
– d3vid
May 10 at 12:24




do you know which 6 packages aren't upgraded (or is that unrelated)?
– d3vid
May 10 at 12:24












@d3vid I have updated the question to answer your first question. About the 2nd question, I have no idea what packages are this 6. How can I see them?
– xg.plt.py
May 10 at 15:32




@d3vid I have updated the question to answer your first question. About the 2nd question, I have no idea what packages are this 6. How can I see them?
– xg.plt.py
May 10 at 15:32












this looks to me like matplotlib is installing correctly, and you have a different dependency issue - can you confirm it works with a simpler backend?
– d3vid
May 11 at 16:47




this looks to me like matplotlib is installing correctly, and you have a different dependency issue - can you confirm it works with a simpler backend?
– d3vid
May 11 at 16:47












for GTK/pygobject you need a different dependency that hooks into your system-level gtk files from within the virtualenv - I'm afraid I don't recall the name right now
– d3vid
May 11 at 16:49




for GTK/pygobject you need a different dependency that hooks into your system-level gtk files from within the virtualenv - I'm afraid I don't recall the name right now
– d3vid
May 11 at 16:49















active

oldest

votes











Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "89"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);








 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1034442%2fbuild-matplotlib-dependencies-for-both-python2-and-python3%23new-answer', 'question_page');

);

Post as a guest



































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes










 

draft saved


draft discarded


























 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1034442%2fbuild-matplotlib-dependencies-for-both-python2-and-python3%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

pylint3 and pip3 broken

Missing snmpget and snmpwalk

How to enroll fingerprints to Ubuntu 17.10 with VFS491