pipenv problem getting MarkupSafe to automatically install as a dependency

Viewed 1227

I'm using @arocks DjangoPatternsBook and code.

I have the book and would like to follow along with the code, but I think I found a bug because it's failing for me right at the starting line on two different computers using different python environments, so I don't think it's my environment that's causing the problem.

From the book section Starting the project:

First, clone the example project from GitHub:

$ git clone https://github.com/DjangoPatternsBook/superbook2.git

Next, install pipenv system-wide [this is what I did, using brew on MacOS and using dnf on Fedora 32] or locally, but outside a virtualenv as recommended in pipenv installation documents. Alternatively, follow these commands [I did not do this]:

   $ pip install -U pip
   $ pip install pipenv

Now go to the project directory and install the dependencies:

   $ cd superbook2
   $ pipenv install --dev

This is where it fails for me with the message:

[pipenv.exceptions.InstallError]: ['Looking in indexes: https://pypi.python.org/simple', 'Collecting markupsafe==1.0', '  Using cached MarkupSafe-1.0.tar.gz (14 kB)']
[pipenv.exceptions.InstallError]: ['ERROR: Command errored out with exit status 1:', '     command: /home/alpha/.local/share/virtualenvs/superbook2-HNnQDu9M/bin/python3 -c \'import sys, setuptools, tokenize; sys.argv[0] = \'"\'"\'/tmp/pip-install-5kl59pd3/markupsafe/setup.py\'"\'"\'; __file__=\'"\'"\'/tmp/pip-install-5kl59pd3/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-pip-egg-info-bk6ldht4', '         cwd: /tmp/pip-install-5kl59pd3/markupsafe/', '    Complete output (5 lines):', '    Traceback (most recent call last):', '      File "<string>", line 1, in <module>', '      File "/tmp/pip-install-5kl59pd3/markupsafe/setup.py", line 6, in <module>', '        from setuptools import setup, Extension, Feature', "    ImportError: cannot import name 'Feature' from 'setuptools' (/home/alpha/.local/share/virtualenvs/superbook2-HNnQDu9M/lib/python3.8/site-packages/setuptools/__init__.py)", '    ----------------------------------------', 'ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.']
ERROR: ERROR: Package installation failed...

So on a newly installed Fedora 32 machine, I did only:

$ sudo dnf install git
$ sudo dnf install pipenv
$ git clone https://github.com/DjangoPatternsBook/superbook2.git
$ cd superbook2
$ pipenv install --dev

and I think this same (or similar) sequence of commands will fail similarly in other python environments.

Does anyone have any suggestions on how to work around this problem and move forward with the code examples in the book? I've already posted a new issue in the github repo for superbook2 although I suspect the problem lies outside the superbook2 code base because I see other similar issues unrelated to superbook2.

I'll gladly post output of pipenv --support if it would help. The two python environments were using versions 3.8.3 (Fedora) and 3.8.5 (MacOS).

0 Answers
Related