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 activate command - activate the virtual environment in the current shell

See original GitHub issue

Be sure to check the existing issues (both open and closed!), and make sure you are running the latest version of Pipenv.

Check the diagnose documentation for common issues and the PEEP list before posting! We may close your issue if it is very similar to one of them. Please be considerate and follow the PEEP process, or be on your way.

Make sure to mention your debugging experience if the documented solution failed.

Is your feature request related to a problem? Please describe.

I’d like to be able to use a pipenv command to activate the virtual environment for a project in the current shell. pipenv shell spawns a new shell (and often doesn’t work in a containerized environment) and the alternative is to use shell commands, which is fine but less straightforward.

Describe the solution you’d like

A new command pipenv activate that does the equivalent of calling source activate for the virtual environment. Then a user can call the exsting virtualenv deactivate when they want to deactivate the environment.

Describe alternatives you’ve considered

My current workaround on bash is source $(dirname $(pipenv run which python))/activate. It’s fine but not intuitive for someone not experienced with bash. It also breaks due to things like #5003 modifying stdout.

Additional context

Add any other context or screenshots about the feature request here. It may be a good idea to mention that platform and Python version you are on.


Please run $ pipenv --support, and paste the results here. Don’t put backticks (`) around it! The output already contains Markdown formatting.

(removed because too long for max issue body)

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
frostmingcommented, Mar 29, 2022

It is very easy to create an alias or shell function that does the following:

source $(pipenv --venv)/bin/activate

we are not going to implement it in pipenv.

0reactions
ericPrincecommented, Mar 30, 2022

Yeah, fine by me. For posterity, that command doesn’t work in windows since virtual environment exes are placed in the “Scripts” folder. That’s why I’ve been using source $(dirname $(pipenv run which python))/activate, so I can copy/paste the same thing wherever I am.

Read more comments on GitHub >

github_iconTop Results From Across the Web

how to activate existing virtual enviroment (using pipenv)
Then from inside the new project folder, run pipenv shell this creates a new environment. Then run pip install -r requirements.txt .
Read more >
How to manage Python projects with Pipenv - InfoWorld
To activate the environment, just navigate to your project directory and use pipenv shell to launch a new shell session or use pipenv...
Read more >
Pipenv & Virtual Environments
It's because this command is intended to be run in a shell (also called a terminal or ... To begin using the virtual...
Read more >
How to manage your python virtualenvs with Pipenv - Medium
Activate the environment. To open a shell with the already created virtualenv pipenv shell. You would see something like below: Launching subshell in ......
Read more >
How to create a virtual Python shell - ActiveState
A virtual Python shell is used to execute commands and compile Python code in a virtual environment on your local machine. Why Use...
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