Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MarkupSafe won't install in virtualenv on Amazon Linux

I find that MarkupSafe installs fine in the main machine environment, but in a virtualenv, pip silently fails.

[user@host ~]$ virtualenv testenv
New python executable in testenv/bin/python2.7
Also creating executable in testenv/bin/python
Installing setuptools, pip...done.
[user@host ~]$ \. testenv/bin/activate
(testenv)[user@host ~]$ pip install
You are using pip version 6.0.8, however version 7.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
You must give at least one requirement to install (see "pip help install")
(testenv)[user@host ~]$ pip install --upgrade pip
You are using pip version 6.0.8, however version 7.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting pip from https://pypi.python.org/packages/py2.py3/p/pip/pip-7.1.2-py2.py3-none-any.whl#md5=5ff9fec0be479e4e36df467556deed4d
  Using cached pip-7.1.2-py2.py3-none-any.whl
Installing collected packages: pip
  Found existing installation: pip 6.0.8
    Uninstalling pip-6.0.8:
      Successfully uninstalled pip-6.0.8

Successfully installed pip-7.1.2
(testenv)[user@host ~]$ pip install pip
Requirement already satisfied (use --upgrade to upgrade): pip in ./testenv/lib/python2.7/dist-packages
(testenv)[user@host ~]$ pip install markupsafe
Collecting markupsafe
  Using cached MarkupSafe-0.23.tar.gz
Installing collected packages: markupsafe
  Running setup.py install for markupsafe
Successfully installed markupsafe
(testenv)[user@host ~]$ pip install markupsafe
Collecting markupsafe
  Using cached MarkupSafe-0.23.tar.gz
Installing collected packages: markupsafe
  Running setup.py install for markupsafe
Successfully installed markupsafe
(testenv)[user@host ~]$ which python
~/testenv/bin/python
(testenv)[user@host ~]$ python
Python 2.7.10 (default, Dec  8 2015, 18:25:23)
[GCC 4.8.3 20140911 (Red Hat 4.8.3-9)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import markupsafe
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named markupsafe
>>>
(testenv)[user@host ~]$ pip freeze
(testenv)[user@host ~]$

not sure what the next step is, or whose fault this might be. What's my next move?

added: also logged an issue against virtualenv: https://github.com/pypa/virtualenv/issues/836

like image 761
djsadinoff Avatar asked Sep 01 '25 16:09

djsadinoff


1 Answers

I had the same problem on amazon linux 2015.09 with twisted, it installed but then could not import zope.interface and twisted.internet modules. I have fixed it by upgrading systemwide virtualenv, ran as root:

yum remove python27-virtualenv
pip install virtualenv 

and recreated my virtualenv.

like image 126
Juraj Avatar answered Sep 04 '25 05:09

Juraj