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.

documentation for using using existing virtualenv?

See original GitHub issue

I create my virtualenvs manually and use explicit paths in my projects rather than alter PATH. I have an intense dislike of tools that require an altered environment or otherwise encourage cargo cult behaviour, so I have avoided activate, virtualenvwrapper and such things.

Initially I was turned off by pipenv’s apparent insistence of creating virtualenvs for me and the complete inscrutability of how it does so. The documentation seems to suggest that my only other option was a .venv in my project directory, which I also do not want.

I just now discovered via browsing the issues that pipenv will apparently honour VIRTUAL_ENV. As far as I can tell, this variable is only used by other tools to detect an “activated” virtual env. But virtualenvs don’t need to be “activated” to be used; e.g. python, pip, and other tools work just fine by invoking their full path. I had expected pipenv to behave similarly if installed into the virtualenv.

However, running with VIRTUAL_ENV produces (inconsistently) an annoying “courtesy notice”, and this (and the function name warn_in_virtualenv) leads me to suspect that the scenario is somehow degenerate.

So, what’s the story? Is this feature supported and should it be documented? What is the approprate procedure for managing my dependencies in an existing virtualenv?

If it is intended that pipenv be the recommended tool for managing project dependencies (which is why I am here) then I imagine it appropriate to be far more explicit about how it does things rather than performing magic on the user’s behalf. I also imagine it appropriate for distinct functionality to be less coupled, e.g. lockfile management from virtualenv creation. Considering the lauded zen, one might suspect that python packaging is losing its buddha-nature.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
avddcommented, Mar 3, 2018

@kennethreitz what, that it is to remain an undocumented feature, with the implication that official python tools are moving towards becoming magical and “opinionated” rather than explicit and thoughtfully engineered?

2reactions
kennethreitzcommented, Mar 3, 2018

there’s little action for us to take here – it seems like you have a good understanding of how the tool works.

Read more comments on GitHub >

github_iconTop Results From Across the Web

venv — Creation of virtual environments — Python 3.11.1 ...
A virtual environment is created on top of an existing Python installation, known as the virtual environment's “base” Python, and may optionally be...
Read more >
User Guide — virtualenv 16.7.11 documentation
ENV/lib/ and ENV/include/ are created, containing supporting library files for a new virtualenv python. Packages installed in this ...
Read more >
Pipenv & Virtual Environments
virtualenv venv will create a folder in the current directory which will contain the Python executable files, and a copy of the pip...
Read more >
Python Virtual Environments: A Primer
With the default settings, venv will install both pip and setuptools. Using pip is the recommended way to install packages in Python, and ......
Read more >
Using a virtualenv for your web app - PythonAnywhere help
A virtualenv is a way to create a python environment that's isolated and separate from the normal system-wide installed packages.
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