pipenv: pip.exceptions.InstallationError: Command "python setup.py egg_info" failed with error code 1

Running pipenv --three is successful, but running pipenv install encounters this issue:

pip.exceptions.InstallationError: Command "python setup.py egg_info" failed with error code 1

Environment
  1. OS Type - macOS Sierra 10.12.6
  2. Python version: $ python -V results to Python 2.7.10
  3. Pipenv version: $ pipenv --version results to pipenv, version 9.0.0
  4. Python 3 is installed: $ python3 -V results to Python 3.6.3
  5. Current project’s virtualenv was initialized as a python 3 project $ pipenv --three
Expected result

Running pipenv install should install the dependencies mentioned in the Pipfile.

Actual result
darrenkarlsapalo@Darrens-MBP ~/g/thesis-nltk> pipenv install --verbose
Pipfile.lock not found, creating…
Locking [dev-packages] dependencies…
Locking [packages] dependencies…
Traceback (most recent call last):
  File "/usr/local/bin/pipenv", line 11, in <module>
    sys.exit(cli())
  File "/Library/Python/2.7/site-packages/pipenv/vendor/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/Library/Python/2.7/site-packages/pipenv/vendor/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/Library/Python/2.7/site-packages/pipenv/vendor/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Library/Python/2.7/site-packages/pipenv/vendor/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Library/Python/2.7/site-packages/pipenv/vendor/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/Library/Python/2.7/site-packages/pipenv/cli.py", line 1859, in install
    do_init(dev=dev, allow_global=system, ignore_pipfile=ignore_pipfile, system=system, skip_lock=skip_lock, verbose=verbose, concurrent=concurrent, deploy=deploy, pre=pre)
  File "/Library/Python/2.7/site-packages/pipenv/cli.py", line 1308, in do_init
    do_lock(system=system, pre=pre)
  File "/Library/Python/2.7/site-packages/pipenv/cli.py", line 1099, in do_lock
    pre=pre
  File "/Library/Python/2.7/site-packages/pipenv/utils.py", line 545, in resolve_deps
    resolved_tree = actually_resolve_reps(deps, index_lookup, markers_lookup, project, sources, verbose, clear, pre)
  File "/Library/Python/2.7/site-packages/pipenv/utils.py", line 507, in actually_resolve_reps
    resolved_tree.update(resolver.resolve(max_rounds=PIPENV_MAX_ROUNDS))
  File "/Library/Python/2.7/site-packages/pipenv/patched/piptools/resolver.py", line 102, in resolve
    has_changed, best_matches = self._resolve_one_round()
  File "/Library/Python/2.7/site-packages/pipenv/patched/piptools/resolver.py", line 200, in _resolve_one_round
    for dep in self._iter_dependencies(best_match):
  File "/Library/Python/2.7/site-packages/pipenv/patched/piptools/resolver.py", line 296, in _iter_dependencies
    dependencies = self.repository.get_dependencies(ireq)
  File "/Library/Python/2.7/site-packages/pipenv/patched/piptools/repositories/pypi.py", line 153, in get_dependencies
    result = reqset._prepare_file(self.finder, ireq)
  File "/Library/Python/2.7/site-packages/pipenv/patched/pip/req/req_set.py", line 639, in _prepare_file
    abstract_dist.prep_for_dist()
  File "/Library/Python/2.7/site-packages/pipenv/patched/pip/req/req_set.py", line 134, in prep_for_dist
    self.req_to_install.run_egg_info()
  File "/Library/Python/2.7/site-packages/pipenv/patched/pip/req/req_install.py", line 438, in run_egg_info
    command_desc='python setup.py egg_info')
  File "/Library/Python/2.7/site-packages/pipenv/patched/pip/utils/__init__.py", line 707, in call_subprocess
    % (command_desc, proc.returncode, cwd))
pip.exceptions.InstallationError: Command "python setup.py egg_info" failed with error code 1 in /var/folders/kg/mj08s20n06n21p8ln8108c2c0000gn/T/tmp6NVclhbuild/subprocess32/
Steps to replicate

