pipenv install python-dotenv fails

Created on 3 Feb 2020  ·  8Comments  ·  Source: pypa/pipenv

I can run command below without errors:

pip install python-dotenv

But the command below here fails with the following exception:

pipenv install python-dotenv

It fails both on Windows and Ubuntu.

PS D:\Workspace\GitKraken\myproject> pipenv install python-dotenv
Installing python-dotenv…
Adding python-dotenv to Pipfile's [packages]…
Installation Succeeded
Pipfile.lock (d08e7f) out of date, updating to (d6c0c7)…
Locking [dev-packages] dependencies…
Locking [packages] dependencies…
Locking Failed!
Traceback (most recent call last):
  File "c:/users/tb/appdata/local/programs/python/python36/lib/site-packages/pipenv/resolver.py", line 126, in <module>
    main()
  File "c:/users/tb/appdata/local/programs/python/python36/lib/site-packages/pipenv/resolver.py", line 119, in main
    parsed.requirements_dir, parsed.packages)
  File "c:/users/tb/appdata/local/programs/python/python36/lib/site-packages/pipenv/resolver.py", line 85, in _main
    requirements_dir=requirements_dir,
  File "c:/users/tb/appdata/local/programs/python/python36/lib/site-packages/pipenv/resolver.py", line 69, in resolve
    req_dir=requirements_dir
  File "c:\users\tb\appdata\local\programs\python\python36\lib\site-packages\pipenv\utils.py", line 726, in resolve_deps
    req_dir=req_dir,
  File "c:\users\tb\appdata\local\programs\python\python36\lib\site-packages\pipenv\utils.py", line 480, in actually_resolve_deps
    resolved_tree = resolver.resolve()
  File "c:\users\tb\appdata\local\programs\python\python36\lib\site-packages\pipenv\utils.py", line 385, in resolve
    results = self.resolver.resolve(max_rounds=environments.PIPENV_MAX_ROUNDS)
  File "c:\users\tb\appdata\local\programs\python\python36\lib\site-packages\pipenv\patched\piptools\resolver.py", line 102, in resolve
    has_changed, best_matches = self._resolve_one_round()
  File "c:\users\tb\appdata\local\programs\python\python36\lib\site-packages\pipenv\patched\piptools\resolver.py", line 206, in _resolve_one_round
    for dep in self._iter_dependencies(best_match):
  File "c:\users\tb\appdata\local\programs\python\python36\lib\site-packages\pipenv\patched\piptools\resolver.py", line 301, in _iter_dependencies
    dependencies = self.repository.get_dependencies(ireq)
  File "c:\users\tb\appdata\local\programs\python\python36\lib\site-packages\pipenv\patched\piptools\repositories\pypi.py", line 234, in get_dependencies
    legacy_results = self.get_legacy_dependencies(ireq)
  File "c:\users\tb\appdata\local\programs\python\python36\lib\site-packages\pipenv\patched\piptools\repositories\pypi.py", line 426, in get_legacy_dependencies
    results, ireq = self.resolve_reqs(download_dir, ireq, wheel_cache)
  File "c:\users\tb\appdata\local\programs\python\python36\lib\site-packages\pipenv\patched\piptools\repositories\pypi.py", line 297, in resolve_reqs
    results = resolver._resolve_one(reqset, ireq)
  File "c:\users\tb\appdata\local\programs\python\python36\lib\site-packages\pipenv\patched\notpip\_internal\resolve.py", line 260, in _resolve_one
    abstract_dist = self._get_abstract_dist_for(req_to_install)
  File "c:\users\tb\appdata\local\programs\python\python36\lib\site-packages\pipenv\patched\notpip\_internal\resolve.py", line 213, in _get_abstract_dist_for
    self.require_hashes
  File "c:\users\tb\appdata\local\programs\python\python36\lib\site-packages\pipenv\patched\notpip\_internal\operations\prepare.py", line 294, in prepare_linked_requirement
    abstract_dist.prep_for_dist(finder, self.build_isolation)
  File "c:\users\tb\appdata\local\programs\python\python36\lib\site-packages\pipenv\patched\notpip\_internal\operations\prepare.py", line 127, in prep_for_dist
    self.req.run_egg_info()
  File "c:\users\tb\appdata\local\programs\python\python36\lib\site-packages\pipenv\patched\notpip\_internal\req\req_install.py", line 474, in run_egg_info
    command_desc='python setup.py egg_info')
  File "c:\users\tb\appdata\local\programs\python\python36\lib\site-packages\pipenv\patched\notpip\_internal\utils\misc.py", line 705, in call_subprocess
    % (command_desc, proc.returncode, cwd))
