django-rest-framework-docs icon indicating copy to clipboard operation
django-rest-framework-docs copied to clipboard

pip install fails with missing `setuptools.command` error

Open evandrone opened this issue 8 years ago • 12 comments

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!

evandrone avatar Jul 21 '16 18:07 evandrone

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

evandrone avatar Jul 21 '16 18:07 evandrone

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.

rohanza avatar Jul 25 '16 16:07 rohanza

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.

screen shot 2016-07-25 at 17 53 34 screen shot 2016-07-25 at 17 52 31 screen shot 2016-07-25 at 18 37 30

manosim avatar Jul 25 '16 16:07 manosim

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 "", line 1, in ImportError: No module named 'setuptools'

----------------------------------------

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.

rohanza avatar Jul 26 '16 08:07 rohanza

same error for me

hanfeisun avatar Oct 12 '16 00:10 hanfeisun

Same issue here.

LexFrench avatar Feb 10 '17 23:02 LexFrench

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/

caioariede avatar Feb 11 '17 02:02 caioariede

+1 for this issue. Have the same error on Docker Alpine Python 2.7

digitaldavenyc avatar Feb 27 '17 17:02 digitaldavenyc

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/

suriya avatar Mar 16 '17 06:03 suriya

same issue for me. cannot install versions after 0.0.9

taelimoh avatar May 17 '17 18:05 taelimoh

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'>
>>> 

bllli avatar Oct 24 '17 12:10 bllli

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

veryhappythings avatar Jan 18 '19 15:01 veryhappythings