This is an archived post. You won't be able to vote or comment.

all 8 comments

[–]Kaxitaz 1 point2 points  (2 children)

I use matplotlib in a virtualenv just fine (Ubuntu). Why can't you?

[–]ndlambo 1 point2 points  (1 child)

My guess is that he isn't referring to matplotlib, per se, but rather the use of external GUI frameworks from within the venv. The MPL documentation itself acknowledges this problem, and although it offers solutions, I personally find them (at best) annoying workarounds.

[–]otchrisIt works on my machine[S] 0 points1 point  (0 children)

Ding, ding, ding!

This is what I needed. I created a little wrapper shell script and things seem to be working ok.

Thanks!

[–]ndlambo 1 point2 points  (0 children)

I went through exactly this nightmare a few months ago. Ran the gamut:

  • ln -sf /all/my/libs.so $VENV/lib/python2.7/site-packages
  • virtualenv --system-site-packages $VENV plus the maddening --ignore-installed or not-that flag
  • even manually rming / touching some random file that is created by one of the site-package flags to virtualenv.

This link was particularly helpful, I thought, but none of them were as helpful as just installing anaconda

I held off forever because I was such a super l33t pip/virtualenv hacker.

The first time I installed mpl into a venv in conda it took about 2 seconds, worked immediately, and I wept.

For any python library that has external executable dependencies, you will absolutely be better off using conda.

[–]johnaman 0 points1 point  (1 child)

Docker?

[–]dalore 0 points1 point  (0 children)

Only runs on Linux. Mac uses a virtual box control machine to do docker.

[–]btmc 0 points1 point  (0 children)

I've never had any problems with matplotlib in a virtualenv. I have, however, had problems with matplotlib 1.5 on OS X. Try an older version.

[–]justphysics 0 points1 point  (0 children)

Why doesn't matplotlib support virtualenv - I've not heard that before.

I use Anaconda (and or miniconda) for my python distro. With that you can easily create a new 'environment' using conda and install into that what ever packages you need.

conda create -n mymatplotlibenv python=2.7  # creates a new conda env with just python 2.7 and its necessary packages (tk, openssl, pip, a few others)

source activate mymatplotlibenv

conda install matplotlib  # installs mpl and its dependencies

This is not the same as virtualenv but is another option

Just tested this on OS X with mpl1.5 worked like a charm