pipenv.patched.notpip._internal.exceptions.InstallationError: Command "python setup.py egg_info" failed with error code 1 in C:\Users\TB\AppData\Local\Temp\tmp_yfw20yxbuild\dotenv\
File "c:/users/tb/appdata/local/programs/python/python36/lib/site-packages/pipenv/resolver.py", line 126, in <module>
    main()
  File "c:/users/tb/appdata/local/programs/python/python36/lib/site-packages/pipenv/resolver.py", line 119, in main
    parsed.requirements_dir, parsed.packages)
  File "c:/users/tb/appdata/local/programs/python/python36/lib/site-packages/pipenv/resolver.py", line 85, in _main
    requirements_dir=requirements_dir,
  File "c:/users/tb/appdata/local/programs/python/python36/lib/site-packages/pipenv/resolver.py", line 69, in resolve
    req_dir=requirements_dir
  File "c:\users\tb\appdata\local\programs\python\python36\lib\site-packages\pipenv\utils.py", line 726, in resolve_deps
    req_dir=req_dir,
  File "c:\users\tb\appdata\local\programs\python\python36\lib\site-packages\pipenv\utils.py", line 480, in actually_resolve_deps
    resolved_tree = resolver.resolve()
  File "c:\users\tb\appdata\local\programs\python\python36\lib\site-packages\pipenv\utils.py", line 385, in resolve
    results = self.resolver.resolve(max_rounds=environments.PIPENV_MAX_ROUNDS)
  File "c:\users\tb\appdata\local\programs\python\python36\lib\site-packages\pipenv\patched\piptools\resolver.py", line 102, in resolve
    has_changed, best_matches = self._resolve_one_round()
  File "c:\users\tb\appdata\local\programs\python\python36\lib\site-packages\pipenv\patched\piptools\resolver.py", line 206, in _resolve_one_round
    for dep in self._iter_dependencies(best_match):
  File "c:\users\tb\appdata\local\programs\python\python36\lib\site-packages\pipenv\patched\piptools\resolver.py", line 301, in _iter_dependencies
    dependencies = self.repository.get_dependencies(ireq)
  File "c:\users\tb\appdata\local\programs\python\python36\lib\site-packages\pipenv\patched\piptools\repositories\pypi.py", line 234, in get_dependencies
    legacy_results = self.get_legacy_dependencies(ireq)
  File "c:\users\tb\appdata\local\programs\python\python36\lib\site-packages\pipenv\patched\piptools\repositories\pypi.py", line 426, in get_legacy_dependencies
    results, ireq = self.resolve_reqs(download_dir, ireq, wheel_cache)
  File "c:\users\tb\appdata\local\programs\python\python36\lib\site-packages\pipenv\patched\piptools\repositories\pypi.py", line 297, in resolve_reqs
    results = resolver._resolve_one(reqset, ireq)
  File "c:\users\tb\appdata\local\programs\python\python36\lib\site-packages\pipenv\patched\notpip\_internal\resolve.py", line 260, in _resolve_one
    abstract_dist = self._get_abstract_dist_for(req_to_install)
  File "c:\users\tb\appdata\local\programs\python\python36\lib\site-packages\pipenv\patched\notpip\_internal\resolve.py", line 213, in _get_abstract_dist_for
    self.require_hashes
  File "c:\users\tb\appdata\local\programs\python\python36\lib\site-packages\pipenv\patched\notpip\_internal\operations\prepare.py", line 294, in prepare_linked_requirement
    abstract_dist.prep_for_dist(finder, self.build_isolation)
  File "c:\users\tb\appdata\local\programs\python\python36\lib\site-packages\pipenv\patched\notpip\_internal\operations\prepare.py", line 127, in prep_for_dist
    self.req.run_egg_info()
  File "c:\users\tb\appdata\local\programs\python\python36\lib\site-packages\pipenv\patched\notpip\_internal\req\req_install.py", line 474, in run_egg_info
    command_desc='python setup.py egg_info')
  File "c:\users\tb\appdata\local\programs\python\python36\lib\site-packages\pipenv\patched\notpip\_internal\utils\misc.py", line 705, in call_subprocess
    % (command_desc, proc.returncode, cwd))