Running pipenv install in the project directory.

Contents of Pipfile

[[source]]

url = "https://pypi.python.org/simple"
verify_ssl = true
name = "pypi"


[dev-packages]



[packages]

requests = "*"
nltk = "*"
matplotlib = "*"

My guess

I’m guessing that the complication might be caused by having two Python interpreters installed: Mac OS’ default python and the 3.6 that I installed. I’m just not sure how to fix this problem anymore because googling the problem didn’t result to any useful responses.

Similar search results based on error message

Some encounter problems while attempting to install a package (e.g. running pip install flask-mysql) but I have no problems running pip3 install requests nltk matplotlib.

Another similar result showed problems when it came to installing gitsome but again, my issue is running pipenv install.

Attempting to install them using pip install nltk matplotlib results to the following:

darrenkarlsapalo@Darrens-MBP ~/g/thesis-nltk> pip install nltk matplotlib
Requirement already satisfied: nltk in /Library/Python/2.7/site-packages
Requirement already satisfied: matplotlib in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python
Requirement already satisfied: six in /Library/Python/2.7/site-packages (from nltk)
Requirement already satisfied: numpy>=1.5 in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from matplotlib)
Requirement already satisfied: python-dateutil in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from matplotlib)
Collecting tornado (from matplotlib)
  Downloading tornado-4.5.2.tar.gz (483kB)
    100% |████████████████████████████████| 491kB 595kB/s 
Requirement already satisfied: pyparsing>=1.5.6 in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from matplotlib)
Collecting nose (from matplotlib)
  Downloading nose-1.3.7-py2-none-any.whl (154kB)
    100% |████████████████████████████████| 163kB 640kB/s 
Collecting singledispatch (from tornado->matplotlib)
  Downloading singledispatch-3.4.0.3-py2.py3-none-any.whl
Requirement already satisfied: certifi in /Library/Python/2.7/site-packages (from tornado->matplotlib)
Collecting backports_abc>=0.4 (from tornado->matplotlib)
  Downloading backports_abc-0.5-py2.py3-none-any.whl
Building wheels for collected packages: tornado
  Running setup.py bdist_wheel for tornado ... done
  Stored in directory: /Users/darrenkarlsapalo/Library/Caches/pip/wheels/b3/47/3a/96e12476829cb196adabc879fedb72f1bb2c8613b6961e78e7
Successfully built tornado
Installing collected packages: singledispatch, backports-abc, tornado, nose
Exception:
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/Library/Python/2.7/site-packages/pip/commands/install.py", line 342, in run
    prefix=options.prefix_path,
  File "/Library/Python/2.7/site-packages/pip/req/req_set.py", line 784, in install
    **kwargs
  File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 851, in install
    self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
  File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 1064, in move_wheel_files
    isolated=self.isolated,
  File "/Library/Python/2.7/site-packages/pip/wheel.py", line 377, in move_wheel_files
    clobber(source, dest, False, fixer=fixer, filter=filter)
  File "/Library/Python/2.7/site-packages/pip/wheel.py", line 316, in clobber
    ensure_dir(destdir)
  File "/Library/Python/2.7/site-packages/pip/utils/__init__.py", line 83, in ensure_dir
    os.makedirs(path)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 150, in makedirs
    makedirs(head, mode)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 157, in makedirs
    mkdir(name, mode)
OSError: [Errno 1] Operation not permitted: '/System/Library/Frameworks/Python.framework/Versions/2.7/man'

While running pip3 install requests nltk matplotlib has no problems.

