django-rest-framework-docs
django-rest-framework-docs copied to clipboard
pip install fails with missing `setuptools.command` error
I get the following stack trace trying to pip install or upgrate drfdocs, using Python 2.7, on both a mac running OS X 10.11.5 and a Ubuntu 14.04 machine.
[ubuntu@SEA] pip install --upgrade drfdocs
Downloading/unpacking drfdocs from https://pypi.python.org/packages/e5/9e/3a9aa6908ad7bd95b46f7fe05256681f4101de9a7769b6928159a986ef61/drfdocs-0.0.11.tar.gz#md5=ae42aba1e598ac110de74bdad0f3d3f4
Downloading drfdocs-0.0.11.tar.gz (771kB): 771kB downloaded
Running setup.py (path:<VIRTUAL_ENV_PATH>/build/drfdocs/setup.py) egg_info for package drfdocs
Traceback (most recent call last):
File "<string>", line 3, in <module>
ImportError: No module named setuptools.command
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 3, in <module>
ImportError: No module named setuptools.command
----------------------------------------
Cleaning up...
Both installs were done within virtualenvs with django1.9 installed. pip
versions were 1.5.4 & 1.5.6
I didn't find this behavior with any other pip modules. Don't know if it's something DrfDocs is doing in its setup or some other setup-related issue.
Cheers!
As a sidenote, got the same result with pip install drfdocs==0.0.10
, but successfully installed 0.0.09 with pip install drfdocs==0.0.09
I also experienced this on Python 3.5 on Ubuntu 16.04.
Seems like the error is caused by a site
package inside the latest dist on pypi. This clashes with a stdlib module (https://docs.python.org/3/library/site.html) and breaks the import path.
That's weird - I've just tried on a fresh virtual environment (both 3.5 & 2.7) and it works fine for me.
Update: Just tried on a fresh Ubuntu install (Python 2.7) and it worked there too.
Here is my output on a clean virtualenv:
rohan@uberbook:~$ mkvirtualenv drfdocs
Using base prefix '/home/rohan/.pyenv/versions/3.5.1'
New python executable in /home/rohan/venv/drfdocs/bin/python3.5
Also creating executable in /home/rohan/venv/drfdocs/bin/python
Installing setuptools, pip, wheel...done.
virtualenvwrapper.user_scripts creating /home/rohan/venv/drfdocs/bin/predeactivate
virtualenvwrapper.user_scripts creating /home/rohan/venv/drfdocs/bin/postdeactivate
virtualenvwrapper.user_scripts creating /home/rohan/venv/drfdocs/bin/preactivate
virtualenvwrapper.user_scripts creating /home/rohan/venv/drfdocs/bin/postactivate
virtualenvwrapper.user_scripts creating /home/rohan/venv/drfdocs/bin/get_env_details
(drfdocs) rohan@uberbook:~$ pip freeze
(drfdocs) rohan@uberbook:~$ pip list
pip (8.1.2)
setuptools (25.1.0)
wheel (0.29.0)
(drfdocs) rohan@uberbook:~$ pip install drfdocs
Collecting drfdocs
Using cached drfdocs-0.0.11.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-moeu5f0y/drfdocs/
UPDATE:
It installs fine when I remove the site
package/directory mentioned above after I manually extracted the dist (tar.gz file) and run python setup.py install
. It also works fine if I clone from github and build my own dist.
same error for me
Same issue here.
Same issue here. drfdocs==0.0.9 works, no luck with 0.0.10 or 0.0.11.
Already reinstalled everything and still have the issue.
☁ ph [master] ⚡ pip uninstall drfdocs -y > /dev/null; pip install drfdocs==0.0.9 --no-cache-dir
Collecting drfdocs==0.0.9
Downloading drfdocs-0.0.9.tar.gz (770kB)
100% |████████████████████████████████| 778kB 5.0MB/s
Installing collected packages: drfdocs
Running setup.py install for drfdocs ... done
Successfully installed drfdocs-0.0.9
☁ ph [master] ⚡ pip uninstall drfdocs -y > /dev/null; pip install drfdocs==0.0.10 --no-cache-dir
Collecting drfdocs==0.0.10
Downloading drfdocs-0.0.10.tar.gz (770kB)
100% |████████████████████████████████| 778kB 5.0MB/s
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named setuptools
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/l8/gl87lhfn54b62j4j31x62j0r0000gn/T/pip-build-asTlbg/drfdocs/
☁ ph [master] ⚡ pip uninstall drfdocs -y > /dev/null; pip install drfdocs==0.0.11 --no-cache-dir
Cannot uninstall requirement drfdocs, not installed
Collecting drfdocs==0.0.11
Downloading drfdocs-0.0.11.tar.gz (771kB)
100% |████████████████████████████████| 778kB 6.7MB/s
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named setuptools
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/l8/gl87lhfn54b62j4j31x62j0r0000gn/T/pip-build-SF7wDg/drfdocs/
☁ ph [master] ⚡
More info:
Running setup.py (path:/private/var/folders/l8/gl87lhfn54b62j4j31x62j0r0000gn/T/pip-build-WMU0qV/drfdocs/setup.py) egg_info for package drfdocs
Running command python setup.py egg_info
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named setuptools
Cleaning up...
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/l8/gl87lhfn54b62j4j31x62j0r0000gn/T/pip-build-WMU0qV/drfdocs/
Exception information:
Traceback (most recent call last):
File "/Users/caio/.pyenv/versions/2.7.12/envs/ph/lib/python2.7/site-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/Users/caio/.pyenv/versions/2.7.12/envs/ph/lib/python2.7/site-packages/pip/commands/install.py", line 324, in run
requirement_set.prepare_files(finder)
File "/Users/caio/.pyenv/versions/2.7.12/envs/ph/lib/python2.7/site-packages/pip/req/req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "/Users/caio/.pyenv/versions/2.7.12/envs/ph/lib/python2.7/site-packages/pip/req/req_set.py", line 634, in _prepare_file
abstract_dist.prep_for_dist()
File "/Users/caio/.pyenv/versions/2.7.12/envs/ph/lib/python2.7/site-packages/pip/req/req_set.py", line 129, in prep_for_dist
self.req_to_install.run_egg_info()
File "/Users/caio/.pyenv/versions/2.7.12/envs/ph/lib/python2.7/site-packages/pip/req/req_install.py", line 439, in run_egg_info
command_desc='python setup.py egg_info')
File "/Users/caio/.pyenv/versions/2.7.12/envs/ph/lib/python2.7/site-packages/pip/utils/__init__.py", line 707, in call_subprocess
% (command_desc, proc.returncode, cwd))
InstallationError: Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/l8/gl87lhfn54b62j4j31x62j0r0000gn/T/pip-build-WMU0qV/drfdocs/
+1 for this issue. Have the same error on Docker Alpine Python 2.7
I run into the same issue as well. This seems to depend on the Python environment being used.
On vanilla Ubuntu 16.04, I created a virtual environment using python3.5 -m venv env-dir
and I was able to install drfdocs
.
However, in a different Python environment setup using miniconda, I ran into the above mentioned error.
pip install drfdocs==0.0.11
Collecting drfdocs==0.0.11
Using cached drfdocs-0.0.11.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named 'setuptools'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-odatsxp2/drfdocs/
same issue for me. cannot install versions after 0.0.9
same error using Ubuntu14.04 with anaconda venv python version: Python 3.6.3 :: Anaconda, Inc. pip version: pip 9.0.1 from /home/bllli/venv/ikm/lib/python3.6/site-packages (python 3.6)
Collecting drfdocs
Using cached drfdocs-0.0.11.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'setuptools'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-ej4br7ae/drfdocs/
but I can import setuptools with python
Python 3.6.3 |Anaconda, Inc.| (default, Oct 13 2017, 12:02:49)
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import setuptools
>>> setuptools
<module 'setuptools' from '/home/bllli/venv/ikm/lib/python3.6/site-packages/setuptools/__init__.py'>
>>>
The reason this is happening for some people and not others, as far as I can tell, is that a fair number of people have $PYTHONPATH=.
set somewhere in their environments. I had this, and it didn't work - when I removed it, it worked. If you don't have it, the site
directory doesn't get used instead of the built in library. I think there's something on my system that sets this for me, because it was being set even when I removed it from my zshrc - perhaps a part of virtualenvwrapper?
As a quick fix, this should work:
unset PYTHONPATH
pip install drfdocs