python-poetry / python-poetry/poetry-plugin-shell

poetry shell cannot work

Open
#6 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
141
Forks
10
Avg merge
59m
Merged PRs (30d)
3

Description

Description

I try to run code from https://python-poetry.org/docs/basic-usage/#using-poetry-run, but it reports error...

poetry new project
cd project
conda activate your_env_name
which python
poetry run which python
poetry shell
which python
C:\Users\Administrator\Personal_scripts\Python\PythonScripts\ddd\poetry-demo>activate python312

(python312) C:\Users\Administrator\Personal_scripts\Python\PythonScripts\ddd\poetry-demo>which python
/c/ProgramData/anaconda3/envs/python312/python

(python312) C:\Users\Administrator\Personal_scripts\Python\PythonScripts\ddd\poetry-demo>poetry run which python
/c/ProgramData/anaconda3/envs/python312/python

(python312) C:\Users\Administrator\Personal_scripts\Python\PythonScripts\ddd\poetry-demo>poetry shell
Spawning shell within C:\ProgramData\anaconda3\envs\python312
'C:\ProgramData\anaconda3\envs\python312\Scripts\activate.bat' 不是内部或外部命令,也不是可运行的程序
或批处理文件。

(python312) C:\Users\Administrator\Personal_scripts\Python\PythonScripts\ddd\poetry-demo>

不是内部或外部命令,也不是可运行的程序
或批处理文件。

It's mean: It is not an internal or external command, nor is it a runnable program
Or batch file.

Workarounds

No....

Poetry Installation Method

system package manager (eg: dnf, apt etc.)

Operating System

Win10 Enterprise 21H2

Poetry Version

1.8.3

Poetry Configuration
(python312) C:\ProgramData\anaconda3\envs\python312>poetry config --list
cache-dir = "C:\\Users\\Administrator\\AppData\\Local\\pypoetry\\Cache"
experimental.system-git-client = false
installer.max-workers = null
installer.modern-installation = true
installer.no-binary = null
installer.parallel = true
keyring.enabled = true
solver.lazy-wheel = true
virtualenvs.create = true
virtualenvs.in-project = null
virtualenvs.options.always-copy = false
virtualenvs.options.no-pip = false
virtualenvs.options.no-setuptools = false
virtualenvs.options.system-site-packages = false
virtualenvs.path = "{cache-dir}\\virtualenvs"  # C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs
virtualenvs.prefer-active-python = false
virtualenvs.prompt = "{project_name}-py{python_version}"
warnings.export = true
Python Sysconfig
(python312) C:\ProgramData\anaconda3\envs\python312>python -m sysconfig
Platform: "win-amd64"
Python version: "3.12"
Current installation scheme: "nt"

Paths:
        data = "C:\ProgramData\anaconda3\envs\python312"
        include = "C:\ProgramData\anaconda3\envs\python312\Include"
        platinclude = "C:\ProgramData\anaconda3\envs\python312\Include"
        platlib = "C:\ProgramData\anaconda3\envs\python312\Lib\site-packages"
        platstdlib = "C:\ProgramData\anaconda3\envs\python312\Lib"
        purelib = "C:\ProgramData\anaconda3\envs\python312\Lib\site-packages"
        scripts = "C:\ProgramData\anaconda3\envs\python312\Scripts"
        stdlib = "C:\ProgramData\anaconda3\envs\python312\Lib"

Variables:
        BINDIR = "C:\ProgramData\anaconda3\envs\python312"
        BINLIBDEST = "C:\ProgramData\anaconda3\envs\python312\Lib"
        EXE = ".exe"
        EXT_SUFFIX = ".cp312-win_amd64.pyd"
        INCLUDEPY = "C:\ProgramData\anaconda3\envs\python312\Include"
        LIBDEST = "C:\ProgramData\anaconda3\envs\python312\Lib"
        TZPATH = "C:\ProgramData\anaconda3\envs\python312\share\zoneinfo"
        VERSION = "312"
        VPATH = "..\.."
        abiflags = ""
        base = "C:\ProgramData\anaconda3\envs\python312"
        exec_prefix = "C:\ProgramData\anaconda3\envs\python312"
        installed_base = "C:\ProgramData\anaconda3\envs\python312"
        installed_platbase = "C:\ProgramData\anaconda3\envs\python312"
        platbase = "C:\ProgramData\anaconda3\envs\python312"
        platlibdir = "DLLs"
        prefix = "C:\ProgramData\anaconda3\envs\python312"
        projectbase = "C:\ProgramData\anaconda3\envs\python312"
        py_version = "3.12.0"
        py_version_nodot = "312"
        py_version_nodot_plat = "312"
        py_version_short = "3.12"
        srcdir = "C:\ProgramData\anaconda3\envs\python312"
        userbase = "C:\Users\Administrator\AppData\Roaming\Python"
Example pyproject.toml

No response

Poetry Runtime Logs
(python312) C:\Users\Administrator\Personal_scripts\Python\PythonScripts\ddd\poetry-demo>poetry -vvv shell
Loading configuration file C:\Users\Administrator\AppData\Roaming\pypoetry\config.toml
Using virtualenv: C:\ProgramData\anaconda3\envs\python312
Virtual environment already activated: C:\ProgramData\anaconda3\envs\python312

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the listed poetry new, conda activation, poetry run, and poetry shell commands on Windows with Anaconda, then compare the verbose runtime log showing the already-activated environment. Check the plugin's Windows shell handling and verify completion when poetry shell no longer reports the missing activate.bat command and opens the expected shell.

Written by the indexing model from the issue text.

Assessment

Tech stack
anaconda, python
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.