darrenkarlsapalo@Darrens-MBP ~/g/thesis-nltk> pip3 install requests nltk matplotlib
Requirement already satisfied: requests in /usr/local/lib/python3.6/site-packages
Requirement already satisfied: nltk in /usr/local/lib/python3.6/site-packages
Requirement already satisfied: matplotlib in /usr/local/lib/python3.6/site-packages
Requirement already satisfied: idna<2.7,>=2.5 in /usr/local/lib/python3.6/site-packages (from requests)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /usr/local/lib/python3.6/site-packages (from requests)
Requirement already satisfied: urllib3<1.23,>=1.21.1 in /usr/local/lib/python3.6/site-packages (from requests)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.6/site-packages (from requests)
Requirement already satisfied: six in /usr/local/lib/python3.6/site-packages (from nltk)
Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.6/site-packages (from matplotlib)
Requirement already satisfied: python-dateutil>=2.0 in /usr/local/lib/python3.6/site-packages (from matplotlib)
Requirement already satisfied: numpy>=1.7.1 in /usr/local/lib/python3.6/site-packages (from matplotlib)
Requirement already satisfied: pytz in /usr/local/lib/python3.6/site-packages (from matplotlib)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /usr/local/lib/python3.6/site-packages (from matplotlib)

Please guide me on how I can help you help me. Thank you for your time.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 3
  • Comments: 18 (7 by maintainers)

Most upvoted comments

@darrensapalo do you have pipenv installed via homebrew? If not I would recommend you run pip uninstall pipenv and reinstall with pip3 install pipenv – since you mention installation works with python3, but your error message is related to using the pipenv dependency resolver (which by default runs using the python version which is used to install pipenv), this issue can possibly be resolved by simply using python 3 to install pipenv. Let me know if that helps!

@techalchemy while I agree that I never described what is broken, I thought I didn’t have to, since it’s exactly the same problem as the OP:


Adding -e . to Pipfile's [packages]…
Pipfile.lock not found, creating…
Locking [dev-packages] dependencies…
Locking [packages] dependencies…
ile "/Users/pcastro/Library/Python/3.6/lib/python/site-packages/pipenv/patched/piptools/repositories/pypi.py", line 202, in get_dependencies
    legacy_results = self.get_legacy_dependencies(ireq)
  File "/Users/pcastro/Library/Python/3.6/lib/python/site-packages/pipenv/patched/piptools/repositories/pypi.py", line 256, in get_legacy_dependencies
    result = reqset._prepare_file(self.finder, ireq, ignore_requires_python=True)
  File "/Users/pcastro/Library/Python/3.6/lib/python/site-packages/pipenv/patched/notpip/req/req_set.py", line 644, in _prepare_file
    abstract_dist.prep_for_dist()
  File "/Users/pcastro/Library/Python/3.6/lib/python/site-packages/pipenv/patched/notpip/req/req_set.py", line 134, in prep_for_dist
    self.req_to_install.run_egg_info()
  File "/Users/pcastro/Library/Python/3.6/lib/python/site-packages/pipenv/vendor/pip9/req/req_install.py", line 439, in run_egg_info
    command_desc='python setup.py egg_info')
  File "/Users/pcastro/Library/Python/3.6/lib/python/site-packages/pipenv/vendor/pip9/utils/__init__.py", line 707, in call_subprocess
    % (command_desc, proc.returncode, cwd))
pip9.exceptions.InstallationError: Command "python setup.py egg_info" failed with error code 1 in /var/folders/5t/30xrss395mdgjypy6_j53_sw0000gn/T/tmp51a0kpgbbuild/xgboost/

Do you still think that it’s worth a new issue?

@ksamuel sorry if I was unclear in my answer, we have had many issues related to this and I haven’t given a full and complete explanation of the inner workings of the code in each one. Virtualenv and pip both work just fine, neither of those two pieces of information are relevant here. Pipenv has a dependency resolver that generates Pipfile.lock, and that resolver runs on the python version with which you install pipenv. If that is different from the python version inside the virtualenv you are installing packages in, resolution may differ due to the highly varied and complex ways in which dependencies are resolved.

This has been an issue for quite some time and we have been playing whack-a-mole with it ever since the dependency resolver was introduced. The main issue we have tracking against this is #857 although it comes up in various other places, especially #1255

So there is no issue with virtualenv or pip calling setup.py, there is an issue with tricking the dependency resolver (which runs in pipenv which is not installed in the virtualenv) into resolving dependencies for a version of python besides the one which it is running on