pipenv.patched.notpip._internal.exceptions.InstallationError: Command "python setup.py egg_info" failed with error code 1 in C:\Users\TB\AppData\Local\Temp\tmp_yfw20yxbuild\dotenv\
triage

Most helpful comment

@richiebful This is not a solution for everybody.
In my case i am using pyenv for virtual environment handling and pipenv only for the package management. In this scenario pipenv shell would create a new environment that doesn't meet my conventions.

_But back to topic:_
I had the same error because i made a mistake: i tried to install dotenv instead of python-dotenv.
I realized my error but dotenv was staying in the Pipfile and caused the error again and again until i found and removed it from Pipfile :-)

All 8 comments

At least in my Ubuntu environment, pipenv install python-dotenv was successful.
Please post more detailed information on the failure (OS, Python version, pipenv version, other package versions, etc.).

Thank you for reaching out my friend - but I install virtualenv instead + use pip freeze ... It solves all I need atm :)

Same here on macos..

I had success installing python-dotenv under Python 3.7.6 (via Homebrew) on macOS Catalina 10.15.3. @Garfield2013 what OS, Python, and pipenv versions are you running?


Logs...

user@host ~/Desktop/test $ pipenv install python-dotenv
Creating a virtualenv for this project…
Pipfile: /Users/user/Desktop/test/Pipfile
Using /usr/local/opt/python/bin/python3.7 (3.7.6) to create virtualenv…
Already using interpreter /usr/local/opt/python/bin/python3.7
Using base prefix '/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7'
New python executable in /Users/user/.local/share/virtualenvs/test-9tAJoEQ-/bin/python3.7
Also creating executable in /Users/user/.local/share/virtualenvs/test-9tAJoEQ-/bin/python
Installing setuptools, pip, wheel...
done.

Virtualenv location: /Users/user/.local/share/virtualenvs/test-9tAJoEQ-
Creating a Pipfile for this project…
Installing python-dotenv…
Adding python-dotenv to Pipfile's [packages]…
Pipfile.lock not found, creating…
Locking [dev-packages] dependencies…
Locking [packages] dependencies…
Updated Pipfile.lock (313b84)!
Installing dependencies from Pipfile.lock (313b84)…
  🐍   ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 1/1 — 00:00:00
To activate this project's virtualenv, run pipenv shell.
Alternatively, run a command inside the virtualenv with pipenv run.
user@host ~/Desktop/test $ pipenv --version
pipenv, version 2018.11.26
user@host ~/Desktop/test $ pipenv graph
python-dotenv==0.12.0

I ran pipenv install python-dotenv on my mac and received the same error. Running pip install python-dotenv within pipenv shell worked though.

