easy_install sandbox violation #1073

Closed
josef-pkt opened this Issue Sep 9, 2013 · 5 comments

Projects

None yet

4 participants

@josef-pkt
Member

from mailinglist

I tried to install install statsmodels Python library into a Fedora 19 system. I used easy_install as follows.

easy_install -U statsmodels

but I get the following error while installing. What wrong here?

error: SandboxViolation: os.open('/root/.matplotlib/tmpvjSAwn', 131266, 384) {}

The package setup script has attempted to modify files on your system
that are not within the EasyInstall build area, and has been aborted.

This package cannot be safely installed by EasyInstall, and may not
support alternate installation locations even if you run its setup
script by hand.  Please inform the package's author and the EasyInstall
maintainers to find out if a fix or workaround is available.

We saw an installation error with sandbox violation like this a while ago .
issues #617
I'm not sure what was going on, but there it was most likely an issue with an older
setuptools.

why easy_install would access .matplotlib this time?

My guess is that importing matplotlib checks for a writeable
.matplolib directory.

https://code.google.com/p/mplh5canvas/source/diff?spec=svn32&r=32&format=side&path=/trunk/setup.py&old_path=/trunk/setup.py&old=29

Looks like a workaround.

However, why do we (or whoever) import matplotlib when easy_installing
statsmodels.

my guess is it's in the imports in the version checks.
Does pandas import matplotlib right away, when doing import pandas?
if not, who else?

@josef-pkt
Member

pandas 0.11 imports matplotlib (it didn't do so in 0.7.3)

>>> import sys
>>> import numpy
>>> len(sys.modules)
240
>>> import pandas
E:\Josef\testing\tox\py27d\lib\site-packages\pytz-2012h-py2.7.egg\pytz\__init__.py:35: UserWarning: Module dateutil was already imported from E:\Josef\testing\tox\py27d\lib\site-packages\python_dateutil-2.1-py2.7.egg\dateutil\__init__.pyc, but e:\josef\testing\tox\py27d\lib\site-packages\matplotlib-1.2.1-py2.7-win32.egg is being added to sys.path
  from pkg_resources import resource_stream
E:\Josef\testing\tox\py27d\lib\site-packages\pytz-2012h-py2.7.egg\pytz\__init__.py:35: UserWarning: Module six was already imported from E:\Josef\testing\tox\py27d\lib\site-packages\six-1.2.0-py2.7.egg\six.pyc, but e:\josef\testing\tox\py27d\lib\site-packages\matplotlib-1.2.1-py2.7-win32.egg is being added to sys.path
  from pkg_resources import resource_stream
E:\Josef\testing\tox\py27d\lib\site-packages\pytz-2012h-py2.7.egg\pytz\__init__.py:35: UserWarning: Module pytz was already imported from E:\Josef\testing\tox\py27d\lib\site-packages\pytz-2012h-py2.7.egg\pytz\__init__.pyc, but e:\josef\testing\tox\py27d\lib\site-packages\matplotlib-1.2.1-py2.7-win32.egg is being added to sys.path
  from pkg_resources import resource_stream
>>> len([f for f in list(sys.modules) if 'matplot' in f])
44
>>> len(sys.modules)
610
>>> import patsy
>>> len(sys.modules)
644

and as extra, our heavy imports (continued from above)

>>> len([f for f in list(sys.modules) if 'scipy' in f])
1
>>> import statsmodels.api as sm
>>> len(sys.modules)
1441
>>> len([f for f in list(sys.modules) if 'scipy' in f])
290
>>> len([f for f in list(sys.modules) if 'statsmodels' in f])
368
@maheshakya

This is regarding the main issue discussed here.
As Skipper has suggested I've added the line

os.environ["MPLCONFIGDIR"] = "."

after import os
Then I got the following error when I called the
python setup.py install
from the statsmodels directory.

Traceback (most recent call last):
File "setup.py", line 465, in
check_dependency_versions(min_versions)
File "setup.py", line 124, in check_dependency_versions
raise ImportError("statsmodels requires patsy. http://patsy.readthedocs.org")

pasty was missing in the system. So only thing I had to do was installing pasty. using
easy_install --upgrade patsy

then I could install statsmodels from the source in the normal way.

@jseabold
Member

Merged in #1075.

@jseabold jseabold closed this Oct 23, 2013
@mikegoodspeed

Could we get a new release with this fix?

@jseabold
Member

Yes, will try to get one out soon. Currently accepting volunteers for release manager.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment