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.

Poetry shell command does not start shell

See original GitHub issue
  • I am on the latest Poetry version.

  • I have searched the issues of this repo and believe that this is not a duplicate.

  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option) (Not applicable).

  • OS version and name: macos 10.15.6

  • Poetry version: 1.0.10

  • Link of a Gist with the contents of your pyproject.toml file: N/A

Issue

The basic issue is that poetry shell cannot be invoked within a virtual environment. Based on how this runs, I think the expectation is that we install poetry into the system.

My expectation is that I can invoke a poetry shell and drop into a standard virtual environment (i.e. a subshell that runs similar to vex).

Reproduceable steps:

`which python3` -m venv ~/.test-venv
. ~/.test-venv/bin/activate
pip install --upgrade pip poetry
deactivate
~/.test-venv/bin/poetry shell

The error will be something like:

Skipping virtualenv creation, as specified in config file.
Virtual environment already activated: ~/.test-venv

However, the virtual environment is not active.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:2
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
whoizitcommented, Sep 30, 2020

strange

$ exit
$ python -m venv .venv
$ echo $SHELL
/bin/bash
$ source .venv/bin/activate
bash: .venv/bin/activate: line 35: syntax error near unexpected token `}'
bash: .venv/bin/activate: line 35: `}'

$ bash --version
GNU bash, version 5.0.18(1)-release (x86_64-alpine-linux-musl)
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
0reactions
dimblebycommented, Jun 19, 2022

As you note, this is a duplicate of #2478. And as https://github.com/python-poetry/poetry/issues/2841#issuecomment-701575839 seems to show that you can reproduce it without poetry being involved: looks like nothing to do with poetry.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Poetry installed but `poetry: command not found`
When I run this, after shutdown of bash Terminal: export PATH="$HOME/.poetry/bin:$PATH". poetry command is then recognised.
Read more >
Basic usage | Documentation | Poetry - Python dependency ...
A Python application (Poetry), being a child process, cannot modify the environment of the shell that it has been called from such that...
Read more >
Python poetry: Explanations and tips - Frank-Mich's Blog
shell loads the virtual environnement and starts a shell. Here are the equivalent non-poetry commands. Poetry Version, Manual Version. Load the ...
Read more >
Command Line Samples - Meltano SDK
Activate the Poetry environment with poetry shell or prefix all your commands with poetry run . The commands you then run are the...
Read more >
Getting Started with Python Poetry - DEV Community ‍ ‍
The poetry run command will execute the command in the virtual ... with poetry shell after which we can execute python or other...
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