question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

pipenv with production-only dependencies

See original GitHub issue

Similar to issue #2729, I am also using tensorflow. Unfortunately, my dev and prod setups both run linux and are separated effectively only by the presence of GPUs. Having read PEP 508, I don’t believe there is enough information in the markers language to distinguish these systems. Is there some other way that future versions of pipenv can select dependencies? Perhaps through a prod-only section, or similar.

e.g.

...
[packages]
foo = "*"

[prod-packages]
tensorflow-gpu = "*"

[dev-packages]
tensorflow = "*"
...

where [prod-packages] are only installed if --dev is missing?

_Originally posted by @dmillard in https://github.com/pypa/pipenv/issues/2729#issuecomment-426514834_

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
frostmingcommented, Aug 15, 2019

@michael-angelozzi Write your Pipfile as below:

# ...
uwsgi = {version="*", sys_platform="!='win32'"}

Then uwsgi will be skipped on Windows

1reaction
mangelozzicommented, Aug 15, 2019

I have a use case where the production setup uses uwsgi, which is not available for windows (my dev setup). Every time I install a new package on my dev machine I get this error because uwsgi is not available for windows:

pipenv install django-debug-toolbar --dev --skip-lock
Installing django-debug-toolbar…
Adding django-debug-toolbar to Pipfile's [dev-packages]…
Installation Succeeded
Installing dependencies from Pipfile…

An error occurred while installing uwsgi! Will try again.
  ================================ 14/14 - 00:00:08
Installing initially failed dependencies…
[pipenv.exceptions.InstallError]:   File "c:\users\michael\appdata\local\programs\python\python37\lib\site-packages\pipenv\core.py", line 1992, in do_install
[pipenv.exceptions.InstallError]:       skip_lock=skip_lock,
[pipenv.exceptions.InstallError]:   File "c:\users\michael\appdata\local\programs\python\python37\lib\site-packages\pipenv\core.py", line 1253, in do_init
[pipenv.exceptions.InstallError]:       pypi_mirror=pypi_mirror,
[pipenv.exceptions.InstallError]:   File "c:\users\michael\appdata\local\programs\python\python37\lib\site-packages\pipenv\core.py", line 859, in do_install_dependencies
[pipenv.exceptions.InstallError]:       retry_list, procs, failed_deps_queue, requirements_dir, **install_kwargs
[pipenv.exceptions.InstallError]:   File "c:\users\michael\appdata\local\programs\python\python37\lib\site-packages\pipenv\core.py", line 763, in batch_install
[pipenv.exceptions.InstallError]:       _cleanup_procs(procs, not blocking, failed_deps_queue, retry=retry)
[pipenv.exceptions.InstallError]:   File "c:\users\michael\appdata\local\programs\python\python37\lib\site-packages\pipenv\core.py", line 681, in _cleanup_procs
[pipenv.exceptions.InstallError]:       raise exceptions.InstallError(c.dep.name, extra=err_lines)
[pipenv.exceptions.InstallError]: ['Collecting uwsgi', '  Using cached https://files.pythonhosted.org/packages/e7/1e/3dcca007f974fe4eb369bf1b8629d5e342bb3055e2001b2e5340aaefae7a/uwsgi-2.0.18.tar.gz']
[pipenv.exceptions.InstallError]: ['ERROR: Command errored out with exit status 1:', '     command: \'c:\\users\\michael\\.virtualenvs\\project-cdrggqjy\\scripts\\python.exe\' -c \'import sys, setuptools, tokenize; sys.argv[0] = \'"\'"\'C:\\\\Users\\\\Michael\\\\AppData\\\\Local\\\\Temp\\\\pip-install-obyvf2lq\\\\uwsgi\\\\setup.py\'"\'"\'; __file__=\'"\'"\'C:\\\\Users\\\\Michael\\\\AppData\\\\Local\\\\Temp\\\\pip-install-obyvf2lq\\\\uwsgi\\\\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 pip-egg-info', '         cwd: C:\\Users\\Michael\\AppData\\Local\\Temp\\pip-install-obyvf2lq\\uwsgi\\', '    Complete output (7 lines):', '    Traceback (most recent call last):', '      File "<string>", line 1, in <module>', '      File "C:\\Users\\Michael\\AppData\\Local\\Temp\\pip-install-obyvf2lq\\uwsgi\\setup.py", line 3, in <module>', '        import uwsgiconfig as uc', '      File "C:\\Users\\Michael\\AppData\\Local\\Temp\\pip-install-obyvf2lq\\uwsgi\\uwsgiconfig.py", line 8, in <module>', '        uwsgi_os = os.uname()[0]', "    AttributeError: module 'os' has no attribute 'uname'", '    ----------------------------------------', '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...
     ================================ 0/1 - 00:00:04

I hence I have never had an error free installation using pipenv on my dev computer.

EDIT: My situation was solved by using markers. However one could have a linux dev env which one doesnt want to install uwsgi.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Production-only dependencies · Issue #335 · pypa/pipenv
I need to have both Pipenv and prod-requirements.txt which share the many common items, and also need to edit both files when I...
Read more >
Basic Usage of Pipenv - Read the Docs
Pipfiles contain information for the dependencies of the project, and supersedes the requirements.txt file used in most Python projects. You should add a ......
Read more >
Handling development only dependencies with pipenv
I am using pipenv and have several packages that I only want to install during local development (e.g. pytest, unittest, matplotlib).
Read more >
Pipenv: A Guide to the New Python Packaging Tool
You don't need pytest in production so you can specify that this dependency is only for development with the --dev argument: $ pipenv...
Read more >
Pipenv and S2I: A better way to manage Python ...
The Pipenv packaging tool and Source-to-Image (S2I) help keep the proper ... only in the development environment and not in the production ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found