Comments (5)
I suddenly started seeing this issue:
[ec2-user@ip-10-0-2-107 ~]$ sudo su
[root@ip-10-0-2-107 ec2-user]#
[root@ip-10-0-2-107 ec2-user]# source /opt/python/run/venv/bin/activate
(venv) [root@ip-10-0-2-107 ec2-user]#
(venv) [root@ip-10-0-2-107 ec2-user]#
(venv) [root@ip-10-0-2-107 ec2-user]# which python
/opt/python/run/venv/bin/python
(venv) [root@ip-10-0-2-107 ec2-user]# pip install MarkupSafe==1.0
Collecting MarkupSafe==1.0
Using cached MarkupSafe-1.0.tar.gz (14 kB)
ERROR: Command errored out with exit status 1:
command: /opt/python/run/venv/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-z0nif1it/MarkupSafe/setup.py'"'"'; __file__='"'"'/tmp/pip-install-z0nif1it/MarkupSafe/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-z0nif1it/MarkupSafe/pip-egg-info
cwd: /tmp/pip-install-z0nif1it/MarkupSafe/
Complete output (5 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-z0nif1it/MarkupSafe/setup.py", line 6, in <module>
from setuptools import setup, Extension, Feature
ImportError: cannot import name 'Feature'
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
from markupsafe.
#!/usr/bin/env python
import os
import re
import ast
import sys
from distutils.core import setup, Extension
from distutils.command.build_ext import build_ext
from distutils.errors import CCompilerError, DistutilsExecError, \
DistutilsPlatformError
# fail safe compilation shamelessly stolen from the simplejson
# setup.py file. Original author: Bob Ippolito
is_jython = 'java' in sys.platform
is_pypy = hasattr(sys, 'pypy_version_info')
with open('markupsafe/__init__.py') as f:
version = ast.literal_eval(re.search(
'^__version__\s+=\s+(.*?)$(?sm)', f.read()).group(1))
# Known errors when running build_ext.build_extension method
ext_errors = (CCompilerError, DistutilsExecError, DistutilsPlatformError)
if sys.platform == 'win32' and sys.version_info > (2, 6):
# 2.6's distutils.msvc9compiler can raise an IOError when failing to
# find the compiler
ext_errors += (IOError,)
# Known errors when running build_ext.run method
run_errors = (DistutilsPlatformError,)
if sys.platform == 'darwin':
run_errors += (SystemError,)
class BuildFailed(Exception):
pass
class ve_build_ext(build_ext):
"""This class allows C extension building to fail."""
def run(self):
try:
build_ext.run(self)
except run_errors:
raise BuildFailed()
def build_extension(self, ext):
try:
build_ext.build_extension(self, ext)
except ext_errors:
raise BuildFailed()
except ValueError:
# this can happen on Windows 64 bit, see Python issue 7511
if "'path'" in str(sys.exc_info()[1]): # works with Python 2 and 3
raise BuildFailed()
raise
def echo(msg=''):
sys.stdout.write(msg + '\n')
readme = open(os.path.join(os.path.dirname(__file__), 'README.rst')).read()
def run_setup(with_binary):
features = {}
setup(
name='MarkupSafe',
version=version,
url='http://github.com/pallets/markupsafe',
license='BSD',
author='Armin Ronacher',
author_email='[email protected]',
description='Implements a XML/HTML/XHTML Markup safe string for Python',
long_description=readme,
zip_safe=False,
classifiers=[
'Development Status :: 5 - Production/Stable',
'Environment :: Web Environment',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
'Topic :: Software Development :: Libraries :: Python Modules',
'Topic :: Text Processing :: Markup :: HTML'
],
packages=['markupsafe'],
test_suite='tests.suite',
include_package_data=True,
cmdclass={'build_ext': ve_build_ext},
features=features,
)
def try_building_extension():
try:
run_setup(True)
except BuildFailed:
LINE = '=' * 74
BUILD_EXT_WARNING = 'WARNING: The C extension could not be ' \
'compiled, speedups are not enabled.'
echo(LINE)
echo(BUILD_EXT_WARNING)
echo('Failure information, if any, is above.')
echo('Retrying the build without the C extension now.')
echo()
run_setup(False)
echo(LINE)
echo(BUILD_EXT_WARNING)
echo('Plain-Python installation succeeded.')
echo(LINE)
if not (is_pypy or is_jython):
try_building_extension()
else:
run_setup(False)
from markupsafe.
I cannot reproduce your issue. With python-setuptools
and python3-setuptools
, from setuptools import Feature
works. python-markupsafe
and python3-markupsafe
works. pip install markupsafe
in a virtualenv works.
I'm not sure where you got that code (or why you posted the whole thing), but the line from distutils.core import Feature
has never been in the code.
from markupsafe.
I suddenly started seeing this issue:
[ec2-user@ip-10-0-2-107 ~]$ sudo su [root@ip-10-0-2-107 ec2-user]# [root@ip-10-0-2-107 ec2-user]# source /opt/python/run/venv/bin/activate (venv) [root@ip-10-0-2-107 ec2-user]# (venv) [root@ip-10-0-2-107 ec2-user]# (venv) [root@ip-10-0-2-107 ec2-user]# which python /opt/python/run/venv/bin/python (venv) [root@ip-10-0-2-107 ec2-user]# pip install MarkupSafe==1.0 Collecting MarkupSafe==1.0 Using cached MarkupSafe-1.0.tar.gz (14 kB) ERROR: Command errored out with exit status 1: command: /opt/python/run/venv/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-z0nif1it/MarkupSafe/setup.py'"'"'; __file__='"'"'/tmp/pip-install-z0nif1it/MarkupSafe/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-z0nif1it/MarkupSafe/pip-egg-info cwd: /tmp/pip-install-z0nif1it/MarkupSafe/ Complete output (5 lines): Traceback (most recent call last): File "<string>", line 1, in <module> File "/tmp/pip-install-z0nif1it/MarkupSafe/setup.py", line 6, in <module> from setuptools import setup, Extension, Feature ImportError: cannot import name 'Feature' ---------------------------------------- ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
Looks like it's a problem in latest 'setuptools' release:
https://github.com/pypa/setuptools/blob/master/CHANGES.rst
It's necessary to slightly downgrade 'setuptools' installation, or update markup at least 1.1.0 version
from markupsafe.
For those finding this issue again, setuptools finally removed some deprecated code.
This had been fixed since MarkupSafe 0.19, but for some reason a revert to that fix made it into 1.0 (d2001bb), then was removed again in 1.1. Upgrade to the latest MarkupSafe, which at this time is 1.1.1.
from markupsafe.
Related Issues (20)
- ImportError: cannot import 'soft_unicode' from 'markupsafe' 2.1.0 HOT 1
- No module named 'markupsafe' when installing MarkupSafe >= 2.1.0 HOT 2
- Unable to import 'soft_unicode' from 'MarkUpSafe' HOT 3
- start using semver, again one of those dummies talking in miles and fahrenheit not using semver HOT 2
- Unable to install under git bash HOT 2
- Build Error HOT 3
- Removal of soft_unicode has broken many packages HOT 2
- `striptags` doesn't remove tags containing newlines HOT 1
- Python.h no such file or directory HOT 1
- s390x support
- Wheel for Python 3.11 HOT 4
- release 2.1.2 HOT 1
- DEPRECATION: MarkupSafe is being installed using the legacy 'setup.py install' method HOT 1
- Imports from _speedups have side effects HOT 1
- Unable to upgrade Markupsafe due to dependency with Werkzeug and Jinja2, best possible combination only possible with earlier versions HOT 7
- Return type for methods covered by `_simple_escaping_wrapper` is wrong HOT 1
- Missing override to `format_map` HOT 3
- pin markupsafe==2.0.1 HOT 1
- Python 3.12 manylinux wheels HOT 4
- str method argument escaping is inconsistent HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from markupsafe.