I got same issue here is my stacktrace:
Locking [dev-packages] dependencies… ✘ Locking Failed! Traceback (most recent call last): File "/home/glyphack/.local/lib/python3.7/site-packages/pipenv/resolver.py", line 126, in <module> main() File "/home/glyphack/.local/lib/python3.7/site-packages/pipenv/resolver.py", line 119, in main parsed.requirements_dir, parsed.packages) File "/home/glyphack/.local/lib/python3.7/site-packages/pipenv/resolver.py", line 85, in _main requirements_dir=requirements_dir, File "/home/glyphack/.local/lib/python3.7/site-packages/pipenv/resolver.py", line 69, in resolve req_dir=requirements_dir File "/home/glyphack/.local/lib/python3.7/site-packages/pipenv/utils.py", line 726, in resolve_deps req_dir=req_dir, File "/home/glyphack/.local/lib/python3.7/site-packages/pipenv/utils.py", line 480, in actually_resolve_deps resolved_tree = resolver.resolve() File "/home/glyphack/.local/lib/python3.7/site-packages/pipenv/utils.py", line 385, in resolve results = self.resolver.resolve(max_rounds=environments.PIPENV_MAX_ROUNDS) File "/home/glyphack/.local/lib/python3.7/site-packages/pipenv/patched/piptools/resolver.py", line 102, in resolve has_changed, best_matches = self._resolve_one_round() File "/home/glyphack/.local/lib/python3.7/site-packages/pipenv/patched/piptools/resolver.py", line 206, in _resolve_one_round for dep in self._iter_dependencies(best_match): File "/home/glyphack/.local/lib/python3.7/site-packages/pipenv/patched/piptools/resolver.py", line 301, in _iter_dependencies dependencies = self.repository.get_dependencies(ireq) File "/home/glyphack/.local/lib/python3.7/site-packages/pipenv/patched/piptools/repositories/pypi.py", line 234, in get_dependencies legacy_results = self.get_legacy_dependencies(ireq) File "/home/glyphack/.local/lib/python3.7/site-packages/pipenv/patched/piptools/repositories/pypi.py", line 426, in get_legacy_dependencies results, ireq = self.resolve_reqs(download_dir, ireq, wheel_cache) File "/home/glyphack/.local/lib/python3.7/site-packages/pipenv/patched/piptools/repositories/pypi.py", line 297, in resolve_reqs results = resolver._resolve_one(reqset, ireq) File "/home/glyphack/.local/lib/python3.7/site-packages/pipenv/patched/notpip/_internal/resolve.py", line 260, in _resolve_one abstract_dist = self._get_abstract_dist_for(req_to_install) File "/home/glyphack/.local/lib/python3.7/site-packages/pipenv/patched/notpip/_internal/resolve.py", line 213, in _get_abstract_dist_for self.require_hashes File "/home/glyphack/.local/lib/python3.7/site-packages/pipenv/patched/notpip/_internal/operations/prepare.py", line 294, in prepare_linked_requirement abstract_dist.prep_for_dist(finder, self.build_isolation) File "/home/glyphack/.local/lib/python3.7/site-packages/pipenv/patched/notpip/_internal/operations/prepare.py", line 127, in prep_for_dist self.req.run_egg_info() File "/home/glyphack/.local/lib/python3.7/site-packages/pipenv/patched/notpip/_internal/req/req_install.py", line 474, in run_egg_info command_desc='python setup.py egg_info') File "/home/glyphack/.local/lib/python3.7/site-packages/pipenv/patched/notpip/_internal/utils/misc.py", line 705, in call_subprocess % (command_desc, proc.returncode, cwd)) pipenv.patched.notpip._internal.exceptions.InstallationError: Command "python setup.py egg_info" failed with error code 1 in /tmp/tmpfbwkyq2ebuild/dotenv/ File "/home/glyphack/.local/lib/python3.7/site-packages/pipenv/resolver.py", line 126, in <module> main() File "/home/glyphack/.local/lib/python3.7/site-packages/pipenv/resolver.py", line 119, in main parsed.requirements_dir, parsed.packages) File "/home/glyphack/.local/lib/python3.7/site-packages/pipenv/resolver.py", line 85, in _main requirements_dir=requirements_dir, File "/home/glyphack/.local/lib/python3.7/site-packages/pipenv/resolver.py", line 69, in resolve req_dir=requirements_dir File "/home/glyphack/.local/lib/python3.7/site-packages/pipenv/utils.py", line 726, in resolve_deps req_dir=req_dir, File "/home/glyphack/.local/lib/python3.7/site-packages/pipenv/utils.py", line 480, in actually_resolve_deps resolved_tree = resolver.resolve() File "/home/glyphack/.local/lib/python3.7/site-packages/pipenv/utils.py", line 385, in resolve results = self.resolver.resolve(max_rounds=environments.PIPENV_MAX_ROUNDS) File "/home/glyphack/.local/lib/python3.7/site-packages/pipenv/patched/piptools/resolver.py", line 102, in resolve has_changed, best_matches = self._resolve_one_round() File "/home/glyphack/.local/lib/python3.7/site-packages/pipenv/patched/piptools/resolver.py", line 206, in _resolve_one_round for dep in self._iter_dependencies(best_match): File "/home/glyphack/.local/lib/python3.7/site-packages/pipenv/patched/piptools/resolver.py", line 301, in _iter_dependencies dependencies = self.repository.get_dependencies(ireq) File "/home/glyphack/.local/lib/python3.7/site-packages/pipenv/patched/piptools/repositories/pypi.py", line 234, in get_dependencies legacy_results = self.get_legacy_dependencies(ireq) File "/home/glyphack/.local/lib/python3.7/site-packages/pipenv/patched/piptools/repositories/pypi.py", line 426, in get_legacy_dependencies results, ireq = self.resolve_reqs(download_dir, ireq, wheel_cache) File "/home/glyphack/.local/lib/python3.7/site-packages/pipenv/patched/piptools/repositories/pypi.py", line 297, in resolve_reqs results = resolver._resolve_one(reqset, ireq) File "/home/glyphack/.local/lib/python3.7/site-packages/pipenv/patched/notpip/_internal/resolve.py", line 260, in _resolve_one abstract_dist = self._get_abstract_dist_for(req_to_install) File "/home/glyphack/.local/lib/python3.7/site-packages/pipenv/patched/notpip/_internal/resolve.py", line 213, in _get_abstract_dist_for self.require_hashes File "/home/glyphack/.local/lib/python3.7/site-packages/pipenv/patched/notpip/_internal/operations/prepare.py", line 294, in prepare_linked_requirement abstract_dist.prep_for_dist(finder, self.build_isolation) File "/home/glyphack/.local/lib/python3.7/site-packages/pipenv/patched/notpip/_internal/operations/prepare.py", line 127, in prep_for_dist self.req.run_egg_info() File "/home/glyphack/.local/lib/python3.7/site-packages/pipenv/patched/notpip/_internal/req/req_install.py", line 474, in run_egg_info command_desc='python setup.py egg_info') File "/home/glyphack/.local/lib/python3.7/site-packages/pipenv/patched/notpip/_internal/utils/misc.py", line 705, in call_subprocess % (command_desc, proc.returncode, cwd)) pipenv.patched.notpip._internal.exceptions.InstallationError: Command "python setup.py egg_info" failed with error code 1 in /tmp/tmpfbwkyq2ebuild/dotenv/

I'm running pipenv on python 3.7 with pop_!os.
also pip install python-dotenv works fine.

Here's the resolution to the issue: https://pipenv.pypa.io/en/latest/advanced/#automatic-loading-of-env

Apparently pipenv run and pipenv shell will automatically load your .env environment variables if they are in the same directory as your Pipfile.

Continuing further in the docs:

If your .env file is located in a different path or has a different name you may set the PIPENV_DOTENV_LOCATION environment variable:

$ PIPENV_DOTENV_LOCATION=/path/to/.env pipenv shell

@richiebful This is not a solution for everybody.
In my case i am using pyenv for virtual environment handling and pipenv only for the package management. In this scenario pipenv shell would create a new environment that doesn't meet my conventions.

_But back to topic:_
I had the same error because i made a mistake: i tried to install dotenv instead of python-dotenv.
I realized my error but dotenv was staying in the Pipfile and caused the error again and again until i found and removed it from Pipfile :-)

Was this page helpful?
0 / 5 - 0